From 6b327e0b7a7e8c91f1a7d99520c8769863228074 Mon Sep 17 00:00:00 2001 From: StefanVukovic99 Date: Sun, 4 Feb 2024 08:14:22 +0100 Subject: allow inflection rule chains with "polite" (#627) * fix deinflection bug * add test * fix polite te and past * expand verb flag * fix polite negative * fix polite volitional * fix polite past negative * remove unneeded rules in * new deinflector format * make nicer * lint * remove extra line --- ext/data/language/japanese-transforms.json | 145 ++++++++--------------------- 1 file changed, 38 insertions(+), 107 deletions(-) (limited to 'ext/data/language/japanese-transforms.json') diff --git a/ext/data/language/japanese-transforms.json b/ext/data/language/japanese-transforms.json index a4667879..af2d0b04 100644 --- a/ext/data/language/japanese-transforms.json +++ b/ext/data/language/japanese-transforms.json @@ -1,6 +1,17 @@ { "language": "ja", "conditions": { + "v": { + "name": "Verb", + "partsOfSpeech": ["v1", "v5", "vk", "vs", "vz"], + "i18n": [ + { + "language": "ja", + "name": "動詞" + } + ], + "subConditions": ["v1", "v5", "vk", "vs", "vz"] + }, "v1": { "name": "Ichidan verb", "partsOfSpeech": ["v1"], @@ -365,7 +376,8 @@ {"suffixIn": "添うて", "suffixOut": "添う", "conditionsIn": ["iru"], "conditionsOut": ["v5"]}, {"suffixIn": "副うて", "suffixOut": "副う", "conditionsIn": ["iru"], "conditionsOut": ["v5"]}, {"suffixIn": "厭うて", "suffixOut": "厭う", "conditionsIn": ["iru"], "conditionsOut": ["v5"]}, - {"suffixIn": "のたもうて", "suffixOut": "のたまう", "conditionsIn": ["iru"], "conditionsOut": ["v5"]} + {"suffixIn": "のたもうて", "suffixOut": "のたまう", "conditionsIn": ["iru"], "conditionsOut": ["v5"]}, + {"suffixIn": "まして", "suffixOut": "ます", "conditionsIn": [], "conditionsOut": ["v"]} ] }, { @@ -531,7 +543,7 @@ { "name": "imperative negative", "rules": [ - {"suffixIn": "な", "suffixOut": "", "conditionsIn": [], "conditionsOut": ["v1", "v5", "vk", "vs", "vz"]} + {"suffixIn": "な", "suffixOut": "", "conditionsIn": [], "conditionsOut": ["v"]} ] }, { @@ -592,7 +604,8 @@ {"suffixIn": "為ない", "suffixOut": "為る", "conditionsIn": ["adj-i"], "conditionsOut": ["vs"]}, {"suffixIn": "こない", "suffixOut": "くる", "conditionsIn": ["adj-i"], "conditionsOut": ["vk"]}, {"suffixIn": "来ない", "suffixOut": "来る", "conditionsIn": ["adj-i"], "conditionsOut": ["vk"]}, - {"suffixIn": "來ない", "suffixOut": "來る", "conditionsIn": ["adj-i"], "conditionsOut": ["vk"]} + {"suffixIn": "來ない", "suffixOut": "來る", "conditionsIn": ["adj-i"], "conditionsOut": ["vk"]}, + {"suffixIn": "ません", "suffixOut": "ます", "conditionsIn": ["v"], "conditionsOut": ["v"]} ] }, { @@ -659,114 +672,31 @@ {"suffixIn": "添うた", "suffixOut": "添う", "conditionsIn": [], "conditionsOut": ["v5"]}, {"suffixIn": "副うた", "suffixOut": "副う", "conditionsIn": [], "conditionsOut": ["v5"]}, {"suffixIn": "厭うた", "suffixOut": "厭う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "のたもうた", "suffixOut": "のたまう", "conditionsIn": [], "conditionsOut": ["v5"]} + {"suffixIn": "のたもうた", "suffixOut": "のたまう", "conditionsIn": [], "conditionsOut": ["v5"]}, + {"suffixIn": "ました", "suffixOut": "ます", "conditionsIn": [], "conditionsOut": ["v"]}, + {"suffixIn": "ませんでした", "suffixOut": "ません", "conditionsIn": [], "conditionsOut": ["v"]} ] }, { "name": "polite", "rules": [ - {"suffixIn": "ます", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v1"]}, - {"suffixIn": "います", "suffixOut": "う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "きます", "suffixOut": "く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ぎます", "suffixOut": "ぐ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "します", "suffixOut": "す", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ちます", "suffixOut": "つ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "にます", "suffixOut": "ぬ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "びます", "suffixOut": "ぶ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "みます", "suffixOut": "む", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ります", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "じます", "suffixOut": "ずる", "conditionsIn": [], "conditionsOut": ["vz"]}, - {"suffixIn": "します", "suffixOut": "する", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "為ます", "suffixOut": "為る", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "きます", "suffixOut": "くる", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "来ます", "suffixOut": "来る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "來ます", "suffixOut": "來る", "conditionsIn": [], "conditionsOut": ["vk"]} - ] - }, - { - "name": "polite negative", - "rules": [ - {"suffixIn": "くありません", "suffixOut": "い", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "ません", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v1"]}, - {"suffixIn": "いません", "suffixOut": "う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "きません", "suffixOut": "く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ぎません", "suffixOut": "ぐ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "しません", "suffixOut": "す", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ちません", "suffixOut": "つ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "にません", "suffixOut": "ぬ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "びません", "suffixOut": "ぶ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "みません", "suffixOut": "む", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "りません", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "じません", "suffixOut": "ずる", "conditionsIn": [], "conditionsOut": ["vz"]}, - {"suffixIn": "しません", "suffixOut": "する", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "為ません", "suffixOut": "為る", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "きません", "suffixOut": "くる", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "来ません", "suffixOut": "来る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "來ません", "suffixOut": "來る", "conditionsIn": [], "conditionsOut": ["vk"]} - ] - }, - { - "name": "polite past", - "rules": [ - {"suffixIn": "ました", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v1"]}, - {"suffixIn": "いました", "suffixOut": "う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "きました", "suffixOut": "く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ぎました", "suffixOut": "ぐ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "しました", "suffixOut": "す", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ちました", "suffixOut": "つ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "にました", "suffixOut": "ぬ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "びました", "suffixOut": "ぶ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "みました", "suffixOut": "む", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "りました", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "じました", "suffixOut": "ずる", "conditionsIn": [], "conditionsOut": ["vz"]}, - {"suffixIn": "しました", "suffixOut": "する", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "為ました", "suffixOut": "為る", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "きました", "suffixOut": "くる", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "来ました", "suffixOut": "来る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "來ました", "suffixOut": "來る", "conditionsIn": [], "conditionsOut": ["vk"]} - ] - }, - { - "name": "polite past negative", - "rules": [ - {"suffixIn": "くありませんでした", "suffixOut": "い", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "ませんでした", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v1"]}, - {"suffixIn": "いませんでした", "suffixOut": "う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "きませんでした", "suffixOut": "く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ぎませんでした", "suffixOut": "ぐ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "しませんでした", "suffixOut": "す", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ちませんでした", "suffixOut": "つ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "にませんでした", "suffixOut": "ぬ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "びませんでした", "suffixOut": "ぶ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "みませんでした", "suffixOut": "む", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "りませんでした", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "じませんでした", "suffixOut": "ずる", "conditionsIn": [], "conditionsOut": ["vz"]}, - {"suffixIn": "しませんでした", "suffixOut": "する", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "為ませんでした", "suffixOut": "為る", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "きませんでした", "suffixOut": "くる", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "来ませんでした", "suffixOut": "来る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "來ませんでした", "suffixOut": "來る", "conditionsIn": [], "conditionsOut": ["vk"]} - ] - }, - { - "name": "polite volitional", - "rules": [ - {"suffixIn": "ましょう", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v1"]}, - {"suffixIn": "いましょう", "suffixOut": "う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "きましょう", "suffixOut": "く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ぎましょう", "suffixOut": "ぐ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "しましょう", "suffixOut": "す", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ちましょう", "suffixOut": "つ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "にましょう", "suffixOut": "ぬ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "びましょう", "suffixOut": "ぶ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "みましょう", "suffixOut": "む", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "りましょう", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "じましょう", "suffixOut": "ずる", "conditionsIn": [], "conditionsOut": ["vz"]}, - {"suffixIn": "しましょう", "suffixOut": "する", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "為ましょう", "suffixOut": "為る", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "きましょう", "suffixOut": "くる", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "来ましょう", "suffixOut": "来る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "來ましょう", "suffixOut": "來る", "conditionsIn": [], "conditionsOut": ["vk"]} + {"suffixIn": "ます", "suffixOut": "る", "conditionsIn": ["v1"], "conditionsOut": ["v1"]}, + {"suffixIn": "います", "suffixOut": "う", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, + {"suffixIn": "きます", "suffixOut": "く", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, + {"suffixIn": "ぎます", "suffixOut": "ぐ", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, + {"suffixIn": "します", "suffixOut": "す", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, + {"suffixIn": "ちます", "suffixOut": "つ", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, + {"suffixIn": "にます", "suffixOut": "ぬ", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, + {"suffixIn": "びます", "suffixOut": "ぶ", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, + {"suffixIn": "みます", "suffixOut": "む", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, + {"suffixIn": "ります", "suffixOut": "る", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, + {"suffixIn": "じます", "suffixOut": "ずる", "conditionsIn": ["vz"], "conditionsOut": ["vz"]}, + {"suffixIn": "します", "suffixOut": "する", "conditionsIn": ["vs"], "conditionsOut": ["vs"]}, + {"suffixIn": "為ます", "suffixOut": "為る", "conditionsIn": ["vs"], "conditionsOut": ["vs"]}, + {"suffixIn": "きます", "suffixOut": "くる", "conditionsIn": ["vk"], "conditionsOut": ["vk"]}, + {"suffixIn": "来ます", "suffixOut": "来る", "conditionsIn": ["vk"], "conditionsOut": ["vk"]}, + {"suffixIn": "來ます", "suffixOut": "來る", "conditionsIn": ["vk"], "conditionsOut": ["vk"]}, + {"suffixIn": "くあります", "suffixOut": "い", "conditionsIn": ["v"], "conditionsOut": ["adj-i"]} ] }, { @@ -819,7 +749,8 @@ {"suffixIn": "為よう", "suffixOut": "為る", "conditionsIn": [], "conditionsOut": ["vs"]}, {"suffixIn": "こよう", "suffixOut": "くる", "conditionsIn": [], "conditionsOut": ["vk"]}, {"suffixIn": "来よう", "suffixOut": "来る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "來よう", "suffixOut": "來る", "conditionsIn": [], "conditionsOut": ["vk"]} + {"suffixIn": "來よう", "suffixOut": "來る", "conditionsIn": [], "conditionsOut": ["vk"]}, + {"suffixIn": "ましょう", "suffixOut": "ます", "conditionsIn": [], "conditionsOut": ["v"]} ] }, { -- cgit v1.2.3