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

add missing inflections that include 'nominative' #63

Merged
merged 3 commits into from
Jun 11, 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
52 changes: 34 additions & 18 deletions 3-tidy-up.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,25 @@ function addDeinflections(form, pos, lemma, inflections) {
const blacklistedTags = [
'inflection-template',
'table-tags',
'nominative',
'canonical',
'class',
'error-unknown-tag',
'error-unrecognized-form',
'infinitive',
'includes-article',
'obsolete',
'archaic',
'used-in-the-form'
'used-in-the-form',
];

const identityTags = [
'nominative',
'singular',
'infinitive',
]

const redundantTags = [
'multiword-construction',
'combined-form'
];

let lineCount = 0;
Expand All @@ -133,21 +142,28 @@ function handleLine(line) {
if (word && pos && senses) {
if (forms) {
forms.forEach((formData) => {
const { form, tags } = formData;

if (form && tags && !tags.some(value => blacklistedTags.includes(value)) && form !== '-') {
const wordMap = automatedForms.get(word) || new Map();
const formMap = wordMap.get(form) || new Map();
formMap.get(pos) || formMap.set(pos, new Set());
wordMap.set(form, formMap);
automatedForms.set(word, wordMap);

const tagsSet = new Set((formMap.get(pos)));

tagsSet.add(sortTags(targetIso, tags).join(' '));

formMap.set(pos, similarSort(mergePersonTags(targetIso, Array.from(tagsSet))));
}
const { form } = formData;
let { tags } = formData;
if(!form) return;
if(!tags) return;
if(form === '-') return;
tags = tags.filter(tag => !redundantTags.includes(tag));
const isBlacklisted = tags.some(value => blacklistedTags.includes(value));
if (isBlacklisted) return;
const isIdentity = !tags.some(value => !identityTags.includes(value));
if (isIdentity) return;

const wordMap = automatedForms.get(word) || new Map();
const formMap = wordMap.get(form) || new Map();
formMap.get(pos) || formMap.set(pos, new Set());
wordMap.set(form, formMap);
automatedForms.set(word, wordMap);

const tagsSet = new Set((formMap.get(pos)));

tagsSet.add(sortTags(targetIso, tags).join(' '));

formMap.set(pos, similarSort(mergePersonTags(targetIso, Array.from(tagsSet))));
});
}

Expand Down
10 changes: 3 additions & 7 deletions 4-make-yomitan.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,10 @@ let lastTermBankIndex = 0;
if (!gloss) { return []; }

gloss = gloss
.replace(/-automated- /g, '')
if(target_iso === 'en'){
gloss = gloss
.replace(/multiword-construction /g, '')
.replace(/multiword-construction /g, '')

for (const multiwordInflection of multiwordInflections) {
gloss = gloss.replace(new RegExp(multiwordInflection), multiwordInflection.replace(/ /g, '\u00A0'));
}
for (const multiwordInflection of multiwordInflections) {
gloss = gloss.replace(new RegExp(multiwordInflection), multiwordInflection.replace(/ /g, '\u00A0'));
}

// TODO: decide on format for de-de
Expand Down
7 changes: 7 additions & 0 deletions data/test/dict/cs/en/term_bank_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,13 @@
"plural"
]
],
[
"zpráva",
[
"nominative",
"plural"
]
],
[
"zpráva",
[
Expand Down
Loading
Loading