aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorStefanVukovic99 <stefanvukovic44@gmail.com>2024-01-27 09:59:39 +0100
committerGitHub <noreply@github.com>2024-01-27 08:59:39 +0000
commita3224f688f44c9c913f32add1223e922ce88e65a (patch)
treeb23432bdfb87418766b6872662749cb85418ffdf /ext
parent6ba1ffe74558dd174e3308d48885fb068fa37d55 (diff)
fix deinflection bug (#547)
* fix deinflection bug * add test
Diffstat (limited to 'ext')
-rw-r--r--ext/data/deinflect.json48
-rw-r--r--ext/js/language/deinflector.js16
2 files changed, 33 insertions, 31 deletions
diff --git a/ext/data/deinflect.json b/ext/data/deinflect.json
index 49ad4b72..884dbcc1 100644
--- a/ext/data/deinflect.json
+++ b/ext/data/deinflect.json
@@ -324,28 +324,28 @@
{"kanaIn": "な", "kanaOut": "", "rulesIn": [], "rulesOut": ["v1", "v5", "vk", "vs", "vz"]}
],
"masu stem": [
- {"kanaIn": "い", "kanaOut": "いる", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "え", "kanaOut": "える", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "き", "kanaOut": "きる", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "ぎ", "kanaOut": "ぎる", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "け", "kanaOut": "ける", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "げ", "kanaOut": "げる", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "じ", "kanaOut": "じる", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "せ", "kanaOut": "せる", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "ぜ", "kanaOut": "ぜる", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "ち", "kanaOut": "ちる", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "て", "kanaOut": "てる", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "で", "kanaOut": "でる", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "に", "kanaOut": "にる", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "ね", "kanaOut": "ねる", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "ひ", "kanaOut": "ひる", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "び", "kanaOut": "びる", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "へ", "kanaOut": "へる", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "べ", "kanaOut": "べる", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "み", "kanaOut": "みる", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "め", "kanaOut": "める", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "り", "kanaOut": "りる", "rulesIn": [], "rulesOut": ["v1"]},
- {"kanaIn": "れ", "kanaOut": "れる", "rulesIn": [], "rulesOut": ["v1"]},
+ {"kanaIn": "い", "kanaOut": "いる", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "え", "kanaOut": "える", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "き", "kanaOut": "きる", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "ぎ", "kanaOut": "ぎる", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "け", "kanaOut": "ける", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "げ", "kanaOut": "げる", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "じ", "kanaOut": "じる", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "せ", "kanaOut": "せる", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "ぜ", "kanaOut": "ぜる", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "ち", "kanaOut": "ちる", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "て", "kanaOut": "てる", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "で", "kanaOut": "でる", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "に", "kanaOut": "にる", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "ね", "kanaOut": "ねる", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "ひ", "kanaOut": "ひる", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "び", "kanaOut": "びる", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "へ", "kanaOut": "へる", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "べ", "kanaOut": "べる", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "み", "kanaOut": "みる", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "め", "kanaOut": "める", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "り", "kanaOut": "りる", "rulesIn": [], "rulesOut": ["v1d"]},
+ {"kanaIn": "れ", "kanaOut": "れる", "rulesIn": [], "rulesOut": ["v1d"]},
{"kanaIn": "い", "kanaOut": "う", "rulesIn": [], "rulesOut": ["v5"]},
{"kanaIn": "き", "kanaOut": "く", "rulesIn": [], "rulesOut": ["v5"]},
{"kanaIn": "ぎ", "kanaOut": "ぐ", "rulesIn": [], "rulesOut": ["v5"]},
@@ -603,10 +603,10 @@
"progressive or perfect": [
{"kanaIn": "ている", "kanaOut": "て", "rulesIn": ["v1"], "rulesOut": ["iru"]},
{"kanaIn": "ておる", "kanaOut": "て", "rulesIn": ["v5"], "rulesOut": ["iru"]},
- {"kanaIn": "てる", "kanaOut": "て", "rulesIn": ["v1"], "rulesOut": ["iru"]},
+ {"kanaIn": "てる", "kanaOut": "て", "rulesIn": ["v1p"], "rulesOut": ["iru"]},
{"kanaIn": "でいる", "kanaOut": "で", "rulesIn": ["v1"], "rulesOut": ["iru"]},
{"kanaIn": "でおる", "kanaOut": "で", "rulesIn": ["v5"], "rulesOut": ["iru"]},
- {"kanaIn": "でる", "kanaOut": "で", "rulesIn": ["v1"], "rulesOut": ["iru"]},
+ {"kanaIn": "でる", "kanaOut": "で", "rulesIn": ["v1p"], "rulesOut": ["iru"]},
{"kanaIn": "とる", "kanaOut": "て", "rulesIn": ["v5"], "rulesOut": ["iru"]},
{"kanaIn": "ないでいる", "kanaOut": "ない", "rulesIn": ["v1"], "rulesOut": ["adj-i"]}
],
diff --git a/ext/js/language/deinflector.js b/ext/js/language/deinflector.js
index 7d75576d..b52b7f5b 100644
--- a/ext/js/language/deinflector.js
+++ b/ext/js/language/deinflector.js
@@ -20,13 +20,15 @@ export class Deinflector {
/* eslint-disable no-multi-spaces */
/** @type {Map<string, import('translation-internal').DeinflectionRuleFlags>} @readonly */
static _ruleTypes = new Map([
- ['v1', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b00000001)], // Verb ichidan
- ['v5', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b00000010)], // Verb godan
- ['vs', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b00000100)], // Verb suru
- ['vk', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b00001000)], // Verb kuru
- ['vz', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b00010000)], // Verb zuru
- ['adj-i', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b00100000)], // Adjective i
- ['iru', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b01000000)] // Intermediate -iru endings for progressive or perfect tense
+ ['v1', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b000000011)], // Verb ichidan
+ ['v1d', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b000000010)], // Verb ichidan dictionary form
+ ['v1p', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b000000001)], // Verb ichidan progressive or perfect
+ ['v5', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b000000100)], // Verb godan
+ ['vs', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b000001000)], // Verb suru
+ ['vk', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b000010000)], // Verb kuru
+ ['vz', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b000100000)], // Verb zuru
+ ['adj-i', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b001000000)], // Adjective i
+ ['iru', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b010000000)] // Intermediate -iru endings for progressive or perfect tense
]);
/* eslint-enable no-multi-spaces */