diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-12-05 21:16:24 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-05 21:16:24 -0500 |
commit | 0fc8578dee8f45e0891d753829216c0d5f584484 (patch) | |
tree | 3b7e110429a27578d7bf4a394b0cce9d1f28a778 | |
parent | 95b225462ad50af31da104427d61aff3597a8244 (diff) |
Fix pitch accent info gathering using new data format (#1081)
-rw-r--r-- | ext/mixed/js/dictionary-data-util.js | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/ext/mixed/js/dictionary-data-util.js b/ext/mixed/js/dictionary-data-util.js index 709f4ead..761bfc1c 100644 --- a/ext/mixed/js/dictionary-data-util.js +++ b/ext/mixed/js/dictionary-data-util.js @@ -17,20 +17,17 @@ class DictionaryDataUtil { static getPitchAccentInfos(definition) { - const {type} = definition; - if (type === 'kanji') { return []; } + if (definition.type === 'kanji') { return []; } const results = new Map(); const allExpressions = new Set(); const allReadings = new Set(); - const sources = [definition]; - for (const {pitches: expressionPitches, expression} of sources) { + for (const {expression, reading, pitches: expressionPitches} of definition.expressions) { allExpressions.add(expression); + allReadings.add(reading); - for (const {reading, pitches, dictionary} of expressionPitches) { - allReadings.add(reading); - + for (const {pitches, dictionary} of expressionPitches) { let dictionaryResults = results.get(dictionary); if (typeof dictionaryResults === 'undefined') { dictionaryResults = []; |