diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-11-04 19:35:57 -0500 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-11-10 14:02:43 -0500 |
commit | a9ab774a3fa4a1f161771b1291d1a8e4c5845084 (patch) | |
tree | 18642a864d78c0bc4cf77b07636313eb794fa214 | |
parent | d9b44040751846d6b0bbf5fcf6ea4152f6ce9bcc (diff) |
Move function
-rw-r--r-- | ext/bg/js/translator.js | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js index ff1d24f3..d04b1cb3 100644 --- a/ext/bg/js/translator.js +++ b/ext/bg/js/translator.js @@ -47,22 +47,6 @@ class Translator { await this.database.deleteDictionary(dictionaryName); } - async findTermsGrouped(text, dictionaries, alphanumeric, options) { - const titles = Object.keys(dictionaries); - const {length, definitions} = await this.findTerms(text, dictionaries, alphanumeric); - - const definitionsGrouped = dictTermsGroup(definitions, dictionaries); - await this.buildTermFrequencies(definitionsGrouped, titles); - - if (options.general.compactTags) { - for (const definition of definitionsGrouped) { - dictTermsCompressTags(definition.definitions); - } - } - - return {length, definitions: definitionsGrouped}; - } - async getSequencedDefinitions(definitions, mainDictionary) { const definitionsBySequence = dictTermsMergeBySequence(definitions, mainDictionary); const defaultDefinitions = definitionsBySequence['-1']; @@ -157,6 +141,22 @@ class Translator { return result; } + async findTermsGrouped(text, dictionaries, alphanumeric, options) { + const titles = Object.keys(dictionaries); + const {length, definitions} = await this.findTerms(text, dictionaries, alphanumeric); + + const definitionsGrouped = dictTermsGroup(definitions, dictionaries); + await this.buildTermFrequencies(definitionsGrouped, titles); + + if (options.general.compactTags) { + for (const definition of definitionsGrouped) { + dictTermsCompressTags(definition.definitions); + } + } + + return {length, definitions: definitionsGrouped}; + } + async findTermsMerged(text, dictionaries, alphanumeric, options) { const secondarySearchTitles = Object.keys(options.dictionaries).filter(dict => options.dictionaries[dict].allowSecondarySearches); const titles = Object.keys(dictionaries); |