summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCashew <52880648+Scrub1492@users.noreply.github.com>2024-02-04 14:04:17 +0700
committerGitHub <noreply@github.com>2024-02-04 07:04:17 +0000
commit63a381743de94d2487a929cd3ef3f15e8166be0e (patch)
tree36c559019024bab851ac405a1a0969843380694e
parentea53ab5c59b33a30ab3cfb92c3a8a7624ab7f3ae (diff)
Deinflect Json overhaul (#433)
* deinflect overhaul template * remove duplicates with -e rule * deinflection updates * add neba deinflections * kansaiben updates * remove redundancy * Revert "remove redundancy" This reverts commit de714066851680314c988b577e77e6bd4c9db26a. * update deinflect.json * move deinflect.json to japanese-transforms.json * remove trailing spaces * wip add tests * update deinflect.json, add tests * run 'npm run test-code-write' * rename to kansai-ben * update tests * run 'npm run test-code-write' again * add -tara deinflection
-rw-r--r--ext/data/language/japanese-transforms.json227
-rw-r--r--test/data/anki-note-builder-test-results.json2
-rw-r--r--test/data/translator-test-results-note-data1.json7
-rw-r--r--test/data/translator-test-results.json7
-rw-r--r--test/language-transformer.test.js122
5 files changed, 360 insertions, 5 deletions
diff --git a/ext/data/language/japanese-transforms.json b/ext/data/language/japanese-transforms.json
index 007b1404..a4667879 100644
--- a/ext/data/language/japanese-transforms.json
+++ b/ext/data/language/japanese-transforms.json
@@ -411,6 +411,69 @@
]
},
{
+ "name": "-mu",
+ "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": "-zaru",
+ "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": "-neba",
+ "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": "adv",
"rules": [
{"suffixIn": "く", "suffixOut": "い", "conditionsIn": [], "conditionsOut": ["adj-i"]}
@@ -844,8 +907,168 @@
{"suffixIn": "ちぇえ", "suffixOut": "ちゃい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
{"suffixIn": "でえ", "suffixOut": "どい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
{"suffixIn": "れえ", "suffixOut": "れい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
- {"suffixIn": "べえ", "suffixOut": "ばい", "conditionsIn": [], "conditionsOut": ["adj-i"]}
+ {"suffixIn": "べえ", "suffixOut": "ばい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "てえ", "suffixOut": "たい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "ねぇ", "suffixOut": "ない", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "めぇ", "suffixOut": "むい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "みぃ", "suffixOut": "むい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "ちぃ", "suffixOut": "つい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "せぇ", "suffixOut": "すい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "けぇ", "suffixOut": "かい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "げぇ", "suffixOut": "がい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "げぇ", "suffixOut": "ごい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "せぇ", "suffixOut": "さい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "めぇ", "suffixOut": "まい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "ぜぇ", "suffixOut": "ずい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "っぜぇ", "suffixOut": "ずい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "れぇ", "suffixOut": "らい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "でぇ", "suffixOut": "どい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "れぇ", "suffixOut": "れい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "べぇ", "suffixOut": "ばい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "てぇ", "suffixOut": "たい", "conditionsIn": [], "conditionsOut": ["adj-i"]}
+ ]
+ },
+ {
+ "name": "slang",
+ "rules": [
+ {"suffixIn": "てぇてぇ", "suffixOut": "とうとい", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "てぇてぇ", "suffixOut": "尊い", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "おなしゃす", "suffixOut": "おねがいします", "conditionsIn": [], "conditionsOut": ["v5"]},
+ {"suffixIn": "おなしゃす", "suffixOut": "お願いします", "conditionsIn": [], "conditionsOut": ["v5"]},
+ {"suffixIn": "あざす", "suffixOut": "ありがとうございます", "conditionsIn": [], "conditionsOut": ["v5"]},
+ {"suffixIn": "さーせん", "suffixOut": "すみません", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "神ってる", "suffixOut": "神がかっている", "conditionsIn": [], "conditionsOut": ["v1p"]},
+ {"suffixIn": "じわる", "suffixOut": "じわじわ来る", "conditionsIn": [], "conditionsOut": ["vk"]},
+ {"suffixIn": "おさしみ", "suffixOut": "おやすみ", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "おやさい", "suffixOut": "おやすみ", "conditionsIn": [], "conditionsOut": []}
+ ]
+ },
+ {
+ "name": "kansai-ben",
+ "description": "Negative form of kansai-ben verbs",
+ "rules": [
+ {"suffixIn": "へん", "suffixOut": "ない", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "ひん", "suffixOut": "ない", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "せえへん", "suffixOut": "しない", "conditionsIn": [], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "へんかった", "suffixOut": "なかった", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ひんかった", "suffixOut": "なかった", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "うてへん", "suffixOut": "ってない", "conditionsIn": [], "conditionsOut": ["adj-i"]}
+ ]
+ },
+ {
+ "name": "kansai-ben",
+ "description": "-ku stem of kansai-ben adjectives",
+ "rules": [
+ {"suffixIn": "う", "suffixOut": "く", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "こう", "suffixOut": "かく", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ごう", "suffixOut": "がく", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "そう", "suffixOut": "さく", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "とう", "suffixOut": "たく", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "のう", "suffixOut": "なく", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ぼう", "suffixOut": "ばく", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "もう", "suffixOut": "まく", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ろう", "suffixOut": "らく", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "よう", "suffixOut": "よく", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "しゅう", "suffixOut": "しく", "conditionsIn": [], "conditionsOut": []}
+ ]
+ },
+ {
+ "name": "kansai-ben",
+ "description": "-te form of kansai-ben adjectives",
+ "rules": [
+ {"suffixIn": "うて", "suffixOut": "くて", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "こうて", "suffixOut": "かくて", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ごうて", "suffixOut": "がくて", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "そうて", "suffixOut": "さくて", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "とうて", "suffixOut": "たくて", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "のうて", "suffixOut": "なくて", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ぼうて", "suffixOut": "ばくて", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "もうて", "suffixOut": "まくて", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ろうて", "suffixOut": "らくて", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ようて", "suffixOut": "よくて", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "しゅうて", "suffixOut": "しくて", "conditionsIn": [], "conditionsOut": []}
+ ]
+ },
+ {
+ "name": "kansai-ben",
+ "description": "Negative form of kansai-ben adjectives",
+ "rules": [
+ {"suffixIn": "うない", "suffixOut": "くない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "こうない", "suffixOut": "かくない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "ごうない", "suffixOut": "がくない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "そうない", "suffixOut": "さくない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "とうない", "suffixOut": "たくない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "のうない", "suffixOut": "なくない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "ぼうない", "suffixOut": "ばくない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "もうない", "suffixOut": "まくない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "ろうない", "suffixOut": "らくない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "ようない", "suffixOut": "よくない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]},
+ {"suffixIn": "しゅうない", "suffixOut": "しくない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]}
+ ]
+ },
+ {
+ "name": "kansai-ben",
+ "description": "-te form of kansai-ben verbs",
+ "rules": [
+ {"suffixIn": "うて", "suffixOut": "って", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "おうて", "suffixOut": "あって", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "こうて", "suffixOut": "かって", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ごうて", "suffixOut": "がって", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "そうて", "suffixOut": "さって", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ぞうて", "suffixOut": "ざって", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "とうて", "suffixOut": "たって", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "どうて", "suffixOut": "だって", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "のうて", "suffixOut": "なって", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ほうて", "suffixOut": "はって", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ぼうて", "suffixOut": "ばって", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "もうて", "suffixOut": "まって", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ろうて", "suffixOut": "らって", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ようて", "suffixOut": "やって", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ゆうて", "suffixOut": "いって", "conditionsIn": [], "conditionsOut": []}
+ ]
+ },
+ {
+ "name": "kansai-ben",
+ "description": "past form of kansai-ben terms",
+ "rules": [
+ {"suffixIn": "うた", "suffixOut": "った", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "おうた", "suffixOut": "あった", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "こうた", "suffixOut": "かった", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ごうた", "suffixOut": "がった", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "そうた", "suffixOut": "さった", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ぞうた", "suffixOut": "ざった", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "とうた", "suffixOut": "たった", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "どうた", "suffixOut": "だった", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "のうた", "suffixOut": "なった", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ほうた", "suffixOut": "はった", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ぼうた", "suffixOut": "ばった", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "もうた", "suffixOut": "まった", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ろうた", "suffixOut": "らった", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ようた", "suffixOut": "やった", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ゆうた", "suffixOut": "いった", "conditionsIn": [], "conditionsOut": []}
+ ]
+ },
+ {
+ "name": "kansai-ben",
+ "description": "-tara form of kansai-ben terms",
+ "rules": [
+ {"suffixIn": "うたら", "suffixOut": "ったら", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "おうたら", "suffixOut": "あったら", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "こうたら", "suffixOut": "かったら", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ごうたら", "suffixOut": "がったら", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "そうたら", "suffixOut": "さったら", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ぞうたら", "suffixOut": "ざったら", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "とうたら", "suffixOut": "たったら", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "どうたら", "suffixOut": "だったら", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "のうたら", "suffixOut": "なったら", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ほうたら", "suffixOut": "はったら", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ぼうたら", "suffixOut": "ばったら", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "もうたら", "suffixOut": "まったら", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ろうたら", "suffixOut": "らったら", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ようたら", "suffixOut": "やったら", "conditionsIn": [], "conditionsOut": []},
+ {"suffixIn": "ゆうたら", "suffixOut": "いったら", "conditionsIn": [], "conditionsOut": []}
]
}
]
-} \ No newline at end of file
+}
+
diff --git a/test/data/anki-note-builder-test-results.json b/test/data/anki-note-builder-test-results.json
index 07b3182d..526beec7 100644
--- a/test/data/anki-note-builder-test-results.json
+++ b/test/data/anki-note-builder-test-results.json
@@ -3232,7 +3232,7 @@
"cloze-body": "のたもうた",
"cloze-prefix": "cloze-prefix",
"cloze-suffix": "cloze-suffix",
- "conjugation": "past",
+ "conjugation": "<ul><li>past</li><li>past « kansai-ben</li></ul>",
"dictionary": "Test Dictionary 2",
"document-title": "title",
"expression": "のたまう",
diff --git a/test/data/translator-test-results-note-data1.json b/test/data/translator-test-results-note-data1.json
index 610bb451..510b1bb5 100644
--- a/test/data/translator-test-results-note-data1.json
+++ b/test/data/translator-test-results-note-data1.json
@@ -29913,6 +29913,13 @@
"inflectionRules": [
"past"
]
+ },
+ {
+ "source": "algorithm",
+ "inflectionRules": [
+ "past",
+ "kansai-ben"
+ ]
}
],
"score": 1,
diff --git a/test/data/translator-test-results.json b/test/data/translator-test-results.json
index 8cf257ff..2b43e4bc 100644
--- a/test/data/translator-test-results.json
+++ b/test/data/translator-test-results.json
@@ -16893,6 +16893,13 @@
"inflectionRules": [
"past"
]
+ },
+ {
+ "source": "algorithm",
+ "inflectionRules": [
+ "past",
+ "kansai-ben"
+ ]
}
],
"score": 1,
diff --git a/test/language-transformer.test.js b/test/language-transformer.test.js
index b99c1bef..a0a69b64 100644
--- a/test/language-transformer.test.js
+++ b/test/language-transformer.test.js
@@ -122,6 +122,8 @@ function testDeinflections() {
{term: '食べる', source: '食べたり', rule: 'v1', reasons: ['-tari']},
{term: '食べる', source: '食べず', rule: 'v1', reasons: ['-zu']},
{term: '食べる', source: '食べぬ', rule: 'v1', reasons: ['-nu']},
+ {term: '食べる', source: '食べざる', rule: 'v1', reasons: ['-zaru']},
+ {term: '食べる', source: '食べねば', rule: 'v1', reasons: ['-neba']},
{term: '食べる', source: '食べ', rule: 'v1d', reasons: ['masu stem']},
{term: '食べる', source: '食べましょう', rule: 'v1', reasons: ['polite volitional']},
{term: '食べる', source: '食べよう', rule: 'v1', reasons: ['volitional']},
@@ -170,6 +172,8 @@ function testDeinflections() {
{term: '買う', source: '買ったり', rule: 'v5', reasons: ['-tari']},
{term: '買う', source: '買わず', rule: 'v5', reasons: ['-zu']},
{term: '買う', source: '買わぬ', rule: 'v5', reasons: ['-nu']},
+ {term: '買う', source: '買わざる', rule: 'v5', reasons: ['-zaru']},
+ {term: '買う', source: '買わねば', rule: 'v5', reasons: ['-neba']},
{term: '買う', source: '買い', rule: 'v5', reasons: ['masu stem']},
{term: '買う', source: '買いましょう', rule: 'v5', reasons: ['polite volitional']},
{term: '買う', source: '買おう', rule: 'v5', reasons: ['volitional']},
@@ -218,6 +222,8 @@ function testDeinflections() {
{term: '行く', source: '行いたり', rule: 'v5', reasons: ['-tari']},
{term: '行く', source: '行かず', rule: 'v5', reasons: ['-zu']},
{term: '行く', source: '行かぬ', rule: 'v5', reasons: ['-nu']},
+ {term: '行く', source: '行かざる', rule: 'v5', reasons: ['-zaru']},
+ {term: '行く', source: '行かねば', rule: 'v5', reasons: ['-neba']},
{term: '行く', source: '行き', rule: 'v5', reasons: ['masu stem']},
{term: '行く', source: '行きましょう', rule: 'v5', reasons: ['polite volitional']},
{term: '行く', source: '行こう', rule: 'v5', reasons: ['volitional']},
@@ -266,6 +272,8 @@ function testDeinflections() {
{term: '泳ぐ', source: '泳いだり', rule: 'v5', reasons: ['-tari']},
{term: '泳ぐ', source: '泳がず', rule: 'v5', reasons: ['-zu']},
{term: '泳ぐ', source: '泳がぬ', rule: 'v5', reasons: ['-nu']},
+ {term: '泳ぐ', source: '泳がざる', rule: 'v5', reasons: ['-zaru']},
+ {term: '泳ぐ', source: '泳がねば', rule: 'v5', reasons: ['-neba']},
{term: '泳ぐ', source: '泳ぎ', rule: 'v5', reasons: ['masu stem']},
{term: '泳ぐ', source: '泳ぎましょう', rule: 'v5', reasons: ['polite volitional']},
{term: '泳ぐ', source: '泳ごう', rule: 'v5', reasons: ['volitional']},
@@ -313,6 +321,8 @@ function testDeinflections() {
{term: '話す', source: '話したり', rule: 'v5', reasons: ['-tari']},
{term: '話す', source: '話さず', rule: 'v5', reasons: ['-zu']},
{term: '話す', source: '話さぬ', rule: 'v5', reasons: ['-nu']},
+ {term: '話す', source: '話さざる', rule: 'v5', reasons: ['-zaru']},
+ {term: '話す', source: '話さねば', rule: 'v5', reasons: ['-neba']},
{term: '話す', source: '話し', rule: 'v5', reasons: ['masu stem']},
{term: '話す', source: '話しましょう', rule: 'v5', reasons: ['polite volitional']},
{term: '話す', source: '話そう', rule: 'v5', reasons: ['volitional']},
@@ -361,6 +371,8 @@ function testDeinflections() {
{term: '待つ', source: '待ったり', rule: 'v5', reasons: ['-tari']},
{term: '待つ', source: '待たず', rule: 'v5', reasons: ['-zu']},
{term: '待つ', source: '待たぬ', rule: 'v5', reasons: ['-nu']},
+ {term: '待つ', source: '待たざる', rule: 'v5', reasons: ['-zaru']},
+ {term: '待つ', source: '待たねば', rule: 'v5', reasons: ['-neba']},
{term: '待つ', source: '待ち', rule: 'v5', reasons: ['masu stem']},
{term: '待つ', source: '待ちましょう', rule: 'v5', reasons: ['polite volitional']},
{term: '待つ', source: '待とう', rule: 'v5', reasons: ['volitional']},
@@ -409,6 +421,8 @@ function testDeinflections() {
{term: '死ぬ', source: '死んだり', rule: 'v5', reasons: ['-tari']},
{term: '死ぬ', source: '死なず', rule: 'v5', reasons: ['-zu']},
{term: '死ぬ', source: '死なぬ', rule: 'v5', reasons: ['-nu']},
+ {term: '死ぬ', source: '死なざる', rule: 'v5', reasons: ['-zaru']},
+ {term: '死ぬ', source: '死なねば', rule: 'v5', reasons: ['-neba']},
{term: '死ぬ', source: '死に', rule: 'v5', reasons: ['masu stem']},
{term: '死ぬ', source: '死にましょう', rule: 'v5', reasons: ['polite volitional']},
{term: '死ぬ', source: '死のう', rule: 'v5', reasons: ['volitional']},
@@ -456,6 +470,8 @@ function testDeinflections() {
{term: '遊ぶ', source: '遊んだり', rule: 'v5', reasons: ['-tari']},
{term: '遊ぶ', source: '遊ばず', rule: 'v5', reasons: ['-zu']},
{term: '遊ぶ', source: '遊ばぬ', rule: 'v5', reasons: ['-nu']},
+ {term: '遊ぶ', source: '遊ばざる', rule: 'v5', reasons: ['-zaru']},
+ {term: '遊ぶ', source: '遊ばねば', rule: 'v5', reasons: ['-neba']},
{term: '遊ぶ', source: '遊び', rule: 'v5', reasons: ['masu stem']},
{term: '遊ぶ', source: '遊びましょう', rule: 'v5', reasons: ['polite volitional']},
{term: '遊ぶ', source: '遊ぼう', rule: 'v5', reasons: ['volitional']},
@@ -503,6 +519,8 @@ function testDeinflections() {
{term: '飲む', source: '飲んだり', rule: 'v5', reasons: ['-tari']},
{term: '飲む', source: '飲まず', rule: 'v5', reasons: ['-zu']},
{term: '飲む', source: '飲まぬ', rule: 'v5', reasons: ['-nu']},
+ {term: '飲む', source: '飲まざる', rule: 'v5', reasons: ['-zaru']},
+ {term: '飲む', source: '飲まねば', rule: 'v5', reasons: ['-neba']},
{term: '飲む', source: '飲み', rule: 'v5', reasons: ['masu stem']},
{term: '飲む', source: '飲みましょう', rule: 'v5', reasons: ['polite volitional']},
{term: '飲む', source: '飲もう', rule: 'v5', reasons: ['volitional']},
@@ -550,6 +568,8 @@ function testDeinflections() {
{term: '作る', source: '作ったり', rule: 'v5', reasons: ['-tari']},
{term: '作る', source: '作らず', rule: 'v5', reasons: ['-zu']},
{term: '作る', source: '作らぬ', rule: 'v5', reasons: ['-nu']},
+ {term: '作る', source: '作らざる', rule: 'v5', reasons: ['-zaru']},
+ {term: '作る', source: '作らねば', rule: 'v5', reasons: ['-neba']},
{term: '作る', source: '作り', rule: 'v5', reasons: ['masu stem']},
{term: '作る', source: '作りましょう', rule: 'v5', reasons: ['polite volitional']},
{term: '作る', source: '作ろう', rule: 'v5', reasons: ['volitional']},
@@ -602,6 +622,8 @@ function testDeinflections() {
{term: '為る', source: '為たり', rule: 'vs', reasons: ['-tari']},
{term: '為る', source: '為ず', rule: 'vs', reasons: ['-zu']},
{term: '為る', source: '為ぬ', rule: 'vs', reasons: ['-nu']},
+ {term: '為る', source: '為ざる', rule: 'vs', reasons: ['-zaru']},
+ {term: '為る', source: '為ねば', rule: 'vs', reasons: ['-neba']},
// ['masu stem']
{term: '為る', source: '為ましょう', rule: 'vs', reasons: ['polite volitional']},
{term: '為る', source: '為よう', rule: 'vs', reasons: ['volitional']},
@@ -651,6 +673,8 @@ function testDeinflections() {
{term: 'する', source: 'したり', rule: 'vs', reasons: ['-tari']},
{term: 'する', source: 'せず', rule: 'vs', reasons: ['-zu']},
{term: 'する', source: 'せぬ', rule: 'vs', reasons: ['-nu']},
+ {term: 'する', source: 'せざる', rule: 'vs', reasons: ['-zaru']},
+ {term: 'する', source: 'せねば', rule: 'vs', reasons: ['-neba']},
// ['masu stem']
{term: 'する', source: 'しましょう', rule: 'vs', reasons: ['polite volitional']},
{term: 'する', source: 'しよう', rule: 'vs', reasons: ['volitional']},
@@ -694,6 +718,8 @@ function testDeinflections() {
{term: '来る', source: '来たり', rule: 'vk', reasons: ['-tari']},
{term: '来る', source: '来ず', rule: 'vk', reasons: ['-zu']},
{term: '来る', source: '来ぬ', rule: 'vk', reasons: ['-nu']},
+ {term: '来る', source: '来ざる', rule: 'vk', reasons: ['-zaru']},
+ {term: '来る', source: '来ねば', rule: 'vk', reasons: ['-neba']},
{term: '来る', source: '来', rule: 'vk', reasons: ['masu stem']},
{term: '来る', source: '来ましょう', rule: 'vk', reasons: ['polite volitional']},
{term: '来る', source: '来よう', rule: 'vk', reasons: ['volitional']},
@@ -737,6 +763,8 @@ function testDeinflections() {
{term: '來る', source: '來たり', rule: 'vk', reasons: ['-tari']},
{term: '來る', source: '來ず', rule: 'vk', reasons: ['-zu']},
{term: '來る', source: '來ぬ', rule: 'vk', reasons: ['-nu']},
+ {term: '來る', source: '來ざる', rule: 'vk', reasons: ['-zaru']},
+ {term: '來る', source: '來ねば', rule: 'vk', reasons: ['-neba']},
{term: '來る', source: '來', rule: 'vk', reasons: ['masu stem']},
{term: '來る', source: '來ましょう', rule: 'vk', reasons: ['polite volitional']},
{term: '來る', source: '來よう', rule: 'vk', reasons: ['volitional']},
@@ -780,6 +808,8 @@ function testDeinflections() {
{term: 'くる', source: 'きたり', rule: 'vk', reasons: ['-tari']},
{term: 'くる', source: 'こず', rule: 'vk', reasons: ['-zu']},
{term: 'くる', source: 'こぬ', rule: 'vk', reasons: ['-nu']},
+ {term: 'くる', source: 'こざる', rule: 'vk', reasons: ['-zaru']},
+ {term: 'くる', source: 'こねば', rule: 'vk', reasons: ['-neba']},
{term: 'くる', source: 'き', rule: 'vk', reasons: ['masu stem']},
{term: 'くる', source: 'きましょう', rule: 'vk', reasons: ['polite volitional']},
{term: 'くる', source: 'こよう', rule: 'vk', reasons: ['volitional']},
@@ -835,6 +865,8 @@ function testDeinflections() {
{term: '論ずる', source: '論じたり', rule: 'vz', reasons: ['-tari']},
{term: '論ずる', source: '論ぜず', rule: 'vz', reasons: ['-zu']},
{term: '論ずる', source: '論ぜぬ', rule: 'vz', reasons: ['-nu']},
+ {term: '論ずる', source: '論ぜざる', rule: 'vz', reasons: ['-zaru']},
+ {term: '論ずる', source: '論ぜねば', rule: 'vz', reasons: ['-neba']},
// ['masu stem']
{term: '論ずる', source: '論じましょう', rule: 'vz', reasons: ['polite volitional']},
{term: '論ずる', source: '論じよう', rule: 'vz', reasons: ['volitional']},
@@ -876,7 +908,27 @@ function testDeinflections() {
{term: 'ちっちゃい', source: 'ちっちぇえ', rule: 'adj-i', reasons: ['-e']},
{term: 'あかい', source: 'あけえ', rule: 'adj-i', reasons: ['-e']},
{term: 'こわい', source: 'こええ', rule: 'adj-i', reasons: ['-e']},
- {term: 'つよい', source: 'つええ', rule: 'adj-i', reasons: ['-e']}
+ {term: 'つよい', source: 'つええ', rule: 'adj-i', reasons: ['-e']},
+ // small -e
+ {term: 'すごい', source: 'すげぇ', rule: 'adj-i', reasons: ['-e']},
+ {term: 'やばい', source: 'やべぇ', rule: 'adj-i', reasons: ['-e']},
+ {term: 'うるさい', source: 'うるせぇ', rule: 'adj-i', reasons: ['-e']},
+ {term: 'ひどい', source: 'ひでぇ', rule: 'adj-i', reasons: ['-e']},
+ {term: 'ない', source: 'ねぇ', rule: 'adj-i', reasons: ['-e']},
+ {term: 'できる', source: 'できねぇ', rule: 'v1', reasons: ['negative', '-e']},
+ {term: 'しんじる', source: 'しんじねぇ', rule: 'v1', reasons: ['negative', '-e']},
+ {term: 'さむい', source: 'さめぇ', rule: 'adj-i', reasons: ['-e']},
+ {term: 'さむい', source: 'さみぃ', rule: 'adj-i', reasons: ['-e']},
+ {term: 'あつい', source: 'あちぃ', rule: 'adj-i', reasons: ['-e']},
+ {term: 'やすい', source: 'やせぇ', rule: 'adj-i', reasons: ['-e']},
+ {term: 'たかい', source: 'たけぇ', rule: 'adj-i', reasons: ['-e']},
+ {term: 'みじかい', source: 'みじけぇ', rule: 'adj-i', reasons: ['-e']},
+ {term: 'ながい', source: 'なげぇ', rule: 'adj-i', reasons: ['-e']},
+ {term: 'くさい', source: 'くせぇ', rule: 'adj-i', reasons: ['-e']},
+ {term: 'うまい', source: 'うめぇ', rule: 'adj-i', reasons: ['-e']},
+ {term: 'でかい', source: 'でけぇ', rule: 'adj-i', reasons: ['-e']},
+ {term: 'まずい', source: 'まっぜぇ', rule: 'adj-i', reasons: ['-e']},
+ {term: 'あかい', source: 'あけぇ', rule: 'adj-i', reasons: ['-e']}
]
},
{
@@ -1010,6 +1062,72 @@ function testDeinflections() {
tests: [
{term: '食べる', source: '食べて', rule: null, reasons: ['-te', 'progressive or perfect', 'masu stem']}
]
+ },
+ // Kansai-ben
+ {
+ category: '-ku stem of kansai-ben adjectives',
+ valid: true,
+ tests: [
+ {term: '宜しい', source: '宜しゅう', rule: null, reasons: ['adv', 'kansai-ben']},
+ {term: 'よろしい', source: 'よろしゅう', rule: null, reasons: ['adv', 'kansai-ben']},
+ {term: '良い', source: '良う', rule: null, reasons: ['adv', 'kansai-ben']},
+ {term: 'よい', source: 'よう', rule: null, reasons: ['adv', 'kansai-ben']}
+ ]
+ },
+ {
+ category: '-te form of kansai-ben adjectives',
+ valid: true,
+ tests: [
+ {term: 'よろしい', source: 'よろしゅうて', rule: null, reasons: ['-te', 'kansai-ben']},
+ {term: '宜しい', source: '宜しゅうて', rule: null, reasons: ['-te', 'kansai-ben']},
+ {term: 'よい', source: 'ようて', rule: null, reasons: ['-te', 'kansai-ben']},
+ {term: '良い', source: '良うて', rule: null, reasons: ['-te', 'kansai-ben']}
+ ]
+ },
+ {
+ category: 'Negative form of kansai-ben adjectives',
+ valid: true,
+ tests: [
+ {term: 'よろしい', source: 'よろしゅうない', rule: null, reasons: ['negative', 'kansai-ben']},
+ {term: '宜しい', source: '宜しゅうない', rule: null, reasons: ['negative', 'kansai-ben']},
+ {term: 'よい', source: 'ようない', rule: null, reasons: ['negative', 'kansai-ben']},
+ {term: '良い', source: '良うない', rule: null, reasons: ['negative', 'kansai-ben']}
+ ]
+ },
+ {
+ category: 'Negative form of kansai-ben verbs',
+ valid: true,
+ tests: [
+ {term: '食べる', source: '食べへん', rule: null, reasons: ['negative', 'kansai-ben']},
+ {term: '食べる', source: '食べへんかった', rule: null, reasons: ['negative', 'past', 'kansai-ben']}
+ ]
+ },
+ {
+ category: '-te form of kansai-ben verbs',
+ valid: true,
+ tests: [
+ {term: '買う', source: '買うて', rule: null, reasons: ['-te', 'kansai-ben']},
+ {term: 'かう', source: 'こうて', rule: null, reasons: ['-te', 'kansai-ben']},
+ {term: 'はう', source: 'ほうて', rule: null, reasons: ['-te', 'kansai-ben']}
+ ]
+ },
+ {
+ category: 'past form of kansai-ben terms',
+ valid: true,
+ tests: [
+ {term: '買う', source: '買うた', rule: null, reasons: ['past', 'kansai-ben']},
+ {term: 'かう', source: 'こうた', rule: null, reasons: ['past', 'kansai-ben']},
+ {term: 'はう', source: 'ほうた', rule: null, reasons: ['past', 'kansai-ben']}
+ ]
+ },
+ {
+ category: '-tara form of kansai-ben terms',
+ valid: true,
+ tests: [
+ {term: '買う', source: '買うたら', rule: null, reasons: ['-tara', 'kansai-ben']},
+ {term: 'かう', source: 'こうたら', rule: null, reasons: ['-tara', 'kansai-ben']},
+ {term: 'はう', source: 'ほうたら', rule: null, reasons: ['-tara', 'kansai-ben']}
+ ]
}
];
/* eslint-enable no-multi-spaces */
@@ -1025,7 +1143,7 @@ function testDeinflections() {
for (const {source, term, rule, reasons} of tests) {
const {has} = hasTermReasons(languageTransformer, source, term, rule, reasons);
let message = `${source} ${valid ? 'has' : 'does not have'} term candidate ${JSON.stringify(term)}`;
- if (typeof rule !== 'undefined') {
+ if (rule !== null) {
message += ` with rule ${JSON.stringify(rule)}`;
}
if (reasons !== null) {