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 36a6478 commit eb6a4f2
Show file tree
Hide file tree
Showing 7 changed files with 383 additions and 74 deletions.
10 changes: 9 additions & 1 deletion 3-tidy-up.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,15 @@ function handleLine(parsedLine) {
const glossTree = getGlossTree(sensesWithoutInflectionGlosses);

for (const reading of readings) {
lemmaDict[word][reading][pos][String(etymology_number)].glossTree = glossTree;
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)];
}
result = /** @type {LemmaInfo}*/ (ensureNestedObject(lemmaDict, [word, reading, pos, String(etym_num)]));
result.ipa ??= ipa;
result.glossTree = glossTree;
}
}

Expand Down
132 changes: 60 additions & 72 deletions data/test/dict/de/de/term_bank_1.json
Original file line number Diff line number Diff line change
@@ -1,83 +1,71 @@
[
[
"befruchteten",
"Rock",
"",
"non-lemma",
"",
"n",
0,
[
[
"befruchtet",
[
"Genitiv Singular Maskulinum der starken Deklination des Positivs"
{
"type": "structured-content",
"content": [
{
"tag": "div",
"content": [
"populäre Musikrichtung, die Anfang der 1950er Jahre in den USA entstand",
{
"tag": "div",
"data": {
"content": "extra-info"
},
"content": {
"tag": "div",
"data": {
"content": "example-sentence"
},
"content": [
{
"tag": "div",
"data": {
"content": "example-sentence-a"
},
"content": "Der Rock ist nicht totzukriegen."
},
{
"tag": "div",
"data": {
"content": "example-sentence-b"
}
}
]
}
}
]
}
]
],
[
"befruchtet",
[
"Akkusativ Singular Maskulinum der starken Deklination des Positivs"
]
],
[
"befruchtet",
[
"Genitiv Singular Neutrum der starken Deklination des Positivs"
]
],
[
"befruchtet",
[
"Dativ Plural alle Genera der starken Deklination des Positivs"
]
],
[
"befruchtet",
[
"Genitiv Singular alle Genera der schwachen Deklination des Positivs"
]
],
[
"befruchtet",
[
"Dativ Singular alle Genera der schwachen Deklination des Positivs"
]
],
[
"befruchtet",
[
"Akkusativ Singular Maskulinum der schwachen Deklination des Positivs"
]
],
[
"befruchtet",
[
"Alle Kasus Plural alle Genera der schwachen Deklination des Positivs"
]
],
[
"befruchtet",
[
"Genitiv Singular alle Genera der gemischten Deklination des Positivs"
]
],
[
"befruchtet",
[
"Dativ Singular alle Genera der gemischten Deklination des Positivs"
]
],
[
"befruchtet",
[
"Akkusativ Singular Maskulinum der gemischten Deklination des Positivs"
]
],
[
"befruchtet",
[
"Alle Kasus Plural alle Genera der gemischten Deklination des Positivs"
}
],
0,
""
],
[
"Rock",
"",
"",
"n",
0,
[
{
"type": "structured-content",
"content": [
{
"tag": "div",
"content": [
"in arabischen Märchen: flugfähiger Vogel in der Größe eines Elefanten"
]
}
]
]
}
],
0,
""
Expand Down
153 changes: 153 additions & 0 deletions data/test/dict/de/de/term_bank_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
[
[
"befruchteten",
"",
"non-lemma",
"",
0,
[
[
"befruchtet",
[
"Genitiv Singular Maskulinum der starken Deklination des Positivs"
]
],
[
"befruchtet",
[
"Akkusativ Singular Maskulinum der starken Deklination des Positivs"
]
],
[
"befruchtet",
[
"Genitiv Singular Neutrum der starken Deklination des Positivs"
]
],
[
"befruchtet",
[
"Dativ Plural alle Genera der starken Deklination des Positivs"
]
],
[
"befruchtet",
[
"Genitiv Singular alle Genera der schwachen Deklination des Positivs"
]
],
[
"befruchtet",
[
"Dativ Singular alle Genera der schwachen Deklination des Positivs"
]
],
[
"befruchtet",
[
"Akkusativ Singular Maskulinum der schwachen Deklination des Positivs"
]
],
[
"befruchtet",
[
"Alle Kasus Plural alle Genera der schwachen Deklination des Positivs"
]
],
[
"befruchtet",
[
"Genitiv Singular alle Genera der gemischten Deklination des Positivs"
]
],
[
"befruchtet",
[
"Dativ Singular alle Genera der gemischten Deklination des Positivs"
]
],
[
"befruchtet",
[
"Akkusativ Singular Maskulinum der gemischten Deklination des Positivs"
]
],
[
"befruchtet",
[
"Alle Kasus Plural alle Genera der gemischten Deklination des Positivs"
]
]
],
0,
""
],
[
"des Rock",
"",
"non-lemma",
"",
0,
[
[
"Rock",
[
"genitive singular"
]
]
],
0,
""
],
[
"des Rocks",
"",
"non-lemma",
"",
0,
[
[
"Rock",
[
"genitive singular"
]
]
],
0,
""
],
[
"dem Rock",
"",
"non-lemma",
"",
0,
[
[
"Rock",
[
"dative singular"
]
]
],
0,
""
],
[
"den Rock",
"",
"non-lemma",
"",
0,
[
[
"Rock",
[
"accusative singular"
]
]
],
0,
""
]
]
19 changes: 19 additions & 0 deletions data/test/ipa/de/de/term_meta_bank_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[
[
"Rock",
"ipa",
{
"reading": "Rock",
"transcriptions": [
{
"ipa": "ʁɔk",
"tags": []
},
{
"ipa": "ɹɔk",
"tags": []
}
]
}
]
]
Loading

0 comments on commit eb6a4f2

Please sign in to comment.