Skip to content

Commit

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

* add all -n forms to bench
  • Loading branch information
khaitruong922 authored Aug 30, 2024
1 parent a995d52 commit f5157b5
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 4 deletions.
9 changes: 9 additions & 0 deletions benches/japanese-language-transformer.bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ describe('japanese language transformer', () => {
'食べてる',
'食べとる',
'食べてしまう',
'食べん',
'食べんかった',
'食べんばかり',
];

const inflectionCombinations = [
Expand Down Expand Up @@ -145,6 +148,9 @@ describe('japanese language transformer', () => {
'きてる',
'きとる',
'きてしまう',
'こん',
'こんかった',
'こんばかり',
];

const suruInflections = [
Expand Down Expand Up @@ -201,6 +207,9 @@ describe('japanese language transformer', () => {
'してる',
'しとる',
'してしまう',
'せん',
'せんかった',
'せんばかり',
];

const kansaibenInflections = [
Expand Down
41 changes: 37 additions & 4 deletions ext/js/language/ja/japanese-transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -701,9 +701,9 @@ export const japaneseTransforms = {
},
'-n': {
name: '-n',
description: '1. Negative form of verbs; a sound change of ぬ.\n' +
'2. (As …んばかり) Shows an action or condition is on the verge of occurring, or an excessive/extreme degree.\n' +
'Usage: Attach ん to the irrealis form (mizenkei) of verbs.',
description: 'Negative form of verbs; a sound change of ぬ.\n' +
'Usage: Attach ん to the irrealis form (mizenkei) of verbs.\n' +
'する becomes せん',
i18n: [
{
language: 'ja',
Expand Down Expand Up @@ -732,7 +732,9 @@ export const japaneseTransforms = {
},
'-n past': {
name: '-n',
description: 'Past negative form of verbs; a sound change of ぬ.\n',
description: 'Past negative form of verbs; a sound change of ぬ.\n' +
'Usage: Attach んかった to the irrealis form (mizenkei) of verbs.\n' +
'する becomes せんかった',
i18n: [
{
language: 'ja',
Expand Down Expand Up @@ -760,6 +762,37 @@ export const japaneseTransforms = {
suffixInflection('ませんかった', 'ません', [], ['v']),
],
},
'-nbakari': {
name: '-nbakari',
description: 'Shows an action or condition is on the verge of occurring, or an excessive/extreme degree.\n' +
'Usage: Attach んばかり to the irrealis form (mizenkei) of verbs.\n' +
'する becomes せんばかり',
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']),
],
},
'-mu': {
name: '-mu',
description: 'Archaic.\n' +
Expand Down
15 changes: 15 additions & 0 deletions test/language/japanese-transforms.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const tests = [
{term: '食べる', source: '食べぬ', rule: 'v1', reasons: ['-nu']},
{term: '食べる', source: '食べん', rule: 'v1', reasons: ['-n']},
{term: '食べる', source: '食べんかった', rule: 'v1', reasons: ['-n past']},
{term: '食べる', source: '食べんばかり', rule: 'v1', reasons: ['-nbakari']},
{term: '食べる', source: '食べざる', rule: 'v1', reasons: ['-zaru']},
{term: '食べる', source: '食べねば', rule: 'v1', reasons: ['-neba']},
{term: '食べる', source: '食べにゃ', rule: 'v1', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -155,6 +156,7 @@ const tests = [
{term: '買う', source: '買わぬ', rule: 'v5', reasons: ['-nu']},
{term: '買う', source: '買わん', rule: 'v5', reasons: ['-n']},
{term: '買う', source: '買わんかった', rule: 'v5', reasons: ['-n past']},
{term: '買う', source: '買わんばかり', rule: 'v5', reasons: ['-nbakari']},
{term: '買う', source: '買わざる', rule: 'v5', reasons: ['-zaru']},
{term: '買う', source: '買わねば', rule: 'v5', reasons: ['-neba']},
{term: '買う', source: '買わにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -217,6 +219,7 @@ const tests = [
{term: '行く', source: '行かぬ', rule: 'v5', reasons: ['-nu']},
{term: '行く', source: '行かん', rule: 'v5', reasons: ['-n']},
{term: '行く', source: '行かんかった', rule: 'v5', reasons: ['-n past']},
{term: '行く', source: '行かんばかり', rule: 'v5', reasons: ['-nbakari']},
{term: '行く', source: '行かざる', rule: 'v5', reasons: ['-zaru']},
{term: '行く', source: '行かねば', rule: 'v5', reasons: ['-neba']},
{term: '行く', source: '行かにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -279,6 +282,7 @@ const tests = [
{term: '泳ぐ', source: '泳がぬ', rule: 'v5', reasons: ['-nu']},
{term: '泳ぐ', source: '泳がん', rule: 'v5', reasons: ['-n']},
{term: '泳ぐ', source: '泳がんかった', rule: 'v5', reasons: ['-n past']},
{term: '泳ぐ', source: '泳がんばかり', rule: 'v5', reasons: ['-nbakari']},
{term: '泳ぐ', source: '泳がざる', rule: 'v5', reasons: ['-zaru']},
{term: '泳ぐ', source: '泳がねば', rule: 'v5', reasons: ['-neba']},
{term: '泳ぐ', source: '泳がにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -357,6 +361,7 @@ const tests = [

{term: '増す', source: '増せん', rule: 'v5', reasons: ['potential', '-n']},
{term: '増す', source: '増せんかった', rule: 'v5', reasons: ['potential', '-n past']},
{term: '増す', source: '増せんばかり', rule: 'v5', reasons: ['potential', '-nbakari']},
],
},
{
Expand Down Expand Up @@ -405,6 +410,7 @@ const tests = [
{term: '待つ', source: '待たぬ', rule: 'v5', reasons: ['-nu']},
{term: '待つ', source: '待たん', rule: 'v5', reasons: ['-n']},
{term: '待つ', source: '待たんかった', rule: 'v5', reasons: ['-n past']},
{term: '待つ', source: '待たんばかり', rule: 'v5', reasons: ['-nbakari']},
{term: '待つ', source: '待たざる', rule: 'v5', reasons: ['-zaru']},
{term: '待つ', source: '待たねば', rule: 'v5', reasons: ['-neba']},
{term: '待つ', source: '待たにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -467,6 +473,7 @@ const tests = [
{term: '死ぬ', source: '死なぬ', rule: 'v5', reasons: ['-nu']},
{term: '死ぬ', source: '死なん', rule: 'v5', reasons: ['-n']},
{term: '死ぬ', source: '死なんかった', rule: 'v5', reasons: ['-n past']},
{term: '死ぬ', source: '死なんばかり', rule: 'v5', reasons: ['-nbakari']},
{term: '死ぬ', source: '死なざる', rule: 'v5', reasons: ['-zaru']},
{term: '死ぬ', source: '死なねば', rule: 'v5', reasons: ['-neba']},
{term: '死ぬ', source: '死なにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -528,6 +535,7 @@ const tests = [
{term: '遊ぶ', source: '遊ばぬ', rule: 'v5', reasons: ['-nu']},
{term: '遊ぶ', source: '遊ばん', rule: 'v5', reasons: ['-n']},
{term: '遊ぶ', source: '遊ばんかった', rule: 'v5', reasons: ['-n past']},
{term: '遊ぶ', source: '遊ばんばかり', rule: 'v5', reasons: ['-nbakari']},
{term: '遊ぶ', source: '遊ばざる', rule: 'v5', reasons: ['-zaru']},
{term: '遊ぶ', source: '遊ばねば', rule: 'v5', reasons: ['-neba']},
{term: '遊ぶ', source: '遊ばにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -589,6 +597,7 @@ const tests = [
{term: '飲む', source: '飲まぬ', rule: 'v5', reasons: ['-nu']},
{term: '飲む', source: '飲まん', rule: 'v5', reasons: ['-n']},
{term: '飲む', source: '飲まんかった', rule: 'v5', reasons: ['-n past']},
{term: '飲む', source: '飲まんばかり', rule: 'v5', reasons: ['-nbakari']},
{term: '飲む', source: '飲まざる', rule: 'v5', reasons: ['-zaru']},
{term: '飲む', source: '飲まねば', rule: 'v5', reasons: ['-neba']},
{term: '飲む', source: '飲まにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -716,6 +725,7 @@ const tests = [
{term: '為る', source: '為ぬ', rule: 'vs', reasons: ['-nu']},
{term: '為る', source: '為ん', rule: 'vs', reasons: ['-n']},
{term: '為る', source: '為んかった', rule: 'vs', reasons: ['-n past']},
{term: '為る', source: '為んばかり', rule: 'vs', reasons: ['-nbakari']},
{term: '為る', source: '為ざる', rule: 'vs', reasons: ['-zaru']},
{term: '為る', source: '為ねば', rule: 'vs', reasons: ['-neba']},
{term: '為る', source: '為にゃ', rule: 'vs', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -780,6 +790,7 @@ const tests = [
{term: 'する', source: 'せぬ', rule: 'vs', reasons: ['-nu']},
{term: 'する', source: 'せん', rule: 'vs', reasons: ['-n']},
{term: 'する', source: 'せんかった', rule: 'vs', reasons: ['-n past']},
{term: 'する', source: 'せんばかり', rule: 'vs', reasons: ['-nbakari']},
{term: 'する', source: 'せざる', rule: 'vs', reasons: ['-zaru']},
{term: 'する', source: 'せねば', rule: 'vs', reasons: ['-neba']},
{term: 'する', source: 'せにゃ', rule: 'vs', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -839,6 +850,7 @@ const tests = [
{term: '来る', source: '来ぬ', rule: 'vk', reasons: ['-nu']},
{term: '来る', source: '来ん', rule: 'vk', reasons: ['-n']},
{term: '来る', source: '来んかった', rule: 'vk', reasons: ['-n past']},
{term: '来る', source: '来んばかり', rule: 'vk', reasons: ['-nbakari']},
{term: '来る', source: '来ざる', rule: 'vk', reasons: ['-zaru']},
{term: '来る', source: '来ねば', rule: 'vk', reasons: ['-neba']},
{term: '来る', source: '来にゃ', rule: 'vk', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -897,6 +909,7 @@ const tests = [
{term: '來る', source: '來ぬ', rule: 'vk', reasons: ['-nu']},
{term: '來る', source: '來ん', rule: 'vk', reasons: ['-n']},
{term: '來る', source: '來んかった', rule: 'vk', reasons: ['-n past']},
{term: '來る', source: '來んばかり', rule: 'vk', reasons: ['-nbakari']},
{term: '來る', source: '來ざる', rule: 'vk', reasons: ['-zaru']},
{term: '來る', source: '來ねば', rule: 'vk', reasons: ['-neba']},
{term: '來る', source: '來にゃ', rule: 'vk', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -955,6 +968,7 @@ const tests = [
{term: 'くる', source: 'こぬ', rule: 'vk', reasons: ['-nu']},
{term: 'くる', source: 'こん', rule: 'vk', reasons: ['-n']},
{term: 'くる', source: 'こんかった', rule: 'vk', reasons: ['-n past']},
{term: 'くる', source: 'こんばかり', rule: 'vk', reasons: ['-nbakari']},
{term: 'くる', source: 'こざる', rule: 'vk', reasons: ['-zaru']},
{term: 'くる', source: 'こねば', rule: 'vk', reasons: ['-neba']},
{term: 'くる', source: 'こにゃ', rule: 'vk', reasons: ['-neba', '-ya']},
Expand Down Expand Up @@ -1028,6 +1042,7 @@ const tests = [
{term: '論ずる', source: '論ぜぬ', rule: 'vz', reasons: ['-nu']},
{term: '論ずる', source: '論ぜん', rule: 'vz', reasons: ['-n']},
{term: '論ずる', source: '論ぜんかった', rule: 'vz', reasons: ['-n past']},
{term: '論ずる', source: '論ぜんばかり', rule: 'vz', reasons: ['-nbakari']},
{term: '論ずる', source: '論ぜざる', rule: 'vz', reasons: ['-zaru']},
{term: '論ずる', source: '論ぜねば', rule: 'vz', reasons: ['-neba']},
{term: '論ずる', source: '論ぜにゃ', rule: 'vz', reasons: ['-neba', '-ya']},
Expand Down

0 comments on commit f5157b5

Please sign in to comment.