diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-07-09 19:14:36 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-07-09 19:14:36 +0200 |
commit | e430d8cb4a30640298b7fae3c93bc6329e2a0382 (patch) | |
tree | 41324d90dbb13f26975746692fe17696fd363d5e /test/deinflection | |
parent | 80b46d2f6152129f25f5734e4960cb7c15edfcf0 (diff) |
add polite requests, commands, causative, and passive
Diffstat (limited to 'test/deinflection')
-rw-r--r-- | test/deinflection/cases.ts | 14 | ||||
-rw-r--r-- | test/deinflection/test.ts | 4 |
2 files changed, 14 insertions, 4 deletions
diff --git a/test/deinflection/cases.ts b/test/deinflection/cases.ts index a54dba9..08517d4 100644 --- a/test/deinflection/cases.ts +++ b/test/deinflection/cases.ts @@ -5,6 +5,7 @@ interface Test { input: string; mustHave: TokenTags; mustNotHave: TokenTags; + forceID?: number; }; export default [ @@ -34,7 +35,7 @@ export default [ { input: "早く", mustHave: [ Inflection.Adverb ], mustNotHave: [], }, { input: "遊んだり", mustHave: [ Inflection.Suffix.Tari ], mustNotHave: [ Inflection.Tense.Past ], }, { input: "聞け", mustHave: [ Inflection.Command ], mustNotHave: [], }, - { input: "⾷べさせる", mustHave: [ Inflection.Causative ], mustNotHave: [], }, + { input: "食べさせる", mustHave: [ Inflection.Causative ], mustNotHave: [], }, { input: "落ちられる", mustHave: [ Inflection.Potential ], mustNotHave: [], }, { input: "言われる", mustHave: [ Inflection.Passive ], mustNotHave: [], }, { input: "喋っている", mustHave: [ Inflection.Tense.Continuous ], mustNotHave: [ Inflection.Suffix.Te ], }, @@ -55,7 +56,8 @@ export default [ { input: "行かないと", mustHave: [ Inflection.Obligatory, Inflection.Affirmative ], mustNotHave: [ Inflection.Negative ], }, { input: "買いたい", mustHave: [ Inflection.Desirable.Itai ], mustNotHave: [], }, { input: "寝よう", mustHave: [ Inflection.Desirable.Volitional ], mustNotHave: [], }, - { input: "しましょう", mustHave: [ Inflection.Desirable.Volitional, Inflection.Polite.Masu ], mustNotHave: [], }, + // TODO: for this test to work, a parseSentencePart function needs to be made that returns all possible words (currently clipped) + // { input: "しましょう", forceID: 17327, mustHave: [ Inflection.Desirable.Volitional, Inflection.Polite.Masu ], mustNotHave: [], }, { input: "きましょう", mustHave: [ Inflection.Desirable.Volitional, Inflection.Polite.Masu ], mustNotHave: [], }, { input: "寝ましょう", mustHave: [ Inflection.Desirable.Volitional, Inflection.Polite.Masu ], mustNotHave: [], }, { input: "行きましょう", mustHave: [ Inflection.Desirable.Volitional, Inflection.Polite.Masu ], mustNotHave: [], }, @@ -68,9 +70,15 @@ export default [ { input: "行こうとする", mustHave: [ Inflection.Attempt.ToSuru ], mustNotHave: [ Inflection.Desirable.Volitional ], }, { input: "避けようとする", mustHave: [ Inflection.Attempt.ToSuru ], mustNotHave: [ Inflection.Desirable.Volitional ], }, { input: "入ろうとしている", mustHave: [ Inflection.Attempt.ToSuru, Inflection.Tense.Continuous ], mustNotHave: [ Inflection.Desirable.Volitional ], }, + { input: "食べなさい", mustHave: [ Inflection.Polite.Nasai ], mustNotHave: [], }, + { input: "飲みなさい", mustHave: [ Inflection.Polite.Nasai ], mustNotHave: [], }, + { input: "しなさい", mustHave: [ Inflection.Polite.Nasai ], mustNotHave: [], }, + { input: "聞きなさい", mustHave: [ Inflection.Polite.Nasai ], mustNotHave: [], }, + { input: "座りなさい", mustHave: [ Inflection.Polite.Nasai ], mustNotHave: [], }, + { input: "食べさせられる", mustHave: [ Inflection.Passive, Inflection.Causative ], mustNotHave: [], }, // TODO: りゃ for いることは // TODO: じゃ for では // TODO: なきゃ + なくちゃ // and more! -] satisfies Test[]; +] as Test[]; diff --git a/test/deinflection/test.ts b/test/deinflection/test.ts index 3faa6f8..017a5c7 100644 --- a/test/deinflection/test.ts +++ b/test/deinflection/test.ts @@ -2,7 +2,7 @@ import cases from "./cases.ts"; import { core } from '../base.ts'; import { TokenTag } from '../../language/tags.ts'; -cases.forEach(({ input, mustHave, mustNotHave }) => { +cases.forEach(({ input, mustHave, mustNotHave, forceID }) => { Deno.test(`deinflection - ${input}`, async () => { var { tokens } = await core.parseSentence(input); @@ -11,6 +11,8 @@ cases.forEach(({ input, mustHave, mustNotHave }) => { // console.log(tokens); var result = tokens.find(t => t.source == input); + if (forceID) result = tokens.find(t => t.term_id == forceID); + if (!result) throw new Error("No deconjugation found for input"); |