diff options
Diffstat (limited to 'ext/js/language/dictionary-data-util.js')
-rw-r--r-- | ext/js/language/dictionary-data-util.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ext/js/language/dictionary-data-util.js b/ext/js/language/dictionary-data-util.js index b3a354a7..dff9d212 100644 --- a/ext/js/language/dictionary-data-util.js +++ b/ext/js/language/dictionary-data-util.js @@ -143,6 +143,20 @@ class DictionaryDataUtil { return results2; } + static getTermFrequency(termTags) { + let totalScore = 0; + for (const {score} of termTags) { + totalScore += score; + } + if (totalScore > 0) { + return 'popular'; + } else if (totalScore < 0) { + return 'rare'; + } else { + return 'normal'; + } + } + // Private static _createFrequencyGroupsFromMap(map) { |