From ebce40264a8882a88579d9c541240b03fe86e087 Mon Sep 17 00:00:00 2001 From: Cashew <52880648+Casheeew@users.noreply.github.com> Date: Sat, 24 Aug 2024 10:45:00 +0700 Subject: [PATCH] =?UTF-8?q?Add=20=E3=82=93=E3=81=8B=E3=81=A3=E3=81=9F=20de?= =?UTF-8?q?inflections=20(#1340)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add deinflections * fix test --- ext/js/language/ja/japanese-transforms.js | 30 +++++++++++++++++++++++ test/language/japanese-transforms.test.js | 18 ++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/ext/js/language/ja/japanese-transforms.js b/ext/js/language/ja/japanese-transforms.js index d42657a57f..d4d48062f1 100644 --- a/ext/js/language/ja/japanese-transforms.js +++ b/ext/js/language/ja/japanese-transforms.js @@ -726,6 +726,36 @@ export const japaneseTransforms = { suffixInflection('來ん', '來る', [], ['vk']), ], }, + '-n past': { + name: '-n', + description: 'Past negative form of verbs; a sound change of ぬ.\n', + i18n: [ + { + language: 'ja', + name: '~んかった', + description: '打消の過去を示す。なかった。', + }, + ], + rules: [ + suffixInflection('んかった', 'る', [], ['v1']), + suffixInflection('かんかった', 'く', [], ['v5']), + suffixInflection('がんかった', 'ぐ', [], ['v5']), + suffixInflection('さんかった', 'す', [], ['v5']), + suffixInflection('たんかった', 'つ', [], ['v5']), + suffixInflection('なんかった', 'ぬ', [], ['v5']), + suffixInflection('ばんかった', 'ぶ', [], ['v5']), + suffixInflection('まんかった', 'む', [], ['v5']), + suffixInflection('らんかった', 'る', [], ['v5']), + suffixInflection('わんかった', 'う', [], ['v5']), + suffixInflection('ぜんかった', 'ずる', [], ['vz']), + suffixInflection('せんかった', 'する', [], ['vs']), + suffixInflection('為んかった', '為る', [], ['vs']), + suffixInflection('こんかった', 'くる', [], ['vk']), + suffixInflection('来んかった', '来る', [], ['vk']), + suffixInflection('來んかった', '來る', [], ['vk']), + suffixInflection('ませんかった', 'ません', [], ['v']), + ], + }, '-mu': { name: '-mu', description: 'Archaic.\n' + diff --git a/test/language/japanese-transforms.test.js b/test/language/japanese-transforms.test.js index fb1cbaf7c5..380c00ac07 100644 --- a/test/language/japanese-transforms.test.js +++ b/test/language/japanese-transforms.test.js @@ -39,6 +39,7 @@ const tests = [ {term: '愛しい', source: '愛しかった', rule: 'adj-i', reasons: ['-ta']}, {term: '愛しい', source: '愛しくありません', rule: 'adj-i', reasons: ['-masu', 'negative']}, {term: '愛しい', source: '愛しくありませんでした', rule: 'adj-i', reasons: ['-masu', 'negative', '-ta']}, + {term: '愛しい', source: '愛しくありませんかった', rule: 'adj-i', reasons: ['-masu', 'negative', '-n past']}, {term: '愛しい', source: '愛しき', rule: 'adj-i', reasons: ['-ki']}, {term: '愛しい', source: '愛しげ', rule: 'adj-i', reasons: ['-ge']}, {term: '愛しい', source: '愛し気', rule: 'adj-i', reasons: ['-ge']}, @@ -87,6 +88,7 @@ const tests = [ {term: '食べる', source: '食べず', rule: 'v1', reasons: ['-zu']}, {term: '食べる', source: '食べぬ', rule: 'v1', reasons: ['-nu']}, {term: '食べる', source: '食べん', rule: 'v1', reasons: ['-n']}, + {term: '食べる', source: '食べんかった', rule: 'v1', reasons: ['-n past']}, {term: '食べる', source: '食べざる', rule: 'v1', reasons: ['-zaru']}, {term: '食べる', source: '食べねば', rule: 'v1', reasons: ['-neba']}, {term: '食べる', source: '食べにゃ', rule: 'v1', reasons: ['-neba', '-ya']}, @@ -144,6 +146,7 @@ const tests = [ {term: '買う', source: '買わず', rule: 'v5', reasons: ['-zu']}, {term: '買う', source: '買わぬ', rule: 'v5', reasons: ['-nu']}, {term: '買う', source: '買わん', rule: 'v5', reasons: ['-n']}, + {term: '買う', source: '買わんかった', rule: 'v5', reasons: ['-n past']}, {term: '買う', source: '買わざる', rule: 'v5', reasons: ['-zaru']}, {term: '買う', source: '買わねば', rule: 'v5', reasons: ['-neba']}, {term: '買う', source: '買わにゃ', rule: 'v5', reasons: ['-neba', '-ya']}, @@ -201,6 +204,7 @@ const tests = [ {term: '行く', source: '行かず', rule: 'v5', reasons: ['-zu']}, {term: '行く', source: '行かぬ', rule: 'v5', reasons: ['-nu']}, {term: '行く', source: '行かん', rule: 'v5', reasons: ['-n']}, + {term: '行く', source: '行かんかった', rule: 'v5', reasons: ['-n past']}, {term: '行く', source: '行かざる', rule: 'v5', reasons: ['-zaru']}, {term: '行く', source: '行かねば', rule: 'v5', reasons: ['-neba']}, {term: '行く', source: '行かにゃ', rule: 'v5', reasons: ['-neba', '-ya']}, @@ -258,6 +262,7 @@ const tests = [ {term: '泳ぐ', source: '泳がず', rule: 'v5', reasons: ['-zu']}, {term: '泳ぐ', source: '泳がぬ', rule: 'v5', reasons: ['-nu']}, {term: '泳ぐ', source: '泳がん', rule: 'v5', reasons: ['-n']}, + {term: '泳ぐ', source: '泳がんかった', rule: 'v5', reasons: ['-n past']}, {term: '泳ぐ', source: '泳がざる', rule: 'v5', reasons: ['-zaru']}, {term: '泳ぐ', source: '泳がねば', rule: 'v5', reasons: ['-neba']}, {term: '泳ぐ', source: '泳がにゃ', rule: 'v5', reasons: ['-neba', '-ya']}, @@ -314,6 +319,7 @@ const tests = [ {term: '話す', source: '話さず', rule: 'v5', reasons: ['-zu']}, {term: '話す', source: '話さぬ', rule: 'v5', reasons: ['-nu']}, {term: '話す', source: '話さん', rule: 'v5', reasons: ['-n']}, + {term: '話す', source: '話さんかった', rule: 'v5', reasons: ['-n past']}, {term: '話す', source: '話さざる', rule: 'v5', reasons: ['-zaru']}, {term: '話す', source: '話さねば', rule: 'v5', reasons: ['-neba']}, {term: '話す', source: '話さにゃ', rule: 'v5', reasons: ['-neba', '-ya']}, @@ -329,6 +335,7 @@ const tests = [ {term: '話す', source: '話してしまう', rule: 'v5', reasons: ['-te', '-shimau']}, {term: '増す', source: '増せん', rule: 'v5', reasons: ['potential', '-n']}, + {term: '増す', source: '増せんかった', rule: 'v5', reasons: ['potential', '-n past']}, ], }, { @@ -373,6 +380,7 @@ const tests = [ {term: '待つ', source: '待たず', rule: 'v5', reasons: ['-zu']}, {term: '待つ', source: '待たぬ', rule: 'v5', reasons: ['-nu']}, {term: '待つ', source: '待たん', rule: 'v5', reasons: ['-n']}, + {term: '待つ', source: '待たんかった', rule: 'v5', reasons: ['-n past']}, {term: '待つ', source: '待たざる', rule: 'v5', reasons: ['-zaru']}, {term: '待つ', source: '待たねば', rule: 'v5', reasons: ['-neba']}, {term: '待つ', source: '待たにゃ', rule: 'v5', reasons: ['-neba', '-ya']}, @@ -430,6 +438,7 @@ const tests = [ {term: '死ぬ', source: '死なず', rule: 'v5', reasons: ['-zu']}, {term: '死ぬ', source: '死なぬ', rule: 'v5', reasons: ['-nu']}, {term: '死ぬ', source: '死なん', rule: 'v5', reasons: ['-n']}, + {term: '死ぬ', source: '死なんかった', rule: 'v5', reasons: ['-n past']}, {term: '死ぬ', source: '死なざる', rule: 'v5', reasons: ['-zaru']}, {term: '死ぬ', source: '死なねば', rule: 'v5', reasons: ['-neba']}, {term: '死ぬ', source: '死なにゃ', rule: 'v5', reasons: ['-neba', '-ya']}, @@ -486,6 +495,7 @@ const tests = [ {term: '遊ぶ', source: '遊ばず', rule: 'v5', reasons: ['-zu']}, {term: '遊ぶ', source: '遊ばぬ', rule: 'v5', reasons: ['-nu']}, {term: '遊ぶ', source: '遊ばん', rule: 'v5', reasons: ['-n']}, + {term: '遊ぶ', source: '遊ばんかった', rule: 'v5', reasons: ['-n past']}, {term: '遊ぶ', source: '遊ばざる', rule: 'v5', reasons: ['-zaru']}, {term: '遊ぶ', source: '遊ばねば', rule: 'v5', reasons: ['-neba']}, {term: '遊ぶ', source: '遊ばにゃ', rule: 'v5', reasons: ['-neba', '-ya']}, @@ -542,6 +552,7 @@ const tests = [ {term: '飲む', source: '飲まず', rule: 'v5', reasons: ['-zu']}, {term: '飲む', source: '飲まぬ', rule: 'v5', reasons: ['-nu']}, {term: '飲む', source: '飲まん', rule: 'v5', reasons: ['-n']}, + {term: '飲む', source: '飲まんかった', rule: 'v5', reasons: ['-n past']}, {term: '飲む', source: '飲まざる', rule: 'v5', reasons: ['-zaru']}, {term: '飲む', source: '飲まねば', rule: 'v5', reasons: ['-neba']}, {term: '飲む', source: '飲まにゃ', rule: 'v5', reasons: ['-neba', '-ya']}, @@ -598,6 +609,7 @@ const tests = [ {term: '作る', source: '作らず', rule: 'v5', reasons: ['-zu']}, {term: '作る', source: '作らぬ', rule: 'v5', reasons: ['-nu']}, {term: '作る', source: '作らん', rule: 'v5', reasons: ['-n']}, + {term: '作る', source: '作らんかった', rule: 'v5', reasons: ['-n past']}, {term: '作る', source: '作らざる', rule: 'v5', reasons: ['-zaru']}, {term: '作る', source: '作らねば', rule: 'v5', reasons: ['-neba']}, {term: '作る', source: '作らにゃ', rule: 'v5', reasons: ['-neba', '-ya']}, @@ -659,6 +671,7 @@ const tests = [ {term: '為る', source: '為ず', rule: 'vs', reasons: ['-zu']}, {term: '為る', source: '為ぬ', rule: 'vs', reasons: ['-nu']}, {term: '為る', source: '為ん', rule: 'vs', reasons: ['-n']}, + {term: '為る', source: '為んかった', rule: 'vs', reasons: ['-n past']}, {term: '為る', source: '為ざる', rule: 'vs', reasons: ['-zaru']}, {term: '為る', source: '為ねば', rule: 'vs', reasons: ['-neba']}, {term: '為る', source: '為にゃ', rule: 'vs', reasons: ['-neba', '-ya']}, @@ -717,6 +730,7 @@ const tests = [ {term: 'する', source: 'せず', rule: 'vs', reasons: ['-zu']}, {term: 'する', source: 'せぬ', rule: 'vs', reasons: ['-nu']}, {term: 'する', source: 'せん', rule: 'vs', reasons: ['-n']}, + {term: 'する', source: 'せんかった', rule: 'vs', reasons: ['-n past']}, {term: 'する', source: 'せざる', rule: 'vs', reasons: ['-zaru']}, {term: 'する', source: 'せねば', rule: 'vs', reasons: ['-neba']}, {term: 'する', source: 'せにゃ', rule: 'vs', reasons: ['-neba', '-ya']}, @@ -770,6 +784,7 @@ const tests = [ {term: '来る', source: '来ず', rule: 'vk', reasons: ['-zu']}, {term: '来る', source: '来ぬ', rule: 'vk', reasons: ['-nu']}, {term: '来る', source: '来ん', rule: 'vk', reasons: ['-n']}, + {term: '来る', source: '来んかった', rule: 'vk', reasons: ['-n past']}, {term: '来る', source: '来ざる', rule: 'vk', reasons: ['-zaru']}, {term: '来る', source: '来ねば', rule: 'vk', reasons: ['-neba']}, {term: '来る', source: '来にゃ', rule: 'vk', reasons: ['-neba', '-ya']}, @@ -822,6 +837,7 @@ const tests = [ {term: '來る', source: '來ず', rule: 'vk', reasons: ['-zu']}, {term: '來る', source: '來ぬ', rule: 'vk', reasons: ['-nu']}, {term: '來る', source: '來ん', rule: 'vk', reasons: ['-n']}, + {term: '來る', source: '來んかった', rule: 'vk', reasons: ['-n past']}, {term: '來る', source: '來ざる', rule: 'vk', reasons: ['-zaru']}, {term: '來る', source: '來ねば', rule: 'vk', reasons: ['-neba']}, {term: '來る', source: '來にゃ', rule: 'vk', reasons: ['-neba', '-ya']}, @@ -874,6 +890,7 @@ const tests = [ {term: 'くる', source: 'こず', rule: 'vk', reasons: ['-zu']}, {term: 'くる', source: 'こぬ', rule: 'vk', reasons: ['-nu']}, {term: 'くる', source: 'こん', rule: 'vk', reasons: ['-n']}, + {term: 'くる', source: 'こんかった', rule: 'vk', reasons: ['-n past']}, {term: 'くる', source: 'こざる', rule: 'vk', reasons: ['-zaru']}, {term: 'くる', source: 'こねば', rule: 'vk', reasons: ['-neba']}, {term: 'くる', source: 'こにゃ', rule: 'vk', reasons: ['-neba', '-ya']}, @@ -938,6 +955,7 @@ const tests = [ {term: '論ずる', source: '論ぜず', rule: 'vz', reasons: ['-zu']}, {term: '論ずる', source: '論ぜぬ', rule: 'vz', reasons: ['-nu']}, {term: '論ずる', source: '論ぜん', rule: 'vz', reasons: ['-n']}, + {term: '論ずる', source: '論ぜんかった', rule: 'vz', reasons: ['-n past']}, {term: '論ずる', source: '論ぜざる', rule: 'vz', reasons: ['-zaru']}, {term: '論ずる', source: '論ぜねば', rule: 'vz', reasons: ['-neba']}, {term: '論ずる', source: '論ぜにゃ', rule: 'vz', reasons: ['-neba', '-ya']},