Move function
This commit is contained in:
parent
d9b4404075
commit
a9ab774a3f
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user