Skip to content

Commit

Permalink
handle unenumerated etymologies
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanVukovic99 committed Nov 22, 2024
1 parent eb6a4f2 commit 5678820
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions 3-tidy-up.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,21 @@ function handleLine(parsedLine) {
const glossTree = getGlossTree(sensesWithoutInflectionGlosses);

for (const reading of readings) {
let result = lemmaDict[word][reading][pos][String(etymology_number)];
let etym_num = etymology_number;
while (result && result.glossTree && result.glossTree.size > 0) {
etym_num += 1;
result = lemmaDict[word][reading][pos][String(etym_num)];
const posDict = lemmaDict[word]?.[reading]?.[pos] || {};
let etymNum = etymology_number;
let result = posDict[String(etymNum)];

while (result?.glossTree?.size > 0) {
etymNum += 1;
result = posDict[String(etymNum)];
}
result = /** @type {LemmaInfo}*/ (ensureNestedObject(lemmaDict, [word, reading, pos, String(etym_num)]));

result = /** @type {LemmaInfo} */ (ensureNestedObject(lemmaDict, [word, reading, pos, String(etymNum)]));

result.ipa ??= ipa;
result.glossTree = glossTree;
}

}

/**
Expand Down

0 comments on commit 5678820

Please sign in to comment.