diff options
author | siikamiika <siikamiika@users.noreply.github.com> | 2017-10-12 09:59:09 +0300 |
---|---|---|
committer | siikamiika <siikamiika@users.noreply.github.com> | 2017-10-12 09:59:09 +0300 |
commit | 8d660e282911ffb5d7b504784a3c09f13b164953 (patch) | |
tree | 1f6b46ab54ab39d341b82ca701d64842f97da753 /ext/bg/js/translator.js | |
parent | 6523b77ca13ebbc02cc9a4586a83a9d0ec29807d (diff) |
add compact tags
Diffstat (limited to 'ext/bg/js/translator.js')
-rw-r--r-- | ext/bg/js/translator.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js index 99344b95..e307efc0 100644 --- a/ext/bg/js/translator.js +++ b/ext/bg/js/translator.js @@ -37,6 +37,7 @@ class Translator { } async findTermsGrouped(text, dictionaries, alphanumeric) { + const options = await apiOptionsGet(); const titles = Object.keys(dictionaries); const {length, definitions} = await this.findTerms(text, dictionaries, alphanumeric); @@ -45,6 +46,12 @@ class Translator { await this.buildTermFrequencies(definition, titles); } + if (options.general.compactTags) { + for (const definition of definitionsGrouped) { + dictTermsCompressTags(definition.definitions); + } + } + return {length, definitions: definitionsGrouped}; } @@ -120,6 +127,12 @@ class Translator { await this.buildTermFrequencies(definition, titles); } + if (options.general.compactTags) { + for (const definition of definitionsMerged) { + dictTermsCompressTags(definition.definitions); + } + } + return {length, definitions: dictTermsSort(definitionsMerged)}; } |