aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/translator.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-09-12 18:29:16 -0700
committerAlex Yatskov <alex@foosoft.net>2017-09-12 18:29:16 -0700
commit3b29893072b89b75c7fd82b9138b09572ec6248c (patch)
treec4ce890485b434c6d4fd5c73c6eb8047317d91d8 /ext/bg/js/translator.js
parent28364b97b0dcc72ecde43aad32f8c58561895382 (diff)
add frequency table support for terms
Diffstat (limited to 'ext/bg/js/translator.js')
-rw-r--r--ext/bg/js/translator.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js
index 1be485c7..3b9a1128 100644
--- a/ext/bg/js/translator.js
+++ b/ext/bg/js/translator.js
@@ -62,7 +62,14 @@ class Translator {
for (const definition of deinflection.definitions) {
const tags = definition.tags.map(tag => dictTagBuild(tag, definition.tagMeta));
tags.push(dictTagBuildSource(definition.dictionary));
+
+ let frequencies = await this.database.findTermFreq(definition.expression, titles);
+ if (frequencies.length === 0) {
+ frequencies = await this.database.findTermFreq(definition.reading, titles);
+ }
+
definitions.push({
+ frequencies,
source: deinflection.source,
reasons: deinflection.reasons,
score: definition.score,