diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-07-10 19:05:54 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-07-10 19:05:54 +0200 |
commit | b9b95bf29c945767a01d6cb5b74ec0d09d8b7606 (patch) | |
tree | 8b0806621860dc8bf4caeed73105a3f46b5c4ee6 | |
parent | 65e7b2260d728a9c747d126f828e90ae34f05b40 (diff) |
all deinflection tests passing again
-rw-r--r-- | search/tags.ts | 2 | ||||
-rw-r--r-- | test/deinflection/test.ts | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/search/tags.ts b/search/tags.ts index fa70fe8..22ea315 100644 --- a/search/tags.ts +++ b/search/tags.ts @@ -198,6 +198,7 @@ export function parseTags(input: string) { if (tag == Tag.Inflection.Suffix.Te && [ Tag.Inflection.Tense.Continuous, // base for continuous tense Tag.Inflection.Obligatory, // base for obligatory inflection + Tag.Inflection.Temporary.ObligatoryParticle, // base for obligatory inflection Tag.Inflection.Attempt.Miru, // base for 〜みる attempt ].includes(lastTag as any)) continue; @@ -210,6 +211,7 @@ export function parseTags(input: string) { if (tag == Tag.Inflection.Conditional.Ba && [ Tag.Inflection.Obligatory, Tag.Inflection.Temporary.ObligatoryResult, + Tag.Inflection.Temporary.ObligatoryParticle, ].includes(lastTag as any)) continue; // normalize multiple Inflection.Negative to single Inflection.Affirmative or Inflection.Negative diff --git a/test/deinflection/test.ts b/test/deinflection/test.ts index 6c1667b..291ed83 100644 --- a/test/deinflection/test.ts +++ b/test/deinflection/test.ts @@ -10,9 +10,10 @@ cases.forEach(({ input, mustHave, mustNotHave, force }) => { throw new Error("No parsed terms for input"); // console.log(terms); - var result = terms.find(t => t.source == input); + terms = terms.filter(t => t.source == input); if (force) - result = terms.find(t => t.reading == force.reading && t.writing == force.writing); + terms = terms.filter(t => t.reading == force.reading && t.writing == force.writing); + var result = terms[0]; if (!result) throw new Error("No deconjugation found for input"); @@ -26,7 +27,7 @@ cases.forEach(({ input, mustHave, mustNotHave, force }) => { if (result.tags.includes(tag)) throw new Error(`Deconjugation includes unallowed tag ${tag}`); - console.log(result.writing + " + " + result.tags.filter(tag => tag.startsWith("infl:") && !tag.startsWith("infl:reason:")).join(" + ")); + // console.log(result.writing + " + " + result.tags.filter(tag => tag.startsWith("infl:") && !tag.startsWith("infl:reason:")).join(" + ")); }); }) |