summaryrefslogtreecommitdiff
path: root/ext/js/data/anki-note-data.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/data/anki-note-data.js')
-rw-r--r--ext/js/data/anki-note-data.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/ext/js/data/anki-note-data.js b/ext/js/data/anki-note-data.js
index 529bad18..a8a82a79 100644
--- a/ext/js/data/anki-note-data.js
+++ b/ext/js/data/anki-note-data.js
@@ -245,6 +245,7 @@ class AnkiNoteData {
}
for (const expression of definition2.expressions) {
this._defineFuriganaSegments(expression);
+ this._defineTermFrequency(expression);
}
}
}
@@ -257,6 +258,14 @@ class AnkiNoteData {
});
}
+ _defineTermFrequency(object) {
+ Object.defineProperty(object, 'termFrequency', {
+ configurable: true,
+ enumerable: true,
+ get: this._getTermFrequency.bind(this, object)
+ });
+ }
+
_getFuriganaSegments(object) {
if (this._furiganaSegmentsCache !== null) {
const cachedResult = this._furiganaSegmentsCache.get(object);
@@ -271,6 +280,11 @@ class AnkiNoteData {
return result;
}
+ _getTermFrequency(object) {
+ const {termTags} = object;
+ return DictionaryDataUtil.getTermFrequency(termTags);
+ }
+
_getAllDefinitions(definition) {
const definitions = [definition];
for (let i = 0; i < definitions.length; ++i) {