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

Fix -ge and add -garu transforms #952

Merged
merged 12 commits into from
May 16, 2024
9 changes: 8 additions & 1 deletion ext/js/language/ja/japanese-transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,14 @@ export const japaneseTransforms = {
{
name: '-ge',
rules: [
suffixInflection('しげ', 'しい', [], ['adj-i'])
suffixInflection('げ', 'い', [], ['adj-i']),
suffixInflection('気', 'い', [], ['adj-i'])
]
},
{
name: '-garu',
rules: [
suffixInflection('がる', 'い', ['v5'], ['adj-i'])
]
},
{
Expand Down
27 changes: 23 additions & 4 deletions test/language/japanese-transforms.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ const tests = [
{term: '愛しい', source: '愛しくありません', rule: 'adj-i', reasons: ['polite', 'negative']},
{term: '愛しい', source: '愛しくありませんでした', rule: 'adj-i', reasons: ['polite', 'negative', 'past']},
{term: '愛しい', source: '愛しき', rule: 'adj-i', reasons: ['-ki']},
{term: '愛しい', source: '愛しげ', rule: 'adj-i', reasons: ['-ge']}
{term: '愛しい', source: '愛しげ', rule: 'adj-i', reasons: ['-ge']},
{term: '愛しい', source: '愛し気', rule: 'adj-i', reasons: ['-ge']},
{term: '愛しい', source: '愛しがる', rule: 'adj-i', reasons: ['-garu']}
]
},
{
Expand Down Expand Up @@ -77,6 +79,7 @@ const tests = [
{term: '食べる', source: '食べそう', rule: 'v1', reasons: ['-sou']},
{term: '食べる', source: '食べすぎる', rule: 'v1', reasons: ['-sugiru']},
{term: '食べる', source: '食べたい', rule: 'v1', reasons: ['-tai']},
{term: '食べる', source: '食べたがる', rule: 'v1', reasons: ['-tai', '-garu']},
{term: '食べる', source: '食べたら', rule: 'v1', reasons: ['-tara']},
{term: '食べる', source: '食べたり', rule: 'v1', reasons: ['-tari']},
{term: '食べる', source: '食べず', rule: 'v1', reasons: ['-zu']},
Expand Down Expand Up @@ -131,6 +134,7 @@ const tests = [
{term: '買う', source: '買いそう', rule: 'v5', reasons: ['-sou']},
{term: '買う', source: '買いすぎる', rule: 'v5', reasons: ['-sugiru']},
{term: '買う', source: '買いたい', rule: 'v5', reasons: ['-tai']},
{term: '買う', source: '買いたがる', rule: 'v5', reasons: ['-tai', '-garu']},
{term: '買う', source: '買ったら', rule: 'v5', reasons: ['-tara']},
{term: '買う', source: '買ったり', rule: 'v5', reasons: ['-tari']},
{term: '買う', source: '買わず', rule: 'v5', reasons: ['-zu']},
Expand Down Expand Up @@ -185,6 +189,7 @@ const tests = [
{term: '行く', source: '行きそう', rule: 'v5', reasons: ['-sou']},
{term: '行く', source: '行きすぎる', rule: 'v5', reasons: ['-sugiru']},
{term: '行く', source: '行きたい', rule: 'v5', reasons: ['-tai']},
{term: '行く', source: '行きたがる', rule: 'v5', reasons: ['-tai', '-garu']},
{term: '行く', source: '行いたら', rule: 'v5', reasons: ['-tara']},
{term: '行く', source: '行いたり', rule: 'v5', reasons: ['-tari']},
{term: '行く', source: '行かず', rule: 'v5', reasons: ['-zu']},
Expand Down Expand Up @@ -239,6 +244,7 @@ const tests = [
{term: '泳ぐ', source: '泳ぎそう', rule: 'v5', reasons: ['-sou']},
{term: '泳ぐ', source: '泳ぎすぎる', rule: 'v5', reasons: ['-sugiru']},
{term: '泳ぐ', source: '泳ぎたい', rule: 'v5', reasons: ['-tai']},
{term: '泳ぐ', source: '泳ぎたがる', rule: 'v5', reasons: ['-tai', '-garu']},
{term: '泳ぐ', source: '泳いだら', rule: 'v5', reasons: ['-tara']},
{term: '泳ぐ', source: '泳いだり', rule: 'v5', reasons: ['-tari']},
{term: '泳ぐ', source: '泳がず', rule: 'v5', reasons: ['-zu']},
Expand Down Expand Up @@ -292,6 +298,7 @@ const tests = [
{term: '話す', source: '話しそう', rule: 'v5', reasons: ['-sou']},
{term: '話す', source: '話しすぎる', rule: 'v5', reasons: ['-sugiru']},
{term: '話す', source: '話したい', rule: 'v5', reasons: ['-tai']},
{term: '話す', source: '話したがる', rule: 'v5', reasons: ['-tai', '-garu']},
{term: '話す', source: '話したら', rule: 'v5', reasons: ['-tara']},
{term: '話す', source: '話したり', rule: 'v5', reasons: ['-tari']},
{term: '話す', source: '話さず', rule: 'v5', reasons: ['-zu']},
Expand Down Expand Up @@ -346,6 +353,7 @@ const tests = [
{term: '待つ', source: '待ちそう', rule: 'v5', reasons: ['-sou']},
{term: '待つ', source: '待ちすぎる', rule: 'v5', reasons: ['-sugiru']},
{term: '待つ', source: '待ちたい', rule: 'v5', reasons: ['-tai']},
{term: '待つ', source: '待ちたがる', rule: 'v5', reasons: ['-tai', '-garu']},
{term: '待つ', source: '待ったら', rule: 'v5', reasons: ['-tara']},
{term: '待つ', source: '待ったり', rule: 'v5', reasons: ['-tari']},
{term: '待つ', source: '待たず', rule: 'v5', reasons: ['-zu']},
Expand Down Expand Up @@ -400,6 +408,7 @@ const tests = [
{term: '死ぬ', source: '死にそう', rule: 'v5', reasons: ['-sou']},
{term: '死ぬ', source: '死にすぎる', rule: 'v5', reasons: ['-sugiru']},
{term: '死ぬ', source: '死にたい', rule: 'v5', reasons: ['-tai']},
{term: '死ぬ', source: '死にたがる', rule: 'v5', reasons: ['-tai', '-garu']},
{term: '死ぬ', source: '死んだら', rule: 'v5', reasons: ['-tara']},
{term: '死ぬ', source: '死んだり', rule: 'v5', reasons: ['-tari']},
{term: '死ぬ', source: '死なず', rule: 'v5', reasons: ['-zu']},
Expand Down Expand Up @@ -453,6 +462,7 @@ const tests = [
{term: '遊ぶ', source: '遊びそう', rule: 'v5', reasons: ['-sou']},
{term: '遊ぶ', source: '遊びすぎる', rule: 'v5', reasons: ['-sugiru']},
{term: '遊ぶ', source: '遊びたい', rule: 'v5', reasons: ['-tai']},
{term: '遊ぶ', source: '遊びたがる', rule: 'v5', reasons: ['-tai', '-garu']},
{term: '遊ぶ', source: '遊んだら', rule: 'v5', reasons: ['-tara']},
{term: '遊ぶ', source: '遊んだり', rule: 'v5', reasons: ['-tari']},
{term: '遊ぶ', source: '遊ばず', rule: 'v5', reasons: ['-zu']},
Expand Down Expand Up @@ -506,6 +516,7 @@ const tests = [
{term: '飲む', source: '飲みそう', rule: 'v5', reasons: ['-sou']},
{term: '飲む', source: '飲みすぎる', rule: 'v5', reasons: ['-sugiru']},
{term: '飲む', source: '飲みたい', rule: 'v5', reasons: ['-tai']},
{term: '飲む', source: '飲みたがる', rule: 'v5', reasons: ['-tai', '-garu']},
{term: '飲む', source: '飲んだら', rule: 'v5', reasons: ['-tara']},
{term: '飲む', source: '飲んだり', rule: 'v5', reasons: ['-tari']},
{term: '飲む', source: '飲まず', rule: 'v5', reasons: ['-zu']},
Expand Down Expand Up @@ -559,6 +570,7 @@ const tests = [
{term: '作る', source: '作りそう', rule: 'v5', reasons: ['-sou']},
{term: '作る', source: '作りすぎる', rule: 'v5', reasons: ['-sugiru']},
{term: '作る', source: '作りたい', rule: 'v5', reasons: ['-tai']},
{term: '作る', source: '作りたがる', rule: 'v5', reasons: ['-tai', '-garu']},
{term: '作る', source: '作ったら', rule: 'v5', reasons: ['-tara']},
{term: '作る', source: '作ったり', rule: 'v5', reasons: ['-tari']},
{term: '作る', source: '作らず', rule: 'v5', reasons: ['-zu']},
Expand Down Expand Up @@ -617,6 +629,7 @@ const tests = [
{term: '為る', source: '為そう', rule: 'vs', reasons: ['-sou']},
{term: '為る', source: '為すぎる', rule: 'vs', reasons: ['-sugiru']},
{term: '為る', source: '為たい', rule: 'vs', reasons: ['-tai']},
{term: '為る', source: '為たがる', rule: 'vs', reasons: ['-tai', '-garu']},
{term: '為る', source: '為たら', rule: 'vs', reasons: ['-tara']},
{term: '為る', source: '為たり', rule: 'vs', reasons: ['-tari']},
{term: '為る', source: '為ず', rule: 'vs', reasons: ['-zu']},
Expand Down Expand Up @@ -672,6 +685,7 @@ const tests = [
{term: 'する', source: 'しそう', rule: 'vs', reasons: ['-sou']},
{term: 'する', source: 'しすぎる', rule: 'vs', reasons: ['-sugiru']},
{term: 'する', source: 'したい', rule: 'vs', reasons: ['-tai']},
{term: 'する', source: 'したがる', rule: 'vs', reasons: ['-tai', '-garu']},
{term: 'する', source: 'したら', rule: 'vs', reasons: ['-tara']},
{term: 'する', source: 'したり', rule: 'vs', reasons: ['-tari']},
{term: 'する', source: 'せず', rule: 'vs', reasons: ['-zu']},
Expand Down Expand Up @@ -722,6 +736,7 @@ const tests = [
{term: '来る', source: '来そう', rule: 'vk', reasons: ['-sou']},
{term: '来る', source: '来すぎる', rule: 'vk', reasons: ['-sugiru']},
{term: '来る', source: '来たい', rule: 'vk', reasons: ['-tai']},
{term: '来る', source: '来たがる', rule: 'vk', reasons: ['-tai', '-garu']},
{term: '来る', source: '来たら', rule: 'vk', reasons: ['-tara']},
{term: '来る', source: '来たり', rule: 'vk', reasons: ['-tari']},
{term: '来る', source: '来ず', rule: 'vk', reasons: ['-zu']},
Expand Down Expand Up @@ -771,6 +786,7 @@ const tests = [
{term: '來る', source: '來そう', rule: 'vk', reasons: ['-sou']},
{term: '來る', source: '來すぎる', rule: 'vk', reasons: ['-sugiru']},
{term: '來る', source: '來たい', rule: 'vk', reasons: ['-tai']},
{term: '來る', source: '來たがる', rule: 'vk', reasons: ['-tai', '-garu']},
{term: '來る', source: '來たら', rule: 'vk', reasons: ['-tara']},
{term: '來る', source: '來たり', rule: 'vk', reasons: ['-tari']},
{term: '來る', source: '來ず', rule: 'vk', reasons: ['-zu']},
Expand Down Expand Up @@ -820,6 +836,7 @@ const tests = [
{term: 'くる', source: 'きそう', rule: 'vk', reasons: ['-sou']},
{term: 'くる', source: 'きすぎる', rule: 'vk', reasons: ['-sugiru']},
{term: 'くる', source: 'きたい', rule: 'vk', reasons: ['-tai']},
{term: 'くる', source: 'きたがる', rule: 'vk', reasons: ['-tai', '-garu']},
{term: 'くる', source: 'きたら', rule: 'vk', reasons: ['-tara']},
{term: 'くる', source: 'きたり', rule: 'vk', reasons: ['-tari']},
{term: 'くる', source: 'こず', rule: 'vk', reasons: ['-zu']},
Expand Down Expand Up @@ -881,6 +898,7 @@ const tests = [
{term: '論ずる', source: '論じそう', rule: 'vz', reasons: ['-sou']},
{term: '論ずる', source: '論じすぎる', rule: 'vz', reasons: ['-sugiru']},
{term: '論ずる', source: '論じたい', rule: 'vz', reasons: ['-tai']},
{term: '論ずる', source: '論じたがる', rule: 'vz', reasons: ['-tai', '-garu']},
{term: '論ずる', source: '論じたら', rule: 'vz', reasons: ['-tara']},
{term: '論ずる', source: '論じたり', rule: 'vz', reasons: ['-tari']},
{term: '論ずる', source: '論ぜず', rule: 'vz', reasons: ['-zu']},
Expand Down Expand Up @@ -1070,11 +1088,12 @@ const tests = [
]
},
{
category: 'kawaii (this leads to infinite expansions)',
valid: false,
category: 'kawaii',
valid: true,
tests: [
{term: 'かわいい', source: 'かわいげ', rule: 'adj-i', reasons: ['-ge']},
{term: '可愛い', source: 'かわいげ', rule: 'adj-i', reasons: ['-ge']}
{term: '可愛い', source: '可愛げ', rule: 'adj-i', reasons: ['-ge']},
{term: '可愛い', source: '可愛気', rule: 'adj-i', reasons: ['-ge']}
]
},
{
Expand Down