Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle unenumerated etymologies #176

Merged
merged 2 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading