diff options
Diffstat (limited to 'test/deinflection/test.ts')
-rw-r--r-- | test/deinflection/test.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/deinflection/test.ts b/test/deinflection/test.ts new file mode 100644 index 0000000..3dc702b --- /dev/null +++ b/test/deinflection/test.ts @@ -0,0 +1,24 @@ +import DirectCoreClient from '../../core/direct/client.ts'; +import cases from "./cases.ts"; + +var core = new DirectCoreClient(); +await core.ready; + +cases.forEach(({ input, tags }) => { + Deno.test(`deinflection - ${input}`, async () => { + var { tokens } = await core.parseSentence(input); + + if (tokens.length == 0) + throw new Error("No parsed tokens for input"); + + // console.log(tokens); + var result = tokens.find(t => t.source == input); + if (!result) + throw new Error("No deconjugation found for input"); + + for (var tag of tags) + if (!result.tags.includes(tag)) + throw new Error(`Deconjugation doesn't include tag ${tag}`); + }); +}) + |