Skip to content

Commit

Permalink
use regular space in multiword inflections, [de-de] parse more inflec…
Browse files Browse the repository at this point in the history
…tion glosses (#126)

* [de] add past participle to multiword inflections

* [de] add present participle to multiword inflections

* add demonstrativpronomens deinflections

* fix multiword

* add pronomens
  • Loading branch information
StefanVukovic99 authored Aug 7, 2024
1 parent 03940a0 commit 53a8943
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 26 deletions.
4 changes: 2 additions & 2 deletions 3-tidy-up.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function isInflectionGloss(glosses, formOf) {
glossesString = JSON.stringify(glosses);
switch (targetIso) {
case 'de':
if (glosses.some(gloss => /des (?:Verbs|Adjektivs|Substantivs)/.test(gloss))) return true;
if (glosses.some(gloss => /des (?:Verbs|Adjektivs|Substantivs|Demonstrativpronomens|Possessivpronomens|Pronomens)/.test(gloss))) return true;
case 'en':
if (glosses.some(gloss => /.*inflection of.*/.test(gloss))) return true;
if(!Array.isArray(formOf)) return false;
Expand Down Expand Up @@ -296,7 +296,7 @@ function processInflectionGlosses(glosses, word, pos) {
}

function processGermanInflectionGlosses(glosses, word, pos) {
const match1 = glosses[0].match(/(.*)des (?:Verbs|Adjektivs|Substantivs) (.*)$/);
const match1 = glosses[0].match(/(.*)des (?:Verbs|Adjektivs|Substantivs|Demonstrativpronomens|Possessivpronomens|Pronomens) (.*)$/);
if (!match1 || match1.length < 3) return;
const inflection = match1[1].trim();
const lemma = match1[2].trim();
Expand Down
11 changes: 9 additions & 2 deletions 4-make-yomitan.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,16 @@ let lastTermBankIndex = 0;
hypotheses = hypotheses
.map((hypothesis) =>
hypothesis
.map((inflection) => (inflection).trim())
.map((inflection) => inflection.trim())
.filter(Boolean)
).filter(hypothesis => hypothesis.length);
)
.filter(hypothesis => hypothesis.length)
.map((hypothesis) =>
hypothesis.map((inflection) =>
inflection.replace(/\u00A0/g, ' ')
)
);


return hypotheses;
});
Expand Down
36 changes: 18 additions & 18 deletions data/test/dict/cs/en/term_bank_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
[
"singular",
"feminine",
"past active participle"
"past active participle"
]
],
[
"přít",
[
"plural",
"neuter",
"past active participle"
"past active participle"
]
]
],
Expand All @@ -38,7 +38,7 @@
[
"first-person",
"singular",
"present indicative"
"present indicative"
]
]
],
Expand Down Expand Up @@ -66,7 +66,7 @@
[
"first-person",
"plural",
"present indicative"
"present indicative"
]
]
],
Expand All @@ -85,7 +85,7 @@
[
"second-person",
"singular",
"present indicative"
"present indicative"
]
]
],
Expand Down Expand Up @@ -113,7 +113,7 @@
[
"second-person",
"plural",
"present indicative"
"present indicative"
]
]
],
Expand Down Expand Up @@ -152,15 +152,15 @@
[
"singular",
"masculine",
"present transgressive"
"present transgressive"
]
],
[
"přít",
[
"third-person",
"singular",
"present indicative"
"present indicative"
]
]
],
Expand All @@ -179,7 +179,7 @@
[
"third-person",
"plural",
"present indicative"
"present indicative"
]
]
],
Expand All @@ -199,7 +199,7 @@
"singular",
"past",
"participle",
"masculine animate"
"masculine animate"
]
],
[
Expand All @@ -208,7 +208,7 @@
"singular",
"past",
"participle",
"masculine inanimate"
"masculine inanimate"
]
]
],
Expand All @@ -228,7 +228,7 @@
"plural",
"past",
"participle",
"masculine animate"
"masculine animate"
]
]
],
Expand Down Expand Up @@ -257,7 +257,7 @@
"plural",
"past",
"participle",
"masculine inanimate"
"masculine inanimate"
]
]
],
Expand Down Expand Up @@ -296,7 +296,7 @@
[
"singular",
"masculine",
"present transgressive"
"present transgressive"
]
]
],
Expand All @@ -316,7 +316,7 @@
"singular",
"feminine",
"neuter",
"present transgressive"
"present transgressive"
]
]
],
Expand All @@ -336,7 +336,7 @@
"singular",
"feminine",
"neuter",
"present transgressive"
"present transgressive"
]
]
],
Expand All @@ -354,7 +354,7 @@
"přít",
[
"plural",
"present transgressive"
"present transgressive"
]
]
],
Expand All @@ -372,7 +372,7 @@
"přít",
[
"plural",
"present transgressive"
"present transgressive"
]
]
],
Expand Down
6 changes: 3 additions & 3 deletions data/test/dict/de/en/term_bank_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
[
"pflegen",
[
"past participle"
"past participle"
]
]
],
Expand Down Expand Up @@ -149,7 +149,7 @@
[
"pflegen",
[
"past participle"
"past participle"
]
]
],
Expand Down Expand Up @@ -193,7 +193,7 @@
[
"pflegen",
[
"present participle"
"present participle"
]
]
],
Expand Down
2 changes: 1 addition & 1 deletion data/test/dict/la/en/term_bank_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -2551,7 +2551,7 @@
[
"legō",
[
"perfect passive participle"
"perfect passive participle"
]
]
],
Expand Down

0 comments on commit 53a8943

Please sign in to comment.