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 volitional slang #1397

Merged
merged 7 commits into from
Sep 9, 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
6 changes: 6 additions & 0 deletions benches/japanese-language-transformer.bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ describe('japanese language transformer', () => {
'食べぬ',
'食べ',
'食べましょう',
'食べましょっか',
'食べよう',
'食べよっか',
'食べるまい',
'食べまい',
'食べとく',
Expand Down Expand Up @@ -145,7 +147,9 @@ describe('japanese language transformer', () => {
'こねば',
'き',
'きましょう',
'きましょっか',
'こよう',
'こよっか',
'くるまい',
'こまい',
'きとく',
Expand Down Expand Up @@ -209,7 +213,9 @@ describe('japanese language transformer', () => {
'せざる',
'せねば',
'しましょう',
'しましょっか',
'しよう',
'しよっか',
'するまい',
'しまい',
'しとく',
Expand Down
29 changes: 28 additions & 1 deletion ext/js/language/ja/japanese-transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ export const japaneseTransforms = {
},
'volitional': {
name: 'volitional',
description: '1. Expresses speaker\'s will or intention; volitional form.\n' +
description: '1. Expresses speaker\'s will or intention.\n' +
'2. Expresses an invitation to the other party.\n' +
'3. (Used in …ようとする) Indicates being on the verge of initiating an action or transforming a state.\n' +
'4. Indicates an inference of a matter.\n' +
Expand Down Expand Up @@ -1322,6 +1322,33 @@ export const japaneseTransforms = {
suffixInflection('かろう', 'い', [], ['adj-i']),
],
},
'volitional slang': {
name: 'volitional slang',
description: 'Contraction of volitional form + か\n' +
'1. Expresses speaker\'s will or intention.\n' +
'2. Expresses an invitation to the other party.\n' +
'Usage: Replace final う with っ of volitional form then add か.\n' +
'For example: 行こうか -> 行こっか.',
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('ましょっか', 'ます', [], ['-masu']),
],
},
'-mai': {
name: '-mai',
description: 'Negative volitional form of verbs.\n' +
Expand Down
30 changes: 30 additions & 0 deletions test/language/japanese-transforms.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ const tests = [
{term: '食べる', source: '食べにゃ', rule: 'v1', reasons: ['-neba', '-ya']},
{term: '食べる', source: '食べ', rule: 'v1d', reasons: ['continuative']},
{term: '食べる', source: '食べましょう', rule: 'v1', reasons: ['-masu', 'volitional']},
{term: '食べる', source: '食べましょっか', rule: 'v1', reasons: ['-masu', 'volitional slang']},
{term: '食べる', source: '食べよう', rule: 'v1', reasons: ['volitional']},
{term: '食べる', source: '食べよっか', rule: 'v1', reasons: ['volitional slang']},
{term: '食べる', source: '食べるまい', rule: 'v1', reasons: ['-mai']},
{term: '食べる', source: '食べまい', rule: 'v1', reasons: ['-mai']},
// ['causative-passive']
Expand Down Expand Up @@ -164,7 +166,9 @@ const tests = [
{term: '買う', source: '買わにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
{term: '買う', source: '買い', rule: 'v5', reasons: ['continuative']},
{term: '買う', source: '買いましょう', rule: 'v5', reasons: ['-masu', 'volitional']},
{term: '買う', source: '買いましょっか', rule: 'v5', reasons: ['-masu', 'volitional slang']},
{term: '買う', source: '買おう', rule: 'v5', reasons: ['volitional']},
{term: '買う', source: '買おっか', rule: 'v5', reasons: ['volitional slang']},
{term: '買う', source: '買うまい', rule: 'v5', reasons: ['-mai']},
{term: '買う', source: '買わされる', rule: 'v5', reasons: ['causative-passive']},
{term: '買う', source: '買っとく', rule: 'v5', reasons: ['-toku']},
Expand Down Expand Up @@ -233,7 +237,9 @@ const tests = [
{term: '行く', source: '行かにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
{term: '行く', source: '行き', rule: 'v5', reasons: ['continuative']},
{term: '行く', source: '行きましょう', rule: 'v5', reasons: ['-masu', 'volitional']},
{term: '行く', source: '行きましょっか', rule: 'v5', reasons: ['-masu', 'volitional slang']},
{term: '行く', source: '行こう', rule: 'v5', reasons: ['volitional']},
{term: '行く', source: '行こっか', rule: 'v5', reasons: ['volitional slang']},
{term: '行く', source: '行くまい', rule: 'v5', reasons: ['-mai']},
{term: '行く', source: '行かされる', rule: 'v5', reasons: ['causative-passive']},
{term: '行く', source: '行いとく', rule: 'v5', reasons: ['-toku']},
Expand Down Expand Up @@ -302,7 +308,9 @@ const tests = [
{term: '泳ぐ', source: '泳がにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
{term: '泳ぐ', source: '泳ぎ', rule: 'v5', reasons: ['continuative']},
{term: '泳ぐ', source: '泳ぎましょう', rule: 'v5', reasons: ['-masu', 'volitional']},
{term: '泳ぐ', source: '泳ぎましょっか', rule: 'v5', reasons: ['-masu', 'volitional slang']},
{term: '泳ぐ', source: '泳ごう', rule: 'v5', reasons: ['volitional']},
{term: '泳ぐ', source: '泳ごっか', rule: 'v5', reasons: ['volitional slang']},
{term: '泳ぐ', source: '泳ぐまい', rule: 'v5', reasons: ['-mai']},
{term: '泳ぐ', source: '泳がされる', rule: 'v5', reasons: ['causative-passive']},
{term: '泳ぐ', source: '泳いどく', rule: 'v5', reasons: ['-toku']},
Expand Down Expand Up @@ -370,7 +378,9 @@ const tests = [
{term: '話す', source: '話さにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
{term: '話す', source: '話し', rule: 'v5', reasons: ['continuative']},
{term: '話す', source: '話しましょう', rule: 'v5', reasons: ['-masu', 'volitional']},
{term: '話す', source: '話しましょっか', rule: 'v5', reasons: ['-masu', 'volitional slang']},
{term: '話す', source: '話そう', rule: 'v5', reasons: ['volitional']},
{term: '話す', source: '話そっか', rule: 'v5', reasons: ['volitional slang']},
{term: '話す', source: '話すまい', rule: 'v5', reasons: ['-mai']},
// ['causative-passive']
{term: '話す', source: '話しとく', rule: 'v5', reasons: ['-toku']},
Expand Down Expand Up @@ -444,7 +454,9 @@ const tests = [
{term: '待つ', source: '待たにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
{term: '待つ', source: '待ち', rule: 'v5', reasons: ['continuative']},
{term: '待つ', source: '待ちましょう', rule: 'v5', reasons: ['-masu', 'volitional']},
{term: '待つ', source: '待ちましょっか', rule: 'v5', reasons: ['-masu', 'volitional slang']},
{term: '待つ', source: '待とう', rule: 'v5', reasons: ['volitional']},
{term: '待つ', source: '待とっか', rule: 'v5', reasons: ['volitional slang']},
{term: '待つ', source: '待つまい', rule: 'v5', reasons: ['-mai']},
{term: '待つ', source: '待たされる', rule: 'v5', reasons: ['causative-passive']},
{term: '待つ', source: '待っとく', rule: 'v5', reasons: ['-toku']},
Expand Down Expand Up @@ -513,7 +525,9 @@ const tests = [
{term: '死ぬ', source: '死なにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
{term: '死ぬ', source: '死に', rule: 'v5', reasons: ['continuative']},
{term: '死ぬ', source: '死にましょう', rule: 'v5', reasons: ['-masu', 'volitional']},
{term: '死ぬ', source: '死にましょっか', rule: 'v5', reasons: ['-masu', 'volitional slang']},
{term: '死ぬ', source: '死のう', rule: 'v5', reasons: ['volitional']},
{term: '死ぬ', source: '死のっか', rule: 'v5', reasons: ['volitional slang']},
{term: '死ぬ', source: '死ぬまい', rule: 'v5', reasons: ['-mai']},
{term: '死ぬ', source: '死なされる', rule: 'v5', reasons: ['causative-passive']},
{term: '死ぬ', source: '死んどく', rule: 'v5', reasons: ['-toku']},
Expand Down Expand Up @@ -581,7 +595,9 @@ const tests = [
{term: '遊ぶ', source: '遊ばにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
{term: '遊ぶ', source: '遊び', rule: 'v5', reasons: ['continuative']},
{term: '遊ぶ', source: '遊びましょう', rule: 'v5', reasons: ['-masu', 'volitional']},
{term: '遊ぶ', source: '遊びましょっか', rule: 'v5', reasons: ['-masu', 'volitional slang']},
{term: '遊ぶ', source: '遊ぼう', rule: 'v5', reasons: ['volitional']},
{term: '遊ぶ', source: '遊ぼっか', rule: 'v5', reasons: ['volitional slang']},
{term: '遊ぶ', source: '遊ぶまい', rule: 'v5', reasons: ['-mai']},
{term: '遊ぶ', source: '遊ばされる', rule: 'v5', reasons: ['causative-passive']},
{term: '遊ぶ', source: '遊んどく', rule: 'v5', reasons: ['-toku']},
Expand Down Expand Up @@ -649,7 +665,9 @@ const tests = [
{term: '飲む', source: '飲まにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
{term: '飲む', source: '飲み', rule: 'v5', reasons: ['continuative']},
{term: '飲む', source: '飲みましょう', rule: 'v5', reasons: ['-masu', 'volitional']},
{term: '飲む', source: '飲みましょっか', rule: 'v5', reasons: ['-masu', 'volitional slang']},
{term: '飲む', source: '飲もう', rule: 'v5', reasons: ['volitional']},
{term: '飲む', source: '飲もっか', rule: 'v5', reasons: ['volitional slang']},
{term: '飲む', source: '飲むまい', rule: 'v5', reasons: ['-mai']},
{term: '飲む', source: '飲まされる', rule: 'v5', reasons: ['causative-passive']},
{term: '飲む', source: '飲んどく', rule: 'v5', reasons: ['-toku']},
Expand Down Expand Up @@ -715,7 +733,9 @@ const tests = [
{term: '作る', source: '作らにゃ', rule: 'v5', reasons: ['-neba', '-ya']},
{term: '作る', source: '作り', rule: 'v5', reasons: ['continuative']},
{term: '作る', source: '作りましょう', rule: 'v5', reasons: ['-masu', 'volitional']},
{term: '作る', source: '作りましょっか', rule: 'v5', reasons: ['-masu', 'volitional slang']},
{term: '作る', source: '作ろう', rule: 'v5', reasons: ['volitional']},
{term: '作る', source: '作ろっか', rule: 'v5', reasons: ['volitional slang']},
{term: '作る', source: '作るまい', rule: 'v5', reasons: ['-mai']},
{term: '作る', source: '作らされる', rule: 'v5', reasons: ['causative-passive']},
{term: '作る', source: '作っとく', rule: 'v5', reasons: ['-toku']},
Expand Down Expand Up @@ -788,7 +808,9 @@ const tests = [
{term: '為る', source: '為にゃ', rule: 'vs', reasons: ['-neba', '-ya']},
// ['continuative']
{term: '為る', source: '為ましょう', rule: 'vs', reasons: ['-masu', 'volitional']},
{term: '為る', source: '為ましょっか', rule: 'vs', reasons: ['-masu', 'volitional slang']},
{term: '為る', source: '為よう', rule: 'vs', reasons: ['volitional']},
{term: '為る', source: '為よっか', rule: 'vs', reasons: ['volitional slang']},
{term: '為る', source: '為るまい', rule: 'vs', reasons: ['-mai']},
{term: '為る', source: '為まい', rule: 'vs', reasons: ['-mai']},
// ['causative-passive']
Expand Down Expand Up @@ -859,7 +881,9 @@ const tests = [
{term: 'する', source: 'せにゃ', rule: 'vs', reasons: ['-neba', '-ya']},
{term: 'する', source: 'し', rule: 'vs', reasons: ['continuative']},
{term: 'する', source: 'しましょう', rule: 'vs', reasons: ['-masu', 'volitional']},
{term: 'する', source: 'しましょっか', rule: 'vs', reasons: ['-masu', 'volitional slang']},
{term: 'する', source: 'しよう', rule: 'vs', reasons: ['volitional']},
{term: 'する', source: 'しよっか', rule: 'vs', reasons: ['volitional slang']},
{term: 'する', source: 'するまい', rule: 'vs', reasons: ['-mai']},
{term: 'する', source: 'しまい', rule: 'vs', reasons: ['-mai']},
{term: 'する', source: 'しなきゃ', rule: 'vs', reasons: ['negative', '-ba', '-ya']},
Expand Down Expand Up @@ -925,7 +949,9 @@ const tests = [
{term: '来る', source: '来にゃ', rule: 'vk', reasons: ['-neba', '-ya']},
{term: '来る', source: '来', rule: 'vk', reasons: ['continuative']},
{term: '来る', source: '来ましょう', rule: 'vk', reasons: ['-masu', 'volitional']},
{term: '来る', source: '来ましょっか', rule: 'vk', reasons: ['-masu', 'volitional slang']},
{term: '来る', source: '来よう', rule: 'vk', reasons: ['volitional']},
{term: '来る', source: '来よっか', rule: 'vk', reasons: ['volitional slang']},
{term: '来る', source: '来るまい', rule: 'vk', reasons: ['-mai']},
{term: '来る', source: '来まい', rule: 'vk', reasons: ['-mai']},
// ['causative-passive']
Expand Down Expand Up @@ -990,7 +1016,9 @@ const tests = [
{term: '來る', source: '來にゃ', rule: 'vk', reasons: ['-neba', '-ya']},
{term: '來る', source: '來', rule: 'vk', reasons: ['continuative']},
{term: '來る', source: '來ましょう', rule: 'vk', reasons: ['-masu', 'volitional']},
{term: '來る', source: '來ましょっか', rule: 'vk', reasons: ['-masu', 'volitional slang']},
{term: '來る', source: '來よう', rule: 'vk', reasons: ['volitional']},
{term: '來る', source: '來よっか', rule: 'vk', reasons: ['volitional slang']},
{term: '來る', source: '來るまい', rule: 'vk', reasons: ['-mai']},
{term: '來る', source: '來まい', rule: 'vk', reasons: ['-mai']},
// ['causative-passive']
Expand Down Expand Up @@ -1055,7 +1083,9 @@ const tests = [
{term: 'くる', source: 'こにゃ', rule: 'vk', reasons: ['-neba', '-ya']},
{term: 'くる', source: 'き', rule: 'vk', reasons: ['continuative']},
{term: 'くる', source: 'きましょう', rule: 'vk', reasons: ['-masu', 'volitional']},
{term: 'くる', source: 'きましょっか', rule: 'vk', reasons: ['-masu', 'volitional slang']},
{term: 'くる', source: 'こよう', rule: 'vk', reasons: ['volitional']},
{term: 'くる', source: 'こよっか', rule: 'vk', reasons: ['volitional slang']},
{term: 'くる', source: 'くるまい', rule: 'vk', reasons: ['-mai']},
{term: 'くる', source: 'こまい', rule: 'vk', reasons: ['-mai']},
// ['causative-passive']
Expand Down
Loading