Skip to content

Commit

Permalink
[ja] Add -ntosuru form (#1393)
Browse files Browse the repository at this point in the history
* Add ntosuru form

* typo

* lint

* bench

* add combination bench
  • Loading branch information
khaitruong922 authored Sep 5, 2024
1 parent cb65993 commit aaa1617
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
4 changes: 4 additions & 0 deletions benches/japanese-language-transformer.bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ describe('japanese language transformer', () => {
'食べん',
'食べんかった',
'食べんばかり',
'食べんとする',
'食べますまい',
'食べましたら',
'食べますれば',
Expand All @@ -101,6 +102,7 @@ describe('japanese language transformer', () => {
'抱きかかえていなければ',
'打ち込んでいませんでした',
'食べさせられたくなかった',
'食べんとしませんかった',
];

const kuruInflections = [
Expand Down Expand Up @@ -155,6 +157,7 @@ describe('japanese language transformer', () => {
'こん',
'こんかった',
'こんばかり',
'こんとする',
'きますまい',
'きましたら',
'きますれば',
Expand Down Expand Up @@ -218,6 +221,7 @@ describe('japanese language transformer', () => {
'せん',
'せんかった',
'せんばかり',
'せんとする',
'しますまい',
'しましたら',
'しますれば',
Expand Down
32 changes: 32 additions & 0 deletions ext/js/language/ja/japanese-transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,38 @@ export const japaneseTransforms = {
suffixInflection('來んばかり', '來る', [], ['vk']),
],
},
'-ntosuru': {
name: '-ntosuru',
description: '1. Shows the speaker\'s will or intention.\n' +
'2. Shows an action or condition is on the verge of occurring.\n' +
'Usage: Attach んとする to the irrealis form (mizenkei) of verbs.\n' +
'する becomes せんとする',
i18n: [
{
language: 'ja',
name: '~んとする',
description: '…しようとする、…しようとしている',
},
],
rules: [
suffixInflection('んとする', 'る', ['vs'], ['v1']),
suffixInflection('かんとする', 'く', ['vs'], ['v5']),
suffixInflection('がんとする', 'ぐ', ['vs'], ['v5']),
suffixInflection('さんとする', 'す', ['vs'], ['v5']),
suffixInflection('たんとする', 'つ', ['vs'], ['v5']),
suffixInflection('なんとする', 'ぬ', ['vs'], ['v5']),
suffixInflection('ばんとする', 'ぶ', ['vs'], ['v5']),
suffixInflection('まんとする', 'む', ['vs'], ['v5']),
suffixInflection('らんとする', 'る', ['vs'], ['v5']),
suffixInflection('わんとする', 'う', ['vs'], ['v5']),
suffixInflection('ぜんとする', 'ずる', ['vs'], ['vz']),
suffixInflection('せんとする', 'する', ['vs'], ['vs']),
suffixInflection('為んとする', '為る', ['vs'], ['vs']),
suffixInflection('こんとする', 'くる', ['vs'], ['vk']),
suffixInflection('来んとする', '来る', ['vs'], ['vk']),
suffixInflection('來んとする', '來る', ['vs'], ['vk']),
],
},
'-mu': {
name: '-mu',
description: 'Archaic.\n' +
Expand Down
20 changes: 19 additions & 1 deletion test/language/japanese-transforms.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ const tests = [
{term: '食べる', source: '食べん', rule: 'v1', reasons: ['-n']},
{term: '食べる', source: '食べんかった', rule: 'v1', reasons: ['-n', '-ta']},
{term: '食べる', source: '食べんばかり', rule: 'v1', reasons: ['-nbakari']},
{term: '食べる', source: '食べんとする', rule: 'v1', reasons: ['-ntosuru']},
{term: '食べる', source: '食べざる', rule: 'v1', reasons: ['-zaru']},
{term: '食べる', source: '食べねば', rule: 'v1', reasons: ['-neba']},
{term: '食べる', source: '食べにゃ', rule: 'v1', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -157,6 +158,7 @@ const tests = [
{term: '買う', source: '買わん', rule: 'v5', reasons: ['-n']},
{term: '買う', source: '買わんかった', rule: 'v5', reasons: ['-n', '-ta']},
{term: '買う', source: '買わんばかり', rule: 'v5', reasons: ['-nbakari']},
{term: '買う', source: '買わんとする', rule: 'v5', reasons: ['-ntosuru']},
{term: '買う', source: '買わざる', rule: 'v5', reasons: ['-zaru']},
{term: '買う', source: '買わねば', rule: 'v5', reasons: ['-neba']},
{term: '買う', source: '買わにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -225,6 +227,7 @@ const tests = [
{term: '行く', source: '行かん', rule: 'v5', reasons: ['-n']},
{term: '行く', source: '行かんかった', rule: 'v5', reasons: ['-n', '-ta']},
{term: '行く', source: '行かんばかり', rule: 'v5', reasons: ['-nbakari']},
{term: '行く', source: '行かんとする', rule: 'v5', reasons: ['-ntosuru']},
{term: '行く', source: '行かざる', rule: 'v5', reasons: ['-zaru']},
{term: '行く', source: '行かねば', rule: 'v5', reasons: ['-neba']},
{term: '行く', source: '行かにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -293,6 +296,7 @@ const tests = [
{term: '泳ぐ', source: '泳がん', rule: 'v5', reasons: ['-n']},
{term: '泳ぐ', source: '泳がんかった', rule: 'v5', reasons: ['-n', '-ta']},
{term: '泳ぐ', source: '泳がんばかり', rule: 'v5', reasons: ['-nbakari']},
{term: '泳ぐ', source: '泳がんとする', rule: 'v5', reasons: ['-ntosuru']},
{term: '泳ぐ', source: '泳がざる', rule: 'v5', reasons: ['-zaru']},
{term: '泳ぐ', source: '泳がねば', rule: 'v5', reasons: ['-neba']},
{term: '泳ぐ', source: '泳がにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -359,6 +363,8 @@ const tests = [
{term: '話す', source: '話さぬ', rule: 'v5', reasons: ['-nu']},
{term: '話す', source: '話さん', rule: 'v5', reasons: ['-n']},
{term: '話す', source: '話さんかった', rule: 'v5', reasons: ['-n', '-ta']},
{term: '話す', source: '話さんばかり', rule: 'v5', reasons: ['-nbakari']},
{term: '話す', source: '話さんとする', rule: 'v5', reasons: ['-ntosuru']},
{term: '話す', source: '話さざる', rule: 'v5', reasons: ['-zaru']},
{term: '話す', source: '話さねば', rule: 'v5', reasons: ['-neba']},
{term: '話す', source: '話さにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
Expand All @@ -377,6 +383,7 @@ const tests = [
{term: '増す', source: '増せん', rule: 'v5', reasons: ['potential', '-n']},
{term: '増す', source: '増せんかった', rule: 'v5', reasons: ['potential', '-n', '-ta']},
{term: '増す', source: '増せんばかり', rule: 'v5', reasons: ['potential', '-nbakari']},
{term: '増す', source: '増せんとする', rule: 'v5', reasons: ['potential', '-ntosuru']},

{term: '話す', source: '話しますまい', rule: 'v5', reasons: ['-masu', '-mai']},
{term: '話す', source: '話しましたら', rule: 'v5', reasons: ['-masu', '-tara']},
Expand Down Expand Up @@ -431,6 +438,7 @@ const tests = [
{term: '待つ', source: '待たん', rule: 'v5', reasons: ['-n']},
{term: '待つ', source: '待たんかった', rule: 'v5', reasons: ['-n', '-ta']},
{term: '待つ', source: '待たんばかり', rule: 'v5', reasons: ['-nbakari']},
{term: '待つ', source: '待たんとする', rule: 'v5', reasons: ['-ntosuru']},
{term: '待つ', source: '待たざる', rule: 'v5', reasons: ['-zaru']},
{term: '待つ', source: '待たねば', rule: 'v5', reasons: ['-neba']},
{term: '待つ', source: '待たにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -499,6 +507,7 @@ const tests = [
{term: '死ぬ', source: '死なん', rule: 'v5', reasons: ['-n']},
{term: '死ぬ', source: '死なんかった', rule: 'v5', reasons: ['-n', '-ta']},
{term: '死ぬ', source: '死なんばかり', rule: 'v5', reasons: ['-nbakari']},
{term: '死ぬ', source: '死なんとする', rule: 'v5', reasons: ['-ntosuru']},
{term: '死ぬ', source: '死なざる', rule: 'v5', reasons: ['-zaru']},
{term: '死ぬ', source: '死なねば', rule: 'v5', reasons: ['-neba']},
{term: '死ぬ', source: '死なにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -566,6 +575,7 @@ const tests = [
{term: '遊ぶ', source: '遊ばん', rule: 'v5', reasons: ['-n']},
{term: '遊ぶ', source: '遊ばんかった', rule: 'v5', reasons: ['-n', '-ta']},
{term: '遊ぶ', source: '遊ばんばかり', rule: 'v5', reasons: ['-nbakari']},
{term: '遊ぶ', source: '遊ばんとする', rule: 'v5', reasons: ['-ntosuru']},
{term: '遊ぶ', source: '遊ばざる', rule: 'v5', reasons: ['-zaru']},
{term: '遊ぶ', source: '遊ばねば', rule: 'v5', reasons: ['-neba']},
{term: '遊ぶ', source: '遊ばにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -633,6 +643,7 @@ const tests = [
{term: '飲む', source: '飲まん', rule: 'v5', reasons: ['-n']},
{term: '飲む', source: '飲まんかった', rule: 'v5', reasons: ['-n', '-ta']},
{term: '飲む', source: '飲まんばかり', rule: 'v5', reasons: ['-nbakari']},
{term: '飲む', source: '飲まんとする', rule: 'v5', reasons: ['-ntosuru']},
{term: '飲む', source: '飲まざる', rule: 'v5', reasons: ['-zaru']},
{term: '飲む', source: '飲まねば', rule: 'v5', reasons: ['-neba']},
{term: '飲む', source: '飲まにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -771,6 +782,7 @@ const tests = [
{term: '為る', source: '為ん', rule: 'vs', reasons: ['-n']},
{term: '為る', source: '為んかった', rule: 'vs', reasons: ['-n', '-ta']},
{term: '為る', source: '為んばかり', rule: 'vs', reasons: ['-nbakari']},
{term: '為る', source: '為んとする', rule: 'vs', reasons: ['-ntosuru']},
{term: '為る', source: '為ざる', rule: 'vs', reasons: ['-zaru']},
{term: '為る', source: '為ねば', rule: 'vs', reasons: ['-neba']},
{term: '為る', source: '為にゃ', rule: 'vs', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -841,6 +853,7 @@ const tests = [
{term: 'する', source: 'せん', rule: 'vs', reasons: ['-n']},
{term: 'する', source: 'せんかった', rule: 'vs', reasons: ['-n', '-ta']},
{term: 'する', source: 'せんばかり', rule: 'vs', reasons: ['-nbakari']},
{term: 'する', source: 'せんとする', rule: 'vs', reasons: ['-ntosuru']},
{term: 'する', source: 'せざる', rule: 'vs', reasons: ['-zaru']},
{term: 'する', source: 'せねば', rule: 'vs', reasons: ['-neba']},
{term: 'する', source: 'せにゃ', rule: 'vs', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -906,6 +919,7 @@ const tests = [
{term: '来る', source: '来ん', rule: 'vk', reasons: ['-n']},
{term: '来る', source: '来んかった', rule: 'vk', reasons: ['-n', '-ta']},
{term: '来る', source: '来んばかり', rule: 'vk', reasons: ['-nbakari']},
{term: '来る', source: '来んとする', rule: 'vk', reasons: ['-ntosuru']},
{term: '来る', source: '来ざる', rule: 'vk', reasons: ['-zaru']},
{term: '来る', source: '来ねば', rule: 'vk', reasons: ['-neba']},
{term: '来る', source: '来にゃ', rule: 'vk', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -970,6 +984,7 @@ const tests = [
{term: '來る', source: '來ん', rule: 'vk', reasons: ['-n']},
{term: '來る', source: '來んかった', rule: 'vk', reasons: ['-n', '-ta']},
{term: '來る', source: '來んばかり', rule: 'vk', reasons: ['-nbakari']},
{term: '來る', source: '來んとする', rule: 'vk', reasons: ['-ntosuru']},
{term: '來る', source: '來ざる', rule: 'vk', reasons: ['-zaru']},
{term: '來る', source: '來ねば', rule: 'vk', reasons: ['-neba']},
{term: '來る', source: '來にゃ', rule: 'vk', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -1034,6 +1049,7 @@ const tests = [
{term: 'くる', source: 'こん', rule: 'vk', reasons: ['-n']},
{term: 'くる', source: 'こんかった', rule: 'vk', reasons: ['-n', '-ta']},
{term: 'くる', source: 'こんばかり', rule: 'vk', reasons: ['-nbakari']},
{term: 'くる', source: 'こんとする', rule: 'vk', reasons: ['-ntosuru']},
{term: 'くる', source: 'こざる', rule: 'vk', reasons: ['-zaru']},
{term: 'くる', source: 'こねば', rule: 'vk', reasons: ['-neba']},
{term: 'くる', source: 'こにゃ', rule: 'vk', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -1113,6 +1129,7 @@ const tests = [
{term: '論ずる', source: '論ぜん', rule: 'vz', reasons: ['-n']},
{term: '論ずる', source: '論ぜんかった', rule: 'vz', reasons: ['-n', '-ta']},
{term: '論ずる', source: '論ぜんばかり', rule: 'vz', reasons: ['-nbakari']},
{term: '論ずる', source: '論ぜんとする', rule: 'vz', reasons: ['-ntosuru']},
{term: '論ずる', source: '論ぜざる', rule: 'vz', reasons: ['-zaru']},
{term: '論ずる', source: '論ぜねば', rule: 'vz', reasons: ['-neba']},
{term: '論ずる', source: '論ぜにゃ', rule: 'vz', reasons: ['-neba', '-ya']},
Expand All @@ -1131,7 +1148,7 @@ const tests = [
],
},
{
category: '-e verbs',
category: '-e verbs and adjectives',
valid: true,
tests: [
{term: 'すごい', source: 'すげえ', rule: 'adj-i', reasons: ['-e']},
Expand Down Expand Up @@ -1309,6 +1326,7 @@ const tests = [
{term: '抱きかかえる', source: '抱きかかえていなければ', rule: 'v1', reasons: ['-te', '-teiru', 'negative', '-ba']},
{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']},
],
},
{
Expand Down

0 comments on commit aaa1617

Please sign in to comment.