Skip to content

Commit

Permalink
[de-en] fix missing propositions (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanVukovic99 authored Aug 7, 2024
1 parent 53a8943 commit 097927c
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 3 deletions.
11 changes: 8 additions & 3 deletions 3-tidy-up.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,16 @@ function getCanonicalForm({word, forms}) {
form.tags &&
form.tags.includes('canonical')
);
if (canonicalForm) {
if (canonicalForm && canonicalForm.form) {
word = canonicalForm.form;

if (word && word.includes('{{#ifexist:Wiktionary')) { // TODO: remove once fixed in kaikki
word = word.replace(/ {{#if:.+/, '');
if (word.includes('{{#ifexist:Wiktionary')) { // TODO: remove once fixed in kaikki
word = word.replace(/ {{#if:.+/, '').trim();
}

bracketsRegex = /\[.*\]$/;
if (bracketsRegex.test(word)) {
word = word.replace(bracketsRegex, '').trim();
}
}
return word;
Expand Down
7 changes: 7 additions & 0 deletions data/test/dict/de/en/tag_bank_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,12 @@
1,
"rare",
-1
],
[
"prep",
"partOfSpeech",
-1,
"preposition",
1
]
]
16 changes: 16 additions & 0 deletions data/test/dict/de/en/term_bank_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -351,5 +351,21 @@
],
0,
""
],
[
"von",
"",
"prep",
"prep",
0,
[
"from",
"of, belonging to (often replacing genitive; see usage note below)",
"by (with passive voice)",
"about, of (a topic)",
"on, with (a resource)"
],
0,
""
]
]
17 changes: 17 additions & 0 deletions data/test/ipa/de/en/term_meta_bank_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,22 @@
}
]
}
],
[
"von",
"ipa",
{
"reading": "von",
"transcriptions": [
{
"ipa": "/fɔn/",
"tags": []
},
{
"ipa": "[fɔn]",
"tags": []
}
]
}
]
]
1 change: 1 addition & 0 deletions data/test/kaikki/de-en.json

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions data/test/tidy/de-en-lemmas.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,5 +442,53 @@
]
}
}
},
"von": {
"von": {
"prep": {
"ipa": [
{
"ipa": "/fɔn/",
"tags": []
},
{
"ipa": "[fɔn]",
"tags": []
}
],
"senses": [
{
"glosses": [
"from"
],
"tags": []
},
{
"glosses": [
"of, belonging to (often replacing genitive; see usage note below)"
],
"tags": []
},
{
"glosses": [
"by (with passive voice)"
],
"tags": []
},
{
"glosses": [
"about, of (a topic)"
],
"tags": []
},
{
"glosses": [
"on, with (a resource)"
],
"tags": []
}
]
}
}
}
}

0 comments on commit 097927c

Please sign in to comment.