summaryrefslogtreecommitdiff
path: root/ext/js/data
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-10-14 21:26:53 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-10-14 21:31:03 -0400
commit858fe7ae11850eaafb3e024289faf0c78e083abf (patch)
tree701390a05b3163199c06d7cf2482d13c6f61b1a2 /ext/js/data
parentf6c346136297c10389897b183db4f05c07d204fa (diff)
String frequency support (#1989)
* Restore support for string frequency values * Add support for {value, displayValue} frequencies * Update test data * Improve number parsing of string frequencies * Improve reading detection * Expose a displayValue property for frequency information * Update docs * Expose displayValue to Anki note data * Fix translator * Update display generation * Update test data * Update counts
Diffstat (limited to 'ext/js/data')
-rw-r--r--ext/js/data/sandbox/anki-note-data-creator.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/js/data/sandbox/anki-note-data-creator.js b/ext/js/data/sandbox/anki-note-data-creator.js
index b7abc0c5..8d363134 100644
--- a/ext/js/data/sandbox/anki-note-data-creator.js
+++ b/ext/js/data/sandbox/anki-note-data-creator.js
@@ -243,7 +243,7 @@ class AnkiNoteDataCreator {
_getKanjiFrequencies(dictionaryEntry) {
const results = [];
- for (const {index, dictionary, dictionaryIndex, dictionaryPriority, character, frequency} of dictionaryEntry.frequencies) {
+ for (const {index, dictionary, dictionaryIndex, dictionaryPriority, character, frequency, displayValue, displayValueParsed} of dictionaryEntry.frequencies) {
results.push({
index,
dictionary,
@@ -252,7 +252,7 @@ class AnkiNoteDataCreator {
priority: dictionaryPriority
},
character,
- frequency
+ frequency: displayValueParsed ? displayValue : frequency
});
}
return results;
@@ -374,7 +374,7 @@ class AnkiNoteDataCreator {
_getTermFrequencies(dictionaryEntry) {
const results = [];
const {headwords} = dictionaryEntry;
- for (const {headwordIndex, dictionary, dictionaryIndex, dictionaryPriority, hasReading, frequency} of dictionaryEntry.frequencies) {
+ for (const {headwordIndex, dictionary, dictionaryIndex, dictionaryPriority, hasReading, frequency, displayValue, displayValueParsed} of dictionaryEntry.frequencies) {
const {term, reading} = headwords[headwordIndex];
results.push({
index: results.length,
@@ -387,7 +387,7 @@ class AnkiNoteDataCreator {
expression: term,
reading,
hasReading,
- frequency
+ frequency: displayValueParsed ? displayValue : frequency
});
}
return results;
@@ -459,7 +459,7 @@ class AnkiNoteDataCreator {
_getTermExpressionFrequencies(dictionaryEntry, i) {
const results = [];
const {headwords, frequencies} = dictionaryEntry;
- for (const {headwordIndex, dictionary, dictionaryIndex, dictionaryPriority, hasReading, frequency} of frequencies) {
+ for (const {headwordIndex, dictionary, dictionaryIndex, dictionaryPriority, hasReading, frequency, displayValue, displayValueParsed} of frequencies) {
if (headwordIndex !== i) { continue; }
const {term, reading} = headwords[headwordIndex];
results.push({
@@ -473,7 +473,7 @@ class AnkiNoteDataCreator {
expression: term,
reading,
hasReading,
- frequency
+ frequency: displayValueParsed ? displayValue : frequency
});
}
return results;