Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ja] Add -nbakari form #1374

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions benches/japanese-language-transformer.bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ describe('japanese language transformer', () => {
'食べてる',
'食べとる',
'食べてしまう',
'食べん',
'食べんかった',
'食べんばかり',
];

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

const suruInflections = [
Expand Down Expand Up @@ -195,6 +201,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 @@ -697,9 +697,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 @@ -728,7 +728,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 @@ -756,6 +758,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 @@ -89,6 +89,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 @@ -149,6 +150,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 @@ -208,6 +210,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 @@ -267,6 +270,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 @@ -342,6 +346,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 @@ -387,6 +392,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 @@ -446,6 +452,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 @@ -504,6 +511,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 @@ -562,6 +570,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 @@ -683,6 +692,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 @@ -744,6 +754,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 @@ -800,6 +811,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 @@ -855,6 +867,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 @@ -910,6 +923,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 @@ -977,6 +991,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
Loading