From 2a301182ce97a3e5ea65675cdd010423c1f488c9 Mon Sep 17 00:00:00 2001 From: Khai Truong Date: Sun, 8 Sep 2024 11:10:39 +0700 Subject: [PATCH] add teoku form --- .../japanese-language-transformer.bench.js | 10 ++ ext/js/language/ja/japanese-transforms.js | 35 ++---- test/language/japanese-transforms.test.js | 112 +++++++++++++----- 3 files changed, 107 insertions(+), 50 deletions(-) diff --git a/benches/japanese-language-transformer.bench.js b/benches/japanese-language-transformer.bench.js index ce0910cbd1..36134c1ea2 100644 --- a/benches/japanese-language-transformer.bench.js +++ b/benches/japanese-language-transformer.bench.js @@ -81,7 +81,10 @@ describe('japanese language transformer', () => { '食べよう', '食べるまい', '食べまい', + '食べておく', '食べとく', + '食べないでおく', + '食べないどく', '食べている', '食べておる', '食べてる', @@ -103,6 +106,7 @@ describe('japanese language transformer', () => { '打ち込んでいませんでした', '食べさせられたくなかった', '食べんとしませんかった', + '食べないどきたくありません', ]; const kuruInflections = [ @@ -148,7 +152,10 @@ describe('japanese language transformer', () => { 'こよう', 'くるまい', 'こまい', + 'きておく', 'きとく', + 'こないでおく', + 'こないどく', 'きている', 'きておる', 'きてる', @@ -212,7 +219,10 @@ describe('japanese language transformer', () => { 'しよう', 'するまい', 'しまい', + 'しておく', 'しとく', + 'しないでおく', + 'しないどく', 'している', 'しておる', 'してる', diff --git a/ext/js/language/ja/japanese-transforms.js b/ext/js/language/ja/japanese-transforms.js index 7479fd3b18..b0ca0c973a 100644 --- a/ext/js/language/ja/japanese-transforms.js +++ b/ext/js/language/ja/japanese-transforms.js @@ -1372,35 +1372,24 @@ export const japaneseTransforms = { suffixInflection('わされる', 'う', ['v1'], ['v5']), ], }, - '-toku': { - name: '-toku', - description: 'Contraction of -teoku.\n' + - 'To do certain things in advance in preparation (or in anticipation) of latter needs.\n' + - 'Usage: Attach おく to the te-form of verbs, then contract ておく into とく.', + '-teoku': { + name: '-teoku', + description: 'To do certain things in advance in preparation (or in anticipation) of latter needs.\n' + + 'Usage: Attach おく to the te-form of verbs.\n' + + 'Contraction: ておく → とく, でおく → どく', i18n: [ { language: 'ja', - name: '~とく', - description: '「~テオク」の縮約系', + name: '~ておく', }, ], rules: [ - suffixInflection('とく', 'る', ['v5'], ['v1']), - suffixInflection('いとく', 'く', ['v5'], ['v5']), - suffixInflection('いどく', 'ぐ', ['v5'], ['v5']), - suffixInflection('しとく', 'す', ['v5'], ['v5']), - suffixInflection('っとく', 'う', ['v5'], ['v5']), - suffixInflection('っとく', 'つ', ['v5'], ['v5']), - suffixInflection('っとく', 'る', ['v5'], ['v5']), - suffixInflection('んどく', 'ぬ', ['v5'], ['v5']), - suffixInflection('んどく', 'ぶ', ['v5'], ['v5']), - suffixInflection('んどく', 'む', ['v5'], ['v5']), - suffixInflection('じとく', 'ずる', ['v5'], ['vz']), - suffixInflection('しとく', 'する', ['v5'], ['vs']), - suffixInflection('為とく', '為る', ['v5'], ['vs']), - suffixInflection('きとく', 'くる', ['v5'], ['vk']), - suffixInflection('来とく', '来る', ['v5'], ['vk']), - suffixInflection('來とく', '來る', ['v5'], ['vk']), + suffixInflection('ておく', 'て', ['v5'], ['-te']), + suffixInflection('でおく', 'で', ['v5'], ['-te']), + suffixInflection('とく', 'て', ['v5'], ['-te']), + suffixInflection('どく', 'で', ['v5'], ['-te']), + suffixInflection('ないでおく', 'ない', ['v5'], ['adj-i']), + suffixInflection('ないどく', 'ない', ['v5'], ['adj-i']), ], }, '-teiru': { diff --git a/test/language/japanese-transforms.test.js b/test/language/japanese-transforms.test.js index a506c4c1e4..760ab36ac4 100644 --- a/test/language/japanese-transforms.test.js +++ b/test/language/japanese-transforms.test.js @@ -102,8 +102,11 @@ const tests = [ {term: '食べる', source: '食べよう', rule: 'v1', reasons: ['volitional']}, {term: '食べる', source: '食べるまい', rule: 'v1', reasons: ['-mai']}, {term: '食べる', source: '食べまい', rule: 'v1', reasons: ['-mai']}, - // ['causative-passive'] - {term: '食べる', source: '食べとく', rule: 'v1', reasons: ['-toku']}, + + {term: '食べる', source: '食べておく', rule: 'v1', reasons: ['-te', '-teoku']}, + {term: '食べる', source: '食べとく', rule: 'v1', reasons: ['-te', '-teoku']}, + {term: '食べる', source: '食べないでおく', rule: 'v1', reasons: ['negative', '-teoku']}, + {term: '食べる', source: '食べないどく', rule: 'v1', reasons: ['negative', '-teoku']}, {term: '食べる', source: '食べている', rule: 'v1', reasons: ['-te', '-teiru']}, {term: '食べる', source: '食べておる', rule: 'v1', reasons: ['-te', '-teiru']}, {term: '食べる', source: '食べてる', rule: 'v1', reasons: ['-te', '-teiru']}, @@ -167,7 +170,11 @@ const tests = [ {term: '買う', source: '買おう', rule: 'v5', reasons: ['volitional']}, {term: '買う', source: '買うまい', rule: 'v5', reasons: ['-mai']}, {term: '買う', source: '買わされる', rule: 'v5', reasons: ['causative-passive']}, - {term: '買う', source: '買っとく', rule: 'v5', reasons: ['-toku']}, + + {term: '買う', source: '買っておく', rule: 'v5', reasons: ['-te', '-teoku']}, + {term: '買う', source: '買っとく', rule: 'v5', reasons: ['-te', '-teoku']}, + {term: '買う', source: '買わないでおく', rule: 'v5', reasons: ['negative', '-teoku']}, + {term: '買う', source: '買わないどく', rule: 'v5', reasons: ['negative', '-teoku']}, {term: '買う', source: '買っている', rule: 'v5', reasons: ['-te', '-teiru']}, {term: '買う', source: '買っておる', rule: 'v5', reasons: ['-te', '-teiru']}, {term: '買う', source: '買ってる', rule: 'v5', reasons: ['-te', '-teiru']}, @@ -236,7 +243,11 @@ const tests = [ {term: '行く', source: '行こう', rule: 'v5', reasons: ['volitional']}, {term: '行く', source: '行くまい', rule: 'v5', reasons: ['-mai']}, {term: '行く', source: '行かされる', rule: 'v5', reasons: ['causative-passive']}, - {term: '行く', source: '行いとく', rule: 'v5', reasons: ['-toku']}, + + {term: '行く', source: '行っておく', rule: 'v5', reasons: ['-te', '-teoku']}, + {term: '行く', source: '行いとく', rule: 'v5', reasons: ['-te', '-teoku']}, + {term: '行く', source: '行かないでおく', rule: 'v5', reasons: ['negative', '-teoku']}, + {term: '行く', source: '行かないどく', rule: 'v5', reasons: ['negative', '-teoku']}, {term: '行く', source: '行っている', rule: 'v5', reasons: ['-te', '-teiru']}, {term: '行く', source: '行っておる', rule: 'v5', reasons: ['-te', '-teiru']}, {term: '行く', source: '行ってる', rule: 'v5', reasons: ['-te', '-teiru']}, @@ -305,7 +316,12 @@ const tests = [ {term: '泳ぐ', source: '泳ごう', rule: 'v5', reasons: ['volitional']}, {term: '泳ぐ', source: '泳ぐまい', rule: 'v5', reasons: ['-mai']}, {term: '泳ぐ', source: '泳がされる', rule: 'v5', reasons: ['causative-passive']}, - {term: '泳ぐ', source: '泳いどく', rule: 'v5', reasons: ['-toku']}, + + {term: '泳ぐ', source: '泳いでおく', rule: 'v5', reasons: ['-te', '-teoku']}, + {term: '泳ぐ', source: '泳いどく', rule: 'v5', reasons: ['-te', '-teoku']}, + {term: '泳ぐ', source: '泳がないでおく', rule: 'v5', reasons: ['negative', '-teoku']}, + {term: '泳ぐ', source: '泳がないどく', rule: 'v5', reasons: ['negative', '-teoku']}, + {term: '泳ぐ', source: '泳いでいる', rule: 'v5', reasons: ['-te', '-teiru']}, {term: '泳ぐ', source: '泳いでおる', rule: 'v5', reasons: ['-te', '-teiru']}, {term: '泳ぐ', source: '泳いでる', rule: 'v5', reasons: ['-te', '-teiru']}, @@ -372,8 +388,11 @@ const tests = [ {term: '話す', source: '話しましょう', rule: 'v5', reasons: ['-masu', 'volitional']}, {term: '話す', source: '話そう', rule: 'v5', reasons: ['volitional']}, {term: '話す', source: '話すまい', rule: 'v5', reasons: ['-mai']}, - // ['causative-passive'] - {term: '話す', source: '話しとく', rule: 'v5', reasons: ['-toku']}, + + {term: '話す', source: '話しておく', rule: 'v5', reasons: ['-te', '-teoku']}, + {term: '話す', source: '話しとく', rule: 'v5', reasons: ['-te', '-teoku']}, + {term: '話す', source: '話さないでおく', rule: 'v5', reasons: ['negative', '-teoku']}, + {term: '話す', source: '話さないどく', rule: 'v5', reasons: ['negative', '-teoku']}, {term: '話す', source: '話している', rule: 'v5', reasons: ['-te', '-teiru']}, {term: '話す', source: '話しておる', rule: 'v5', reasons: ['-te', '-teiru']}, {term: '話す', source: '話してる', rule: 'v5', reasons: ['-te', '-teiru']}, @@ -447,7 +466,12 @@ const tests = [ {term: '待つ', source: '待とう', rule: 'v5', reasons: ['volitional']}, {term: '待つ', source: '待つまい', rule: 'v5', reasons: ['-mai']}, {term: '待つ', source: '待たされる', rule: 'v5', reasons: ['causative-passive']}, - {term: '待つ', source: '待っとく', rule: 'v5', reasons: ['-toku']}, + + {term: '待つ', source: '待っておく', rule: 'v5', reasons: ['-te', '-teoku']}, + {term: '待つ', source: '待っとく', rule: 'v5', reasons: ['-te', '-teoku']}, + {term: '待つ', source: '待たないでおく', rule: 'v5', reasons: ['negative', '-teoku']}, + {term: '待つ', source: '待たないどく', rule: 'v5', reasons: ['negative', '-teoku']}, + {term: '待つ', source: '待っている', rule: 'v5', reasons: ['-te', '-teiru']}, {term: '待つ', source: '待っておる', rule: 'v5', reasons: ['-te', '-teiru']}, {term: '待つ', source: '待ってる', rule: 'v5', reasons: ['-te', '-teiru']}, @@ -516,7 +540,11 @@ const tests = [ {term: '死ぬ', source: '死のう', rule: 'v5', reasons: ['volitional']}, {term: '死ぬ', source: '死ぬまい', rule: 'v5', reasons: ['-mai']}, {term: '死ぬ', source: '死なされる', rule: 'v5', reasons: ['causative-passive']}, - {term: '死ぬ', source: '死んどく', rule: 'v5', reasons: ['-toku']}, + + {term: '死ぬ', source: '死んでおく', rule: 'v5', reasons: ['-te', '-teoku']}, + {term: '死ぬ', source: '死んどく', rule: 'v5', reasons: ['-te', '-teoku']}, + {term: '死ぬ', source: '死なないでおく', rule: 'v5', reasons: ['negative', '-teoku']}, + {term: '死ぬ', source: '死なないどく', rule: 'v5', reasons: ['negative', '-teoku']}, {term: '死ぬ', source: '死んでいる', rule: 'v5', reasons: ['-te', '-teiru']}, {term: '死ぬ', source: '死んでおる', rule: 'v5', reasons: ['-te', '-teiru']}, {term: '死ぬ', source: '死んでる', rule: 'v5', reasons: ['-te', '-teiru']}, @@ -584,7 +612,11 @@ const tests = [ {term: '遊ぶ', source: '遊ぼう', rule: 'v5', reasons: ['volitional']}, {term: '遊ぶ', source: '遊ぶまい', rule: 'v5', reasons: ['-mai']}, {term: '遊ぶ', source: '遊ばされる', rule: 'v5', reasons: ['causative-passive']}, - {term: '遊ぶ', source: '遊んどく', rule: 'v5', reasons: ['-toku']}, + + {term: '遊ぶ', source: '遊んでおく', rule: 'v5', reasons: ['-te', '-teoku']}, + {term: '遊ぶ', source: '遊んどく', rule: 'v5', reasons: ['-te', '-teoku']}, + {term: '遊ぶ', source: '遊んでおく', rule: 'v5', reasons: ['-te', '-teoku']}, + {term: '遊ぶ', source: '遊ばないでおく', rule: 'v5', reasons: ['negative', '-teoku']}, {term: '遊ぶ', source: '遊んでいる', rule: 'v5', reasons: ['-te', '-teiru']}, {term: '遊ぶ', source: '遊んでおる', rule: 'v5', reasons: ['-te', '-teiru']}, {term: '遊ぶ', source: '遊んでる', rule: 'v5', reasons: ['-te', '-teiru']}, @@ -652,7 +684,12 @@ const tests = [ {term: '飲む', source: '飲もう', rule: 'v5', reasons: ['volitional']}, {term: '飲む', source: '飲むまい', rule: 'v5', reasons: ['-mai']}, {term: '飲む', source: '飲まされる', rule: 'v5', reasons: ['causative-passive']}, - {term: '飲む', source: '飲んどく', rule: 'v5', reasons: ['-toku']}, + + {term: '飲む', source: '飲んでおく', rule: 'v5', reasons: ['-te', '-teoku']}, + {term: '飲む', source: '飲んどく', rule: 'v5', reasons: ['-te', '-teoku']}, + {term: '飲む', source: '飲まないでおく', rule: 'v5', reasons: ['negative', '-teoku']}, + {term: '飲む', source: '飲まないどく', rule: 'v5', reasons: ['negative', '-teoku']}, + {term: '飲む', source: '飲んでいる', rule: 'v5', reasons: ['-te', '-teiru']}, {term: '飲む', source: '飲んでおる', rule: 'v5', reasons: ['-te', '-teiru']}, {term: '飲む', source: '飲んでる', rule: 'v5', reasons: ['-te', '-teiru']}, @@ -718,7 +755,11 @@ const tests = [ {term: '作る', source: '作ろう', rule: 'v5', reasons: ['volitional']}, {term: '作る', source: '作るまい', rule: 'v5', reasons: ['-mai']}, {term: '作る', source: '作らされる', rule: 'v5', reasons: ['causative-passive']}, - {term: '作る', source: '作っとく', rule: 'v5', reasons: ['-toku']}, + + {term: '作る', source: '作っておく', rule: 'v5', reasons: ['-te', '-teoku']}, + {term: '作る', source: '作っとく', rule: 'v5', reasons: ['-te', '-teoku']}, + {term: '作る', source: '作らないでおく', rule: 'v5', reasons: ['negative', '-teoku']}, + {term: '作る', source: '作らないどく', rule: 'v5', reasons: ['negative', '-teoku']}, {term: '作る', source: '作っている', rule: 'v5', reasons: ['-te', '-teiru']}, {term: '作る', source: '作っておる', rule: 'v5', reasons: ['-te', '-teiru']}, {term: '作る', source: '作ってる', rule: 'v5', reasons: ['-te', '-teiru']}, @@ -786,13 +827,16 @@ const tests = [ {term: '為る', source: '為ざる', rule: 'vs', reasons: ['-zaru']}, {term: '為る', source: '為ねば', rule: 'vs', reasons: ['-neba']}, {term: '為る', source: '為にゃ', rule: 'vs', reasons: ['-neba', '-ya']}, - // ['continuative'] + {term: '為る', source: '為ましょう', rule: 'vs', reasons: ['-masu', 'volitional']}, {term: '為る', source: '為よう', rule: 'vs', reasons: ['volitional']}, {term: '為る', source: '為るまい', rule: 'vs', reasons: ['-mai']}, {term: '為る', source: '為まい', rule: 'vs', reasons: ['-mai']}, - // ['causative-passive'] - {term: '為る', source: '為とく', rule: 'vs', reasons: ['-toku']}, + + {term: '為る', source: '為ておく', rule: 'vs', reasons: ['-te', '-teoku']}, + {term: '為る', source: '為とく', rule: 'vs', reasons: ['-te', '-teoku']}, + {term: '為る', source: '為ないでおく', rule: 'vs', reasons: ['negative', '-teoku']}, + {term: '為る', source: '為ないどく', rule: 'vs', reasons: ['negative', '-teoku']}, {term: '為る', source: '為ている', rule: 'vs', reasons: ['-te', '-teiru']}, {term: '為る', source: '為ておる', rule: 'vs', reasons: ['-te', '-teiru']}, {term: '為る', source: '為てる', rule: 'vs', reasons: ['-te', '-teiru']}, @@ -863,8 +907,11 @@ const tests = [ {term: 'する', source: 'するまい', rule: 'vs', reasons: ['-mai']}, {term: 'する', source: 'しまい', rule: 'vs', reasons: ['-mai']}, {term: 'する', source: 'しなきゃ', rule: 'vs', reasons: ['negative', '-ba', '-ya']}, - // ['causative-passive'] - {term: 'する', source: 'しとく', rule: 'vs', reasons: ['-toku']}, + + {term: 'する', source: 'しておく', rule: 'vs', reasons: ['-te', '-teoku']}, + {term: 'する', source: 'しとく', rule: 'vs', reasons: ['-te', '-teoku']}, + {term: 'する', source: 'しないでおく', rule: 'vs', reasons: ['negative', '-teoku']}, + {term: 'する', source: 'しないどく', rule: 'vs', reasons: ['negative', '-teoku']}, {term: 'する', source: 'している', rule: 'vs', reasons: ['-te', '-teiru']}, {term: 'する', source: 'しておる', rule: 'vs', reasons: ['-te', '-teiru']}, {term: 'する', source: 'してる', rule: 'vs', reasons: ['-te', '-teiru']}, @@ -928,8 +975,11 @@ const tests = [ {term: '来る', source: '来よう', rule: 'vk', reasons: ['volitional']}, {term: '来る', source: '来るまい', rule: 'vk', reasons: ['-mai']}, {term: '来る', source: '来まい', rule: 'vk', reasons: ['-mai']}, - // ['causative-passive'] - {term: '来る', source: '来とく', rule: 'vk', reasons: ['-toku']}, + + {term: '来る', source: '来ておく', rule: 'vk', reasons: ['-te', '-teoku']}, + {term: '来る', source: '来とく', rule: 'vk', reasons: ['-te', '-teoku']}, + {term: '来る', source: '来ないでおく', rule: 'vk', reasons: ['negative', '-teoku']}, + {term: '来る', source: '来ないどく', rule: 'vk', reasons: ['negative', '-teoku']}, {term: '来る', source: '来ている', rule: 'vk', reasons: ['-te', '-teiru']}, {term: '来る', source: '来ておる', rule: 'vk', reasons: ['-te', '-teiru']}, {term: '来る', source: '来てる', rule: 'vk', reasons: ['-te', '-teiru']}, @@ -992,10 +1042,14 @@ const tests = [ {term: '來る', source: '來ましょう', rule: 'vk', reasons: ['-masu', 'volitional']}, {term: '來る', source: '來よう', rule: 'vk', reasons: ['volitional']}, {term: '來る', source: '來るまい', rule: 'vk', reasons: ['-mai']}, - {term: '來る', source: '來まい', rule: 'vk', reasons: ['-mai']}, - // ['causative-passive'] - {term: '來る', source: '來とく', rule: 'vk', reasons: ['-toku']}, + {term: '來る', source: '來とく', rule: 'vk', reasons: ['-te', '-teoku']}, + + {term: '來る', source: '來ておく', rule: 'vk', reasons: ['-te', '-teoku']}, + {term: '來る', source: '來とく', rule: 'vk', reasons: ['-te', '-teoku']}, + {term: '來る', source: '來ないでおく', rule: 'vk', reasons: ['negative', '-teoku']}, + {term: '來る', source: '來ないどく', rule: 'vk', reasons: ['negative', '-teoku']}, {term: '來る', source: '來ている', rule: 'vk', reasons: ['-te', '-teiru']}, + {term: '來る', source: '來ておる', rule: 'vk', reasons: ['-te', '-teiru']}, {term: '來る', source: '來てる', rule: 'vk', reasons: ['-te', '-teiru']}, {term: '來る', source: '來とる', rule: 'vk', reasons: ['-te', '-teiru']}, @@ -1058,8 +1112,11 @@ const tests = [ {term: 'くる', source: 'こよう', rule: 'vk', reasons: ['volitional']}, {term: 'くる', source: 'くるまい', rule: 'vk', reasons: ['-mai']}, {term: 'くる', source: 'こまい', rule: 'vk', reasons: ['-mai']}, - // ['causative-passive'] - {term: 'くる', source: 'きとく', rule: 'vk', reasons: ['-toku']}, + + {term: 'くる', source: 'きておく', rule: 'vk', reasons: ['-te', '-teoku']}, + {term: 'くる', source: 'きとく', rule: 'vk', reasons: ['-te', '-teoku']}, + {term: 'くる', source: 'こないでおく', rule: 'vk', reasons: ['negative', '-teoku']}, + {term: 'くる', source: 'こないどく', rule: 'vk', reasons: ['negative', '-teoku']}, {term: 'くる', source: 'きている', rule: 'vk', reasons: ['-te', '-teiru']}, {term: 'くる', source: 'きておる', rule: 'vk', reasons: ['-te', '-teiru']}, {term: 'くる', source: 'きてる', rule: 'vk', reasons: ['-te', '-teiru']}, @@ -1133,13 +1190,13 @@ const tests = [ {term: '論ずる', source: '論ぜざる', rule: 'vz', reasons: ['-zaru']}, {term: '論ずる', source: '論ぜねば', rule: 'vz', reasons: ['-neba']}, {term: '論ずる', source: '論ぜにゃ', rule: 'vz', reasons: ['-neba', '-ya']}, - // ['continuative'] + {term: '論ずる', source: '論じましょう', rule: 'vz', reasons: ['-masu', 'volitional']}, {term: '論ずる', source: '論じよう', rule: 'vz', reasons: ['volitional']}, {term: '論ずる', source: '論ずるまい', rule: 'vz', reasons: ['-mai']}, {term: '論ずる', source: '論じまい', rule: 'vz', reasons: ['-mai']}, - // ['causative-passive'] - {term: '論ずる', source: '論じとく', rule: 'vz', reasons: ['-toku']}, + + {term: '論ずる', source: '論じとく', rule: 'vz', reasons: ['-te', '-teoku']}, {term: '論ずる', source: '論じている', rule: 'vz', reasons: ['-te', '-teiru']}, {term: '論ずる', source: '論じておる', rule: 'vz', reasons: ['-te', '-teiru']}, {term: '論ずる', source: '論じてる', rule: 'vz', reasons: ['-te', '-teiru']}, @@ -1327,6 +1384,7 @@ const tests = [ {term: '打ち込む', source: '打ち込んでいませんでした', rule: 'v5', reasons: ['-te', '-teiru', '-masu', 'negative', '-ta']}, {term: '食べる', source: '食べさせられたくなかった', rule: 'v1', reasons: ['causative', 'potential or passive', '-tai', 'negative', '-ta']}, {term: '食べる', source: '食べんとしませんかった', rule: 'v1', reasons: ['-ntosuru', '-masu', 'negative', '-ta']}, + {term: '食べる', source: '食べないどきたくありません', rule: 'v1', reasons: ['negative', '-teoku', '-tai', '-masu', 'negative']}, ], }, {