Skip to content

Commit

Permalink
handle unenumerated etymologies (#176)
Browse files Browse the repository at this point in the history
* handle unenumerated etymologies

* handle unenumerated etymologies
  • Loading branch information
StefanVukovic99 authored Nov 23, 2024
1 parent 144741c commit b8f560d
Show file tree
Hide file tree
Showing 7 changed files with 388 additions and 74 deletions.
15 changes: 14 additions & 1 deletion 3-tidy-up.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,21 @@ function handleLine(parsedLine) {
const glossTree = getGlossTree(sensesWithoutInflectionGlosses);

for (const reading of readings) {
lemmaDict[word][reading][pos][String(etymology_number)].glossTree = glossTree;
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(etymNum)]));

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 b8f560d

Please sign in to comment.