Update sentence termination characters (#2059)

* Add vertical punctuation to terminationCharacters

* Upgrade settings

* Update tests
This commit is contained in:
toasted-nutbread 2022-02-02 20:09:13 -05:00 committed by GitHub
parent dea018670c
commit 258f1b629a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 4 deletions

View File

@ -1019,7 +1019,11 @@
{"enabled": true, "character1": "。", "character2": null, "includeCharacterAtStart": false, "includeCharacterAtEnd": true},
{"enabled": true, "character1": "", "character2": null, "includeCharacterAtStart": false, "includeCharacterAtEnd": true},
{"enabled": true, "character1": "", "character2": null, "includeCharacterAtStart": false, "includeCharacterAtEnd": true},
{"enabled": true, "character1": "…", "character2": null, "includeCharacterAtStart": false, "includeCharacterAtEnd": true}
{"enabled": true, "character1": "…", "character2": null, "includeCharacterAtStart": false, "includeCharacterAtEnd": true},
{"enabled": true, "character1": "︒", "character2": null, "includeCharacterAtStart": false, "includeCharacterAtEnd": true},
{"enabled": true, "character1": "︕", "character2": null, "includeCharacterAtStart": false, "includeCharacterAtEnd": true},
{"enabled": true, "character1": "︖", "character2": null, "includeCharacterAtStart": false, "includeCharacterAtEnd": true},
{"enabled": true, "character1": "︙", "character2": null, "includeCharacterAtStart": false, "includeCharacterAtEnd": true}
]
}
}

View File

@ -465,7 +465,8 @@ class OptionsUtil {
{async: true, update: this._updateVersion13.bind(this)},
{async: false, update: this._updateVersion14.bind(this)},
{async: false, update: this._updateVersion15.bind(this)},
{async: false, update: this._updateVersion16.bind(this)}
{async: false, update: this._updateVersion16.bind(this)},
{async: false, update: this._updateVersion17.bind(this)}
];
if (typeof targetVersion === 'number' && targetVersion < result.length) {
result.splice(targetVersion);
@ -898,4 +899,29 @@ class OptionsUtil {
}
return options;
}
_updateVersion17(options) {
// Version 17 changes:
// Added vertical sentence punctuation to terminationCharacters.
const additions = ['︒', '︕', '︖', '︙'];
for (const profile of options.profiles) {
const {terminationCharacters} = profile.options.sentenceParsing;
const newAdditions = [];
for (const character of additions) {
if (terminationCharacters.findIndex((value) => (value.character1 === character && value.character2 === null)) < 0) {
newAdditions.push(character);
}
}
for (const character of newAdditions) {
terminationCharacters.push({
enabled: true,
character1: character,
character2: null,
includeCharacterAtStart: false,
includeCharacterAtEnd: true
});
}
}
return options;
}
}

View File

@ -468,7 +468,11 @@ function createProfileOptionsUpdatedTestData1() {
{enabled: true, character1: '。', character2: null, includeCharacterAtStart: false, includeCharacterAtEnd: true},
{enabled: true, character1: '', character2: null, includeCharacterAtStart: false, includeCharacterAtEnd: true},
{enabled: true, character1: '', character2: null, includeCharacterAtStart: false, includeCharacterAtEnd: true},
{enabled: true, character1: '…', character2: null, includeCharacterAtStart: false, includeCharacterAtEnd: true}
{enabled: true, character1: '…', character2: null, includeCharacterAtStart: false, includeCharacterAtEnd: true},
{enabled: true, character1: '︒', character2: null, includeCharacterAtStart: false, includeCharacterAtEnd: true},
{enabled: true, character1: '︕', character2: null, includeCharacterAtStart: false, includeCharacterAtEnd: true},
{enabled: true, character1: '︖', character2: null, includeCharacterAtStart: false, includeCharacterAtEnd: true},
{enabled: true, character1: '︙', character2: null, includeCharacterAtStart: false, includeCharacterAtEnd: true}
]
},
inputs: {
@ -596,7 +600,7 @@ function createOptionsUpdatedTestData1() {
}
],
profileCurrent: 0,
version: 16,
version: 17,
global: {
database: {
prefixWildcardsSupported: false