diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-01-01 23:16:44 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-01 23:16:44 -0500 |
commit | 41f6de3e3a80afa8c60280c4829aaca8e5275e18 (patch) | |
tree | 81e1c39bb2658448024cdaff4bd2f05e22c9ba5c /ext/bg/js/translator.js | |
parent | a02891e52c00f950387017e86d35693d03a8a1d7 (diff) |
Simplify collapseEmphaticOptions options (#1196)
Diffstat (limited to 'ext/bg/js/translator.js')
-rw-r--r-- | ext/bg/js/translator.js | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js index c9cdf8e4..c23649e1 100644 --- a/ext/bg/js/translator.js +++ b/ext/bg/js/translator.js @@ -301,22 +301,13 @@ class Translator { } _getAllDeinflections(text, options) { - const collapseEmphaticOptions = [[false, false]]; - switch (options.collapseEmphaticSequences) { - case 'true': - collapseEmphaticOptions.push([true, false]); - break; - case 'full': - collapseEmphaticOptions.push([true, false], [true, true]); - break; - } const textOptionVariantArray = [ this._getTextOptionEntryVariants(options.convertHalfWidthCharacters), this._getTextOptionEntryVariants(options.convertNumericCharacters), this._getTextOptionEntryVariants(options.convertAlphabeticCharacters), this._getTextOptionEntryVariants(options.convertHiraganaToKatakana), this._getTextOptionEntryVariants(options.convertKatakanaToHiragana), - collapseEmphaticOptions + this._getCollapseEmphaticOptions(options) ]; const jp = this._japaneseUtil; @@ -875,6 +866,19 @@ class Translator { } } + _getCollapseEmphaticOptions(options) { + const collapseEmphaticOptions = [[false, false]]; + switch (options.collapseEmphaticSequences) { + case 'true': + collapseEmphaticOptions.push([true, false]); + break; + case 'full': + collapseEmphaticOptions.push([true, false], [true, true]); + break; + } + return collapseEmphaticOptions; + } + _getSecondarySearchDictionaryMap(enabledDictionaryMap) { const secondarySearchDictionaryMap = new Map(); for (const [dictionary, details] of enabledDictionaryMap.entries()) { |