Fix pitch accent info gathering using new data format (#1081)
This commit is contained in:
parent
95b225462a
commit
0fc8578dee
@ -17,20 +17,17 @@
|
|||||||
|
|
||||||
class DictionaryDataUtil {
|
class DictionaryDataUtil {
|
||||||
static getPitchAccentInfos(definition) {
|
static getPitchAccentInfos(definition) {
|
||||||
const {type} = definition;
|
if (definition.type === 'kanji') { return []; }
|
||||||
if (type === 'kanji') { return []; }
|
|
||||||
|
|
||||||
const results = new Map();
|
const results = new Map();
|
||||||
const allExpressions = new Set();
|
const allExpressions = new Set();
|
||||||
const allReadings = 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);
|
allExpressions.add(expression);
|
||||||
|
allReadings.add(reading);
|
||||||
|
|
||||||
for (const {reading, pitches, dictionary} of expressionPitches) {
|
for (const {pitches, dictionary} of expressionPitches) {
|
||||||
allReadings.add(reading);
|
|
||||||
|
|
||||||
let dictionaryResults = results.get(dictionary);
|
let dictionaryResults = results.get(dictionary);
|
||||||
if (typeof dictionaryResults === 'undefined') {
|
if (typeof dictionaryResults === 'undefined') {
|
||||||
dictionaryResults = [];
|
dictionaryResults = [];
|
||||||
|
Loading…
Reference in New Issue
Block a user