diff options
author | StefanVukovic99 <stefanvukovic44@gmail.com> | 2024-03-22 15:27:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-22 14:27:35 +0000 |
commit | d2e9841f96ebff61d4a5c26a322484f6268115f1 (patch) | |
tree | 3c1351fa3b25994eab8456ea8457ee153bb98aa9 | |
parent | 7681131782d958997663b1fb443a3e32e8eef550 (diff) |
expand deinflection format (#745)
* abstract deinflections
* undo redundant changes
* remove cast
* switch to js
* MultiLanguageTransformer
* comments
* comments
* fix test
* suffixInflection
* fix bench
* substring instead of replace
* without heuristic
* suffixMap
* add other language deinflections
* wip
* catch cycles
* fix tests
* uninflect to deinflect
* use less regex
* add suru masu stem deinflection
26 files changed, 1945 insertions, 1176 deletions
diff --git a/.eslintrc.json b/.eslintrc.json index b9b3fa4a..faac16a8 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -642,15 +642,19 @@ "ext/js/general/text-source-map.js", "ext/js/language/ar/arabic-text-preprocessors.js", "ext/js/language/de/german-text-preprocessors.js", + "ext/js/language/en/english-transforms.js", "ext/js/language/ja/japanese-text-preprocessors.js", + "ext/js/language/ja/japanese-transforms.js", "ext/js/language/ja/japanese-wanakana.js", "ext/js/language/ja/japanese.js", "ext/js/language/la/latin-text-preprocessors.js", "ext/js/language/language-descriptors.js", "ext/js/language/language-transformer.js", + "ext/js/language/language-transforms.js", "ext/js/language/languages.js", "ext/js/language/multi-language-transformer.js", "ext/js/language/ru/russian-text-preprocessors.js", + "ext/js/language/sq/albanian-transforms.js", "ext/js/language/text-preprocessors.js", "ext/js/language/translator.js", "ext/js/media/audio-downloader.js", diff --git a/benches/language-transformer.bench.js b/benches/language-transformer.bench.js index 071d5627..6e8cbc97 100644 --- a/benches/language-transformer.bench.js +++ b/benches/language-transformer.bench.js @@ -15,19 +15,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import fs from 'fs'; -import {fileURLToPath} from 'node:url'; -import path from 'path'; import {bench, describe} from 'vitest'; -import {parseJson} from '../dev/json.js'; +import {japaneseTransforms} from '../ext/js/language/ja/japanese-transforms.js'; import {LanguageTransformer} from '../ext/js/language/language-transformer.js'; -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** @type {import('language-transformer').LanguageTransformDescriptor} */ -const descriptor = parseJson(fs.readFileSync(path.join(dirname, '..', 'ext', 'js/language/ja/japanese-transforms.json'), {encoding: 'utf8'})); const languageTransformer = new LanguageTransformer(); -languageTransformer.addDescriptor(descriptor); +languageTransformer.addDescriptor(japaneseTransforms); describe('language transformer', () => { describe('basic tests', () => { diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js index cd44a07f..6cae9cea 100644 --- a/ext/js/background/backend.js +++ b/ext/js/background/backend.js @@ -23,7 +23,7 @@ import {ClipboardReader} from '../comm/clipboard-reader.js'; import {Mecab} from '../comm/mecab.js'; import {createApiMap, invokeApiMapHandler} from '../core/api-map.js'; import {ExtensionError} from '../core/extension-error.js'; -import {fetchJson, fetchText} from '../core/fetch-utilities.js'; +import {fetchText} from '../core/fetch-utilities.js'; import {logErrorLevelToNumber} from '../core/log-utilities.js'; import {log} from '../core/log.js'; import {isObjectNotArray} from '../core/object-utilities.js'; @@ -275,16 +275,7 @@ export class Backend { log.error(e); } - /** @type {import('language-transformer').LanguageTransformDescriptor[]} */ - const descriptors = []; - const languageSummaries = getLanguageSummaries(); - for (const {languageTransformsFile} of languageSummaries) { - if (!languageTransformsFile) { continue; } - /** @type {import('language-transformer').LanguageTransformDescriptor} */ - const descriptor = await fetchJson(languageTransformsFile); - descriptors.push(descriptor); - } - void this._translator.prepare(descriptors); + void this._translator.prepare(); await this._optionsUtil.prepare(); this._defaultAnkiFieldTemplates = (await fetchText('/data/templates/default-anki-field-templates.handlebars')).trim(); diff --git a/ext/js/background/offscreen-proxy.js b/ext/js/background/offscreen-proxy.js index 30c6862a..e65ec65e 100644 --- a/ext/js/background/offscreen-proxy.js +++ b/ext/js/background/offscreen-proxy.js @@ -183,11 +183,9 @@ export class TranslatorProxy { this._offscreen = offscreen; } - /** - * @param {import('language-transformer').LanguageTransformDescriptor[]} descriptors - */ - async prepare(descriptors) { - await this._offscreen.sendMessagePromise({action: 'translatorPrepareOffscreen', params: {descriptors}}); + /** */ + async prepare() { + await this._offscreen.sendMessagePromise({action: 'translatorPrepareOffscreen'}); } /** diff --git a/ext/js/background/offscreen.js b/ext/js/background/offscreen.js index b0b11c93..bab4d0c9 100644 --- a/ext/js/background/offscreen.js +++ b/ext/js/background/offscreen.js @@ -111,8 +111,8 @@ export class Offscreen { } /** @type {import('offscreen').ApiHandler<'translatorPrepareOffscreen'>} */ - _prepareTranslatorHandler({descriptors}) { - this._translator.prepare(descriptors); + _prepareTranslatorHandler() { + this._translator.prepare(); } /** @type {import('offscreen').ApiHandler<'findKanjiOffscreen'>} */ diff --git a/ext/js/language/de/german-transforms.js b/ext/js/language/de/german-transforms.js new file mode 100644 index 00000000..d05ca874 --- /dev/null +++ b/ext/js/language/de/german-transforms.js @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2024 Yomitan Authors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +import {prefixInflection, suffixInflection} from '../language-transforms.js'; + +// https://www.dartmouth.edu/~deutsch/Grammatik/Wortbildung/Separables.html +const separablePrefixes = ['ab', 'an', 'auf', 'aus', 'auseinander', 'bei', 'da', 'dabei', 'dar', 'daran', 'dazwischen', 'durch', 'ein', 'empor', 'entgegen', 'entlang', 'entzwei', 'fehl', 'fern', 'fest', 'fort', 'frei', 'gegenüber', 'gleich', 'heim', 'her', 'herab', 'heran', 'herauf', 'heraus', 'herbei', 'herein', 'herüber', 'herum', 'herunter', 'hervor', 'hin', 'hinab', 'hinauf', 'hinaus', 'hinein', 'hinterher', 'hinunter', 'hinweg', 'hinzu', 'hoch', 'los', 'mit', 'nach', 'nebenher', 'nieder', 'statt', 'um', 'vor', 'voran', 'voraus', 'vorbei', 'vorüber', 'vorweg', 'weg', 'weiter', 'wieder', 'zu', 'zurecht', 'zurück', 'zusammen']; + +/** + * @param {string} prefix + * @param {string[]} conditionsIn + * @param {string[]} conditionsOut + * @returns {import('language-transformer').Rule} + */ +function separatedPrefix(prefix, conditionsIn, conditionsOut) { + const germanLetters = 'a-zA-ZäöüßÄÖÜẞ'; + const regex = new RegExp(`^([${germanLetters}]+) .+ ${prefix}$`); + return { + type: 'other', + isInflected: regex, + deinflect: (term) => { + return term.replace(regex, '$1 ' + prefix); + }, + conditionsIn, + conditionsOut + }; +} + +const separatedPrefixInflections = separablePrefixes.map((prefix) => { + return separatedPrefix(prefix, [], []); +}); + +const zuInfinitiveInflections = separablePrefixes.map((prefix) => { + return prefixInflection(prefix + 'zu', prefix, [], ['v']); +}); + +export const germanTransforms = { + language: 'de', + conditions: { + v: { + name: 'Verb', + isDictionaryForm: true + }, + n: { + name: 'Noun', + isDictionaryForm: true + }, + adj: { + name: 'Adjective', + isDictionaryForm: true + } + }, + transforms: [ + { + name: 'nominalization', + description: 'Noun formed from a verb', + rules: [ + suffixInflection('ung', 'en', [], []), + suffixInflection('lung', 'eln', [], []) + ] + }, + { + name: '-bar', + description: '-able adjective from a verb', + rules: [ + suffixInflection('bar', 'en', [], ['v']), + suffixInflection('bar', 'n', [], ['v']) // Lieferbar + ] + }, + { + name: 'negative', + description: 'Negation', + rules: [ + prefixInflection('un', '', [], ['adj']) + ] + }, + { + name: 'separated prefix', + description: 'Separable prefix', + rules: [ + ...separatedPrefixInflections + ] + }, + { + name: 'zu-infinitive', + description: 'zu-infinitive', + rules: [ + ...zuInfinitiveInflections + ] + } + ] +}; diff --git a/ext/js/language/en/english-transforms.js b/ext/js/language/en/english-transforms.js new file mode 100644 index 00000000..eab8b328 --- /dev/null +++ b/ext/js/language/en/english-transforms.js @@ -0,0 +1,282 @@ +/* + * Copyright (C) 2024 Yomitan Authors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +import {prefixInflection, suffixInflection} from '../language-transforms.js'; + +/** + * @param {string} consonants + * @param {string} suffix + * @param {string[]} conditionsIn + * @param {string[]} conditionsOut + * @returns {import('language-transformer').SuffixRule[]} + */ +function doubledConsonantInflection(consonants, suffix, conditionsIn, conditionsOut) { + const inflections = []; + for (const consonant of consonants) { + inflections.push(suffixInflection(`${consonant}${consonant}${suffix}`, consonant, conditionsIn, conditionsOut)); + } + return inflections; +} + +const pastSuffixInflections = [ + suffixInflection('ed', '', ['v'], ['v']), // 'walked' + suffixInflection('ed', 'e', ['v'], ['v']), // 'hoped' + suffixInflection('ied', 'y', ['v'], ['v']), // 'tried' + suffixInflection('cked', 'c', ['v'], ['v']), // 'frolicked' + ...doubledConsonantInflection('bdgklmnprstz', 'ed', ['v'], ['v']), + + suffixInflection('laid', 'lay', ['v'], ['v']), + suffixInflection('paid', 'pay', ['v'], ['v']), + suffixInflection('said', 'say', ['v'], ['v']) +]; + +const ingSuffixInflections = [ + suffixInflection('ing', '', ['v'], ['v']), // 'walking' + suffixInflection('ing', 'e', ['v'], ['v']), // 'driving' + suffixInflection('ying', 'ie', ['v'], ['v']), // 'lying' + suffixInflection('cking', 'c', ['v'], ['v']), // 'panicking' + ...doubledConsonantInflection('bdgklmnprstz', 'ing', ['v'], ['v']) +]; + +const thirdPersonSgPresentSuffixInflections = [ + suffixInflection('s', '', ['v'], ['v']), // 'walks' + suffixInflection('es', '', ['v'], ['v']), // 'teaches' + suffixInflection('ies', 'y', ['v'], ['v']) // 'tries' +]; + +const phrasalVerbParticles = ['aboard', 'about', 'above', 'across', 'ahead', 'alongside', 'apart', 'around', 'aside', 'astray', 'away', 'back', 'before', 'behind', 'below', 'beneath', 'besides', 'between', 'beyond', 'by', 'close', 'down', 'east', 'west', 'north', 'south', 'eastward', 'westward', 'northward', 'southward', 'forward', 'backward', 'backwards', 'forwards', 'home', 'in', 'inside', 'instead', 'near', 'off', 'on', 'opposite', 'out', 'outside', 'over', 'overhead', 'past', 'round', 'since', 'through', 'throughout', 'together', 'under', 'underneath', 'up', 'within', 'without']; +const phrasalVerbPrepositions = ['aback', 'about', 'above', 'across', 'after', 'against', 'ahead', 'along', 'among', 'apart', 'around', 'as', 'aside', 'at', 'away', 'back', 'before', 'behind', 'below', 'between', 'beyond', 'by', 'down', 'even', 'for', 'forth', 'forward', 'from', 'in', 'into', 'it', 'of', 'off', 'on', 'one', 'onto', 'open', 'out', 'over', 'past', 'round', 'through', 'to', 'together', 'toward', 'towards', 'under', 'up', 'upon', 'way', 'with', 'without']; + +const particlesDisjunction = phrasalVerbParticles.join('|'); +const phrasalVerbWordSet = new Set([...phrasalVerbParticles, ...phrasalVerbPrepositions]); +const phrasalVerbWordDisjunction = [...phrasalVerbWordSet].join('|'); +/** @type {import('language-transformer').Rule} */ +const phrasalVerbInterposedObjectRule = { + type: 'other', + isInflected: new RegExp(`^\\w* (?:(?!\\b(${phrasalVerbWordDisjunction})\\b).)+ (?:${particlesDisjunction})`), + deinflect: (term) => { + return term.replace(new RegExp(`(?<=\\w) (?:(?!\\b(${phrasalVerbWordDisjunction})\\b).)+ (?=(?:${particlesDisjunction}))`), ' '); + }, + conditionsIn: [], + conditionsOut: ['v'] +}; + +/** + * @param {string} inflected + * @param {string} deinflected + * @returns {import('language-transformer').Rule} + */ +function createPhrasalVerbInflection(inflected, deinflected) { + return { + type: 'other', + isInflected: new RegExp(`^\\w*${inflected} (?:${phrasalVerbWordDisjunction})`), + deinflect: (term) => { + return term.replace(new RegExp(`(?<=)${inflected}(?= (?:${phrasalVerbWordDisjunction}))`), deinflected); + }, + conditionsIn: [], + conditionsOut: ['v_phr'] + }; +} + +/** + * @param {import('language-transformer').SuffixRule[]} sourceRules + * @returns {import('language-transformer').Rule[]} + */ +function createPhrasalVerbInflectionsFromSuffixInflections(sourceRules) { + return sourceRules.flatMap(({isInflected, deinflected}) => { + if (typeof deinflected === 'undefined') { return []; } + const inflectedSuffix = isInflected.source.replace('$', ''); + const deinflectedSuffix = deinflected; + return [createPhrasalVerbInflection(inflectedSuffix, deinflectedSuffix)]; + }); +} + +/** @type {import('language-transformer').LanguageTransformDescriptor} */ +export const englishTransforms = { + language: 'en', + conditions: { + v_any: { + name: 'Verb', + isDictionaryForm: false, + subConditions: ['v', 'v_irr', 'v_phr'] + }, + v: { + name: 'Regular verb', + isDictionaryForm: true + }, + v_irr: { + name: 'Irregular verb', + isDictionaryForm: true + }, + v_phr: { + name: 'Phrasal verb', + isDictionaryForm: true + }, + n: { + name: 'Noun', + isDictionaryForm: true, + subConditions: ['np', 'ns'] + }, + np: { + name: 'Noun plural', + isDictionaryForm: true + }, + ns: { + name: 'Noun singular', + isDictionaryForm: true + }, + adj: { + name: 'Adjective', + isDictionaryForm: true + }, + adv: { + name: 'Adverb', + isDictionaryForm: true + } + }, + transforms: [ + { + name: 'plural', + description: 'Plural form of a noun', + rules: [ + suffixInflection('s', '', ['np'], ['ns']), + suffixInflection('es', '', ['np'], ['ns']), + suffixInflection('ies', 'y', ['np'], ['ns']), + suffixInflection('ves', 'fe', ['np'], ['ns']), + suffixInflection('ves', 'f', ['np'], ['ns']) + ] + }, + { + name: 'possessive', + description: 'Possessive form of a noun', + rules: [ + suffixInflection('\'s', '', ['n'], ['n']), + suffixInflection('s\'', 's', ['n'], ['n']) + ] + }, + { + name: 'past', + description: 'Simple past tense of a verb', + rules: [ + ...pastSuffixInflections, + ...createPhrasalVerbInflectionsFromSuffixInflections(pastSuffixInflections) + ] + }, + { + name: 'ing', + description: 'Present participle of a verb', + rules: [ + ...ingSuffixInflections, + ...createPhrasalVerbInflectionsFromSuffixInflections(ingSuffixInflections) + ] + }, + { + name: '3rd pers. sing. pres', + description: 'Third person singular present tense of a verb', + rules: [ + ...thirdPersonSgPresentSuffixInflections, + ...createPhrasalVerbInflectionsFromSuffixInflections(thirdPersonSgPresentSuffixInflections) + ] + }, + { + name: 'interposed object', + description: 'Phrasal verb with interposed object', + rules: [ + phrasalVerbInterposedObjectRule + ] + }, + { + name: 'archaic', + description: 'Archaic form of a word', + rules: [ + suffixInflection('\'d', 'ed', ['v'], ['v']) + ] + }, + { + name: 'adverb', + description: 'Adverb form of an adjective', + rules: [ + suffixInflection('ly', '', ['adv'], ['adj']) + ] + }, + { + name: 'comparative', + description: 'Comparative form of an adjective', + rules: [ + suffixInflection('er', '', ['adj'], ['adj']), // 'faster' + suffixInflection('er', 'e', ['adj'], ['adj']), // 'nicer' + suffixInflection('ier', 'y', ['adj'], ['adj']), // 'happier' + ...doubledConsonantInflection('bdgmnt', 'er', ['adj'], ['adj']) + ] + }, + { + name: 'superlative', + description: 'Superlative form of an adjective', + rules: [ + suffixInflection('est', '', ['adj'], ['adj']), // 'fastest' + suffixInflection('est', 'e', ['adj'], ['adj']), // 'nicest' + suffixInflection('iest', 'y', ['adj'], ['adj']), // 'happiest' + ...doubledConsonantInflection('bdgmnt', 'est', ['adj'], ['adj']) + ] + }, + { + name: 'dropped g', + description: 'Dropped g in -ing form of a verb', + rules: [ + suffixInflection('in\'', 'ing', ['v'], ['v']) + ] + }, + { + name: '-y', + description: 'Adjective formed from a verb or noun', + rules: [ + suffixInflection('y', '', ['adj'], ['n', 'v']), // 'dirty', 'pushy' + suffixInflection('y', 'e', ['adj'], ['n', 'v']), // 'hazy' + ...doubledConsonantInflection('glmnprst', 'y', [], ['n', 'v']) // 'baggy', 'saggy' + ] + }, + { + name: 'un-', + description: 'Negative form of an adjective, adverb, or verb', + rules: [ + suffixInflection('un', '', ['adj', 'adv', 'v'], ['adj', 'adv', 'v']) + ] + }, + { + name: 'going-to future', + description: 'Going-to future tense of a verb', + rules: [ + prefixInflection('going to ', '', ['v'], ['v']) + ] + }, + { + name: 'will future', + description: 'Will-future tense of a verb', + rules: [ + prefixInflection('will ', '', ['v'], ['v']) + ] + }, + { + name: 'imperative negative', + description: 'Negative imperative form of a verb', + rules: [ + prefixInflection('don\'t ', '', ['v'], ['v']), + prefixInflection('do not ', '', ['v'], ['v']) + ] + } + ] +}; diff --git a/ext/js/language/en/english-transforms.json b/ext/js/language/en/english-transforms.json deleted file mode 100644 index 623a4ddf..00000000 --- a/ext/js/language/en/english-transforms.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "language": "en", - "conditions": { - "v": { - "name": "Verb", - "isDictionaryForm": true - }, - "n": { - "name": "Noun", - "isDictionaryForm": true, - "subConditions": ["np", "ns"] - }, - "np": { - "name": "Noun plural", - "isDictionaryForm": true - }, - "ns": { - "name": "Noun singular", - "isDictionaryForm": true - }, - "adj": { - "name": "Adjective", - "isDictionaryForm": true - } - }, - "transforms": [ - { - "name": "plural", - "description": "Plural form of a noun", - "rules": [ - {"suffixIn": "s", "suffixOut": "", "conditionsIn": ["np"], "conditionsOut": ["ns"]}, - {"suffixIn": "es", "suffixOut": "", "conditionsIn": ["np"], "conditionsOut": ["ns"]}, - {"suffixIn": "ies", "suffixOut": "y", "conditionsIn": ["np"], "conditionsOut": ["ns"]}, - {"suffixIn": "ves", "suffixOut": "fe", "conditionsIn": ["np"], "conditionsOut": ["ns"]}, - {"suffixIn": "ves", "suffixOut": "f", "conditionsIn": ["np"], "conditionsOut": ["ns"]} - ] - } - ] -} diff --git a/ext/js/language/ja/japanese-transforms.js b/ext/js/language/ja/japanese-transforms.js new file mode 100644 index 00000000..f789d007 --- /dev/null +++ b/ext/js/language/ja/japanese-transforms.js @@ -0,0 +1,1033 @@ +/* + * Copyright (C) 2024 Yomitan Authors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +import {suffixInflection} from '../language-transforms.js'; + +/** @type {import('language-transformer').LanguageTransformDescriptor} */ +export const japaneseTransforms = { + language: 'ja', + conditions: { + 'v': { + name: 'Verb', + i18n: [ + { + language: 'ja', + name: '動詞' + } + ], + isDictionaryForm: false, + subConditions: ['v1', 'v5', 'vk', 'vs', 'vz'] + }, + 'v1': { + name: 'Ichidan verb', + i18n: [ + { + language: 'ja', + name: '一段動詞' + } + ], + isDictionaryForm: true, + subConditions: ['v1d', 'v1p'] + }, + 'v1d': { + name: 'Ichidan verb, dictionary form', + i18n: [ + { + language: 'ja', + name: '一段動詞、辞書形' + } + ], + isDictionaryForm: false + }, + 'v1p': { + name: 'Ichidan verb, progressive or perfect form', + i18n: [ + { + language: 'ja', + name: '一段動詞、進行形または完了形' + } + ], + isDictionaryForm: false + }, + 'v5': { + name: 'Godan verb', + i18n: [ + { + language: 'ja', + name: '五段動詞' + } + ], + isDictionaryForm: true + }, + 'vk': { + name: 'Kuru verb', + i18n: [ + { + language: 'ja', + name: '来る動詞' + } + ], + isDictionaryForm: true + }, + 'vs': { + name: 'Suru verb', + i18n: [ + { + language: 'ja', + name: 'する動詞' + } + ], + isDictionaryForm: true + }, + 'vz': { + name: 'Zuru verb', + i18n: [ + { + language: 'ja', + name: 'ずる動詞' + } + ], + isDictionaryForm: true + }, + 'adj-i': { + name: 'Adjective with i ending', + i18n: [ + { + language: 'ja', + name: '形容詞' + } + ], + isDictionaryForm: true + }, + '-te': { + name: 'Intermediate -te endings for progressive or perfect tense', + isDictionaryForm: false + }, + 'adv': { + name: 'Intermediate -ku endings for adverbs', + isDictionaryForm: false + }, + 'past': { + name: '-ta past form ending', + isDictionaryForm: false + } + }, + transforms: [ + { + name: '-ba', + description: 'Conditional', + i18n: [ + { + language: 'ja', + name: 'ば', + description: '仮定形' + } + ], + rules: [ + suffixInflection('ければ', 'い', [], ['adj-i']), + suffixInflection('えば', 'う', [], ['v5']), + suffixInflection('けば', 'く', [], ['v5']), + suffixInflection('げば', 'ぐ', [], ['v5']), + suffixInflection('せば', 'す', [], ['v5']), + suffixInflection('てば', 'つ', [], ['v5']), + suffixInflection('ねば', 'ぬ', [], ['v5']), + suffixInflection('べば', 'ぶ', [], ['v5']), + suffixInflection('めば', 'む', [], ['v5']), + suffixInflection('れば', 'る', [], ['v1', 'v5', 'vk', 'vs', 'vz']) + ] + }, + { + name: '-chau', + rules: [ + suffixInflection('ちゃう', 'る', ['v5'], ['v1']), + suffixInflection('いじゃう', 'ぐ', ['v5'], ['v5']), + suffixInflection('いちゃう', 'く', ['v5'], ['v5']), + suffixInflection('しちゃう', 'す', ['v5'], ['v5']), + suffixInflection('っちゃう', 'う', ['v5'], ['v5']), + suffixInflection('っちゃう', 'く', ['v5'], ['v5']), + suffixInflection('っちゃう', 'つ', ['v5'], ['v5']), + suffixInflection('っちゃう', 'る', ['v5'], ['v5']), + suffixInflection('んじゃう', 'ぬ', ['v5'], ['v5']), + suffixInflection('んじゃう', 'ぶ', ['v5'], ['v5']), + suffixInflection('んじゃう', 'む', ['v5'], ['v5']), + suffixInflection('じちゃう', 'ずる', ['v5'], ['vz']), + suffixInflection('しちゃう', 'する', ['v5'], ['vs']), + suffixInflection('為ちゃう', '為る', ['v5'], ['vs']), + suffixInflection('きちゃう', 'くる', ['v5'], ['vk']), + suffixInflection('来ちゃう', '来る', ['v5'], ['vk']), + suffixInflection('來ちゃう', '來る', ['v5'], ['vk']) + ] + }, + { + name: '-chimau', + rules: [ + suffixInflection('ちまう', 'る', ['v5'], ['v1']), + suffixInflection('いじまう', 'ぐ', ['v5'], ['v5']), + suffixInflection('いちまう', 'く', ['v5'], ['v5']), + suffixInflection('しちまう', 'す', ['v5'], ['v5']), + suffixInflection('っちまう', 'う', ['v5'], ['v5']), + suffixInflection('っちまう', 'く', ['v5'], ['v5']), + suffixInflection('っちまう', 'つ', ['v5'], ['v5']), + suffixInflection('っちまう', 'る', ['v5'], ['v5']), + suffixInflection('んじまう', 'ぬ', ['v5'], ['v5']), + suffixInflection('んじまう', 'ぶ', ['v5'], ['v5']), + suffixInflection('んじまう', 'む', ['v5'], ['v5']), + suffixInflection('じちまう', 'ずる', ['v5'], ['vz']), + suffixInflection('しちまう', 'する', ['v5'], ['vs']), + suffixInflection('為ちまう', '為る', ['v5'], ['vs']), + suffixInflection('きちまう', 'くる', ['v5'], ['vk']), + suffixInflection('来ちまう', '来る', ['v5'], ['vk']), + suffixInflection('來ちまう', '來る', ['v5'], ['vk']) + ] + }, + { + name: '-shimau', + rules: [ + suffixInflection('てしまう', 'て', ['v5'], ['-te']), + suffixInflection('でしまう', 'で', ['v5'], ['-te']) + ] + }, + { + name: '-nasai', + 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']) + ] + }, + { + name: '-sou', + rules: [ + suffixInflection('そう', 'い', [], ['adj-i']), + 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']) + ] + }, + { + name: '-sugiru', + rules: [ + suffixInflection('すぎる', 'い', ['v1'], ['adj-i']), + suffixInflection('すぎる', 'る', ['v1'], ['v1']), + suffixInflection('いすぎる', 'う', ['v1'], ['v5']), + suffixInflection('きすぎる', 'く', ['v1'], ['v5']), + suffixInflection('ぎすぎる', 'ぐ', ['v1'], ['v5']), + suffixInflection('しすぎる', 'す', ['v1'], ['v5']), + suffixInflection('ちすぎる', 'つ', ['v1'], ['v5']), + suffixInflection('にすぎる', 'ぬ', ['v1'], ['v5']), + suffixInflection('びすぎる', 'ぶ', ['v1'], ['v5']), + suffixInflection('みすぎる', 'む', ['v1'], ['v5']), + suffixInflection('りすぎる', 'る', ['v1'], ['v5']), + suffixInflection('じすぎる', 'ずる', ['v1'], ['vz']), + suffixInflection('しすぎる', 'する', ['v1'], ['vs']), + suffixInflection('為すぎる', '為る', ['v1'], ['vs']), + suffixInflection('きすぎる', 'くる', ['v1'], ['vk']), + suffixInflection('来すぎる', '来る', ['v1'], ['vk']), + suffixInflection('來すぎる', '來る', ['v1'], ['vk']) + ] + }, + { + name: '-tai', + rules: [ + suffixInflection('たい', 'る', ['adj-i'], ['v1']), + suffixInflection('いたい', 'う', ['adj-i'], ['v5']), + suffixInflection('きたい', 'く', ['adj-i'], ['v5']), + suffixInflection('ぎたい', 'ぐ', ['adj-i'], ['v5']), + suffixInflection('したい', 'す', ['adj-i'], ['v5']), + suffixInflection('ちたい', 'つ', ['adj-i'], ['v5']), + suffixInflection('にたい', 'ぬ', ['adj-i'], ['v5']), + suffixInflection('びたい', 'ぶ', ['adj-i'], ['v5']), + suffixInflection('みたい', 'む', ['adj-i'], ['v5']), + suffixInflection('りたい', 'る', ['adj-i'], ['v5']), + suffixInflection('じたい', 'ずる', ['adj-i'], ['vz']), + suffixInflection('したい', 'する', ['adj-i'], ['vs']), + suffixInflection('為たい', '為る', ['adj-i'], ['vs']), + suffixInflection('きたい', 'くる', ['adj-i'], ['vk']), + suffixInflection('来たい', '来る', ['adj-i'], ['vk']), + suffixInflection('來たい', '來る', ['adj-i'], ['vk']) + ] + }, + { + name: '-tara', + rules: [ + suffixInflection('かったら', 'い', [], ['adj-i']), + 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('いったら', 'いく', [], ['v5']), + suffixInflection('おうたら', 'おう', [], ['v5']), + suffixInflection('こうたら', 'こう', [], ['v5']), + suffixInflection('そうたら', 'そう', [], ['v5']), + suffixInflection('とうたら', 'とう', [], ['v5']), + suffixInflection('行ったら', '行く', [], ['v5']), + suffixInflection('逝ったら', '逝く', [], ['v5']), + suffixInflection('往ったら', '往く', [], ['v5']), + suffixInflection('請うたら', '請う', [], ['v5']), + suffixInflection('乞うたら', '乞う', [], ['v5']), + suffixInflection('恋うたら', '恋う', [], ['v5']), + suffixInflection('問うたら', '問う', [], ['v5']), + suffixInflection('負うたら', '負う', [], ['v5']), + suffixInflection('沿うたら', '沿う', [], ['v5']), + suffixInflection('添うたら', '添う', [], ['v5']), + suffixInflection('副うたら', '副う', [], ['v5']), + suffixInflection('厭うたら', '厭う', [], ['v5']), + suffixInflection('のたもうたら', 'のたまう', [], ['v5']) + ] + }, + { + name: '-tari', + rules: [ + suffixInflection('かったり', 'い', [], ['adj-i']), + 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('いったり', 'いく', [], ['v5']), + suffixInflection('おうたり', 'おう', [], ['v5']), + suffixInflection('こうたり', 'こう', [], ['v5']), + suffixInflection('そうたり', 'そう', [], ['v5']), + suffixInflection('とうたり', 'とう', [], ['v5']), + suffixInflection('行ったり', '行く', [], ['v5']), + suffixInflection('逝ったり', '逝く', [], ['v5']), + suffixInflection('往ったり', '往く', [], ['v5']), + suffixInflection('請うたり', '請う', [], ['v5']), + suffixInflection('乞うたり', '乞う', [], ['v5']), + suffixInflection('恋うたり', '恋う', [], ['v5']), + suffixInflection('問うたり', '問う', [], ['v5']), + suffixInflection('負うたり', '負う', [], ['v5']), + suffixInflection('沿うたり', '沿う', [], ['v5']), + suffixInflection('添うたり', '添う', [], ['v5']), + suffixInflection('副うたり', '副う', [], ['v5']), + suffixInflection('厭うたり', '厭う', [], ['v5']), + suffixInflection('のたもうたり', 'のたまう', [], ['v5']) + ] + }, + { + name: '-te', + rules: [ + suffixInflection('くて', 'い', ['-te'], ['adj-i']), + suffixInflection('て', 'る', ['-te'], ['v1']), + suffixInflection('いて', 'く', ['-te'], ['v5']), + suffixInflection('いで', 'ぐ', ['-te'], ['v5']), + suffixInflection('して', 'す', ['-te'], ['v5']), + suffixInflection('って', 'う', ['-te'], ['v5']), + suffixInflection('って', 'つ', ['-te'], ['v5']), + suffixInflection('って', 'る', ['-te'], ['v5']), + suffixInflection('んで', 'ぬ', ['-te'], ['v5']), + suffixInflection('んで', 'ぶ', ['-te'], ['v5']), + suffixInflection('んで', 'む', ['-te'], ['v5']), + suffixInflection('じて', 'ずる', ['-te'], ['vz']), + suffixInflection('して', 'する', ['-te'], ['vs']), + suffixInflection('為て', '為る', ['-te'], ['vs']), + suffixInflection('きて', 'くる', ['-te'], ['vk']), + suffixInflection('来て', '来る', ['-te'], ['vk']), + suffixInflection('來て', '來る', ['-te'], ['vk']), + suffixInflection('いって', 'いく', ['-te'], ['v5']), + suffixInflection('おうて', 'おう', ['-te'], ['v5']), + suffixInflection('こうて', 'こう', ['-te'], ['v5']), + suffixInflection('そうて', 'そう', ['-te'], ['v5']), + suffixInflection('とうて', 'とう', ['-te'], ['v5']), + suffixInflection('行って', '行く', ['-te'], ['v5']), + suffixInflection('逝って', '逝く', ['-te'], ['v5']), + suffixInflection('往って', '往く', ['-te'], ['v5']), + suffixInflection('請うて', '請う', ['-te'], ['v5']), + suffixInflection('乞うて', '乞う', ['-te'], ['v5']), + suffixInflection('恋うて', '恋う', ['-te'], ['v5']), + suffixInflection('問うて', '問う', ['-te'], ['v5']), + suffixInflection('負うて', '負う', ['-te'], ['v5']), + suffixInflection('沿うて', '沿う', ['-te'], ['v5']), + suffixInflection('添うて', '添う', ['-te'], ['v5']), + suffixInflection('副うて', '副う', ['-te'], ['v5']), + suffixInflection('厭うて', '厭う', ['-te'], ['v5']), + suffixInflection('のたもうて', 'のたまう', ['-te'], ['v5']), + suffixInflection('まして', 'ます', [], ['v']) + ] + }, + { + name: '-zu', + 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']) + ] + }, + { + name: '-nu', + 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']) + ] + }, + { + name: '-mu', + 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']) + ] + }, + { + name: '-zaru', + 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']) + ] + }, + { + name: '-neba', + 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']) + ] + }, + { + name: 'adv', + rules: [ + suffixInflection('く', 'い', ['adv'], ['adj-i']) + ] + }, + { + name: 'causative', + rules: [ + suffixInflection('させる', 'る', ['v1'], ['v1']), + suffixInflection('かせる', 'く', ['v1'], ['v5']), + suffixInflection('がせる', 'ぐ', ['v1'], ['v5']), + suffixInflection('させる', 'す', ['v1'], ['v5']), + suffixInflection('たせる', 'つ', ['v1'], ['v5']), + suffixInflection('なせる', 'ぬ', ['v1'], ['v5']), + suffixInflection('ばせる', 'ぶ', ['v1'], ['v5']), + suffixInflection('ませる', 'む', ['v1'], ['v5']), + suffixInflection('らせる', 'る', ['v1'], ['v5']), + suffixInflection('わせる', 'う', ['v1'], ['v5']), + suffixInflection('じさせる', 'ずる', ['v1'], ['vz']), + suffixInflection('ぜさせる', 'ずる', ['v1'], ['vz']), + suffixInflection('させる', 'する', ['v1'], ['vs']), + suffixInflection('為せる', '為る', ['v1'], ['vs']), + suffixInflection('せさせる', 'する', ['v1'], ['vs']), + suffixInflection('為させる', '為る', ['v1'], ['vs']), + suffixInflection('こさせる', 'くる', ['v1'], ['vk']), + suffixInflection('来させる', '来る', ['v1'], ['vk']), + suffixInflection('來させる', '來る', ['v1'], ['vk']) + ] + }, + { + name: 'imperative', + rules: [ + suffixInflection('ろ', 'る', [], ['v1']), + suffixInflection('よ', 'る', [], ['v1']), + suffixInflection('え', 'う', [], ['v5']), + suffixInflection('け', 'く', [], ['v5']), + suffixInflection('げ', 'ぐ', [], ['v5']), + suffixInflection('せ', 'す', [], ['v5']), + suffixInflection('て', 'つ', [], ['v5']), + suffixInflection('ね', 'ぬ', [], ['v5']), + suffixInflection('べ', 'ぶ', [], ['v5']), + suffixInflection('め', 'む', [], ['v5']), + suffixInflection('れ', 'る', [], ['v5']), + suffixInflection('じろ', 'ずる', [], ['vz']), + suffixInflection('ぜよ', 'ずる', [], ['vz']), + suffixInflection('しろ', 'する', [], ['vs']), + suffixInflection('せよ', 'する', [], ['vs']), + suffixInflection('為ろ', '為る', [], ['vs']), + suffixInflection('為よ', '為る', [], ['vs']), + suffixInflection('こい', 'くる', [], ['vk']), + suffixInflection('来い', '来る', [], ['vk']), + suffixInflection('來い', '來る', [], ['vk']) + ] + }, + { + name: 'imperative negative', + rules: [ + suffixInflection('な', '', [], ['v']) + ] + }, + { + name: 'masu stem', + rules: [ + suffixInflection('い', 'いる', [], ['v1d']), + suffixInflection('え', 'える', [], ['v1d']), + suffixInflection('き', 'きる', [], ['v1d']), + suffixInflection('ぎ', 'ぎる', [], ['v1d']), + suffixInflection('け', 'ける', [], ['v1d']), + suffixInflection('げ', 'げる', [], ['v1d']), + suffixInflection('じ', 'じる', [], ['v1d']), + suffixInflection('せ', 'せる', [], ['v1d']), + suffixInflection('ぜ', 'ぜる', [], ['v1d']), + suffixInflection('ち', 'ちる', [], ['v1d']), + suffixInflection('て', 'てる', [], ['v1d']), + suffixInflection('で', 'でる', [], ['v1d']), + suffixInflection('に', 'にる', [], ['v1d']), + suffixInflection('ね', 'ねる', [], ['v1d']), + suffixInflection('ひ', 'ひる', [], ['v1d']), + suffixInflection('び', 'びる', [], ['v1d']), + suffixInflection('へ', 'へる', [], ['v1d']), + suffixInflection('べ', 'べる', [], ['v1d']), + suffixInflection('み', 'みる', [], ['v1d']), + suffixInflection('め', 'める', [], ['v1d']), + suffixInflection('り', 'りる', [], ['v1d']), + suffixInflection('れ', 'れる', [], ['v1d']), + suffixInflection('い', 'う', [], ['v5']), + suffixInflection('き', 'く', [], ['v5']), + suffixInflection('ぎ', 'ぐ', [], ['v5']), + suffixInflection('し', 'す', [], ['v5']), + suffixInflection('ち', 'つ', [], ['v5']), + suffixInflection('に', 'ぬ', [], ['v5']), + suffixInflection('び', 'ぶ', [], ['v5']), + suffixInflection('み', 'む', [], ['v5']), + suffixInflection('り', 'る', [], ['v5']), + suffixInflection('き', 'くる', [], ['vk']), + suffixInflection('し', 'する', [], ['vs']), + suffixInflection('来', '来る', [], ['vk']), + suffixInflection('來', '來る', [], ['vk']) + ] + }, + { + name: 'negative', + rules: [ + suffixInflection('くない', 'い', ['adj-i'], ['adj-i']), + suffixInflection('ない', 'る', ['adj-i'], ['v1']), + suffixInflection('かない', 'く', ['adj-i'], ['v5']), + suffixInflection('がない', 'ぐ', ['adj-i'], ['v5']), + suffixInflection('さない', 'す', ['adj-i'], ['v5']), + suffixInflection('たない', 'つ', ['adj-i'], ['v5']), + suffixInflection('なない', 'ぬ', ['adj-i'], ['v5']), + suffixInflection('ばない', 'ぶ', ['adj-i'], ['v5']), + suffixInflection('まない', 'む', ['adj-i'], ['v5']), + suffixInflection('らない', 'る', ['adj-i'], ['v5']), + suffixInflection('わない', 'う', ['adj-i'], ['v5']), + suffixInflection('じない', 'ずる', ['adj-i'], ['vz']), + suffixInflection('しない', 'する', ['adj-i'], ['vs']), + suffixInflection('為ない', '為る', ['adj-i'], ['vs']), + suffixInflection('こない', 'くる', ['adj-i'], ['vk']), + suffixInflection('来ない', '来る', ['adj-i'], ['vk']), + suffixInflection('來ない', '來る', ['adj-i'], ['vk']), + suffixInflection('ません', 'ます', ['v'], ['v']) + ] + }, + { + name: 'noun', + rules: [ + suffixInflection('さ', 'い', [], ['adj-i']) + ] + }, + { + name: 'passive', + rules: [ + suffixInflection('かれる', 'く', ['v1'], ['v5']), + suffixInflection('がれる', 'ぐ', ['v1'], ['v5']), + suffixInflection('される', 'す', ['v1'], ['v5']), + suffixInflection('たれる', 'つ', ['v1'], ['v5']), + suffixInflection('なれる', 'ぬ', ['v1'], ['v5']), + suffixInflection('ばれる', 'ぶ', ['v1'], ['v5']), + suffixInflection('まれる', 'む', ['v1'], ['v5']), + suffixInflection('われる', 'う', ['v1'], ['v5']), + suffixInflection('られる', 'る', ['v1'], ['v5']), + suffixInflection('じされる', 'ずる', ['v1'], ['vz']), + suffixInflection('ぜされる', 'ずる', ['v1'], ['vz']), + suffixInflection('される', 'する', ['v1'], ['vs']), + suffixInflection('為れる', '為る', ['v1'], ['vs']), + suffixInflection('こられる', 'くる', ['v1'], ['vk']), + suffixInflection('来られる', '来る', ['v1'], ['vk']), + suffixInflection('來られる', '來る', ['v1'], ['vk']) + ] + }, + { + name: 'past', + rules: [ + suffixInflection('かった', 'い', ['past'], ['adj-i']), + suffixInflection('た', 'る', ['past'], ['v1']), + suffixInflection('いた', 'く', ['past'], ['v5']), + suffixInflection('いだ', 'ぐ', ['past'], ['v5']), + suffixInflection('した', 'す', ['past'], ['v5']), + suffixInflection('った', 'う', ['past'], ['v5']), + suffixInflection('った', 'つ', ['past'], ['v5']), + suffixInflection('った', 'る', ['past'], ['v5']), + suffixInflection('んだ', 'ぬ', ['past'], ['v5']), + suffixInflection('んだ', 'ぶ', ['past'], ['v5']), + suffixInflection('んだ', 'む', ['past'], ['v5']), + suffixInflection('じた', 'ずる', ['past'], ['vz']), + suffixInflection('した', 'する', ['past'], ['vs']), + suffixInflection('為た', '為る', ['past'], ['vs']), + suffixInflection('きた', 'くる', ['past'], ['vk']), + suffixInflection('来た', '来る', ['past'], ['vk']), + suffixInflection('來た', '來る', ['past'], ['vk']), + suffixInflection('いった', 'いく', ['past'], ['v5']), + suffixInflection('おうた', 'おう', ['past'], ['v5']), + suffixInflection('こうた', 'こう', ['past'], ['v5']), + suffixInflection('そうた', 'そう', ['past'], ['v5']), + suffixInflection('とうた', 'とう', ['past'], ['v5']), + suffixInflection('行った', '行く', ['past'], ['v5']), + suffixInflection('逝った', '逝く', ['past'], ['v5']), + suffixInflection('往った', '往く', ['past'], ['v5']), + suffixInflection('請うた', '請う', ['past'], ['v5']), + suffixInflection('乞うた', '乞う', ['past'], ['v5']), + suffixInflection('恋うた', '恋う', ['past'], ['v5']), + suffixInflection('問うた', '問う', ['past'], ['v5']), + suffixInflection('負うた', '負う', ['past'], ['v5']), + suffixInflection('沿うた', '沿う', ['past'], ['v5']), + suffixInflection('添うた', '添う', ['past'], ['v5']), + suffixInflection('副うた', '副う', ['past'], ['v5']), + suffixInflection('厭うた', '厭う', ['past'], ['v5']), + suffixInflection('のたもうた', 'のたまう', ['past'], ['v5']), + suffixInflection('ました', 'ます', ['past'], ['v']), + suffixInflection('ませんでした', 'ません', ['past'], ['v']) + ] + }, + { + name: 'polite', + rules: [ + suffixInflection('ます', 'る', ['v1'], ['v1']), + suffixInflection('います', 'う', ['v5'], ['v5']), + suffixInflection('きます', 'く', ['v5'], ['v5']), + suffixInflection('ぎます', 'ぐ', ['v5'], ['v5']), + suffixInflection('します', 'す', ['v5'], ['v5']), + suffixInflection('ちます', 'つ', ['v5'], ['v5']), + suffixInflection('にます', 'ぬ', ['v5'], ['v5']), + suffixInflection('びます', 'ぶ', ['v5'], ['v5']), + suffixInflection('みます', 'む', ['v5'], ['v5']), + suffixInflection('ります', 'る', ['v5'], ['v5']), + suffixInflection('じます', 'ずる', ['vz'], ['vz']), + suffixInflection('します', 'する', ['vs'], ['vs']), + suffixInflection('為ます', '為る', ['vs'], ['vs']), + suffixInflection('きます', 'くる', ['vk'], ['vk']), + suffixInflection('来ます', '来る', ['vk'], ['vk']), + suffixInflection('來ます', '來る', ['vk'], ['vk']), + suffixInflection('くあります', 'い', ['v'], ['adj-i']) + ] + }, + { + name: 'potential', + rules: [ + suffixInflection('れる', 'る', ['v1'], ['v1', 'v5']), + suffixInflection('える', 'う', ['v1'], ['v5']), + suffixInflection('ける', 'く', ['v1'], ['v5']), + suffixInflection('げる', 'ぐ', ['v1'], ['v5']), + suffixInflection('せる', 'す', ['v1'], ['v5']), + suffixInflection('てる', 'つ', ['v1'], ['v5']), + suffixInflection('ねる', 'ぬ', ['v1'], ['v5']), + suffixInflection('べる', 'ぶ', ['v1'], ['v5']), + suffixInflection('める', 'む', ['v1'], ['v5']), + suffixInflection('できる', 'する', ['v1'], ['vs']), + suffixInflection('出来る', 'する', ['v1'], ['vs']), + suffixInflection('これる', 'くる', ['v1'], ['vk']), + suffixInflection('来れる', '来る', ['v1'], ['vk']), + suffixInflection('來れる', '來る', ['v1'], ['vk']) + ] + }, + { + name: 'potential or passive', + rules: [ + suffixInflection('られる', 'る', ['v1'], ['v1']), + suffixInflection('ざれる', 'ずる', ['v1'], ['vz']), + suffixInflection('ぜられる', 'ずる', ['v1'], ['vz']), + suffixInflection('せられる', 'する', ['v1'], ['vs']), + suffixInflection('為られる', '為る', ['v1'], ['vs']), + suffixInflection('こられる', 'くる', ['v1'], ['vk']), + suffixInflection('来られる', '来る', ['v1'], ['vk']), + suffixInflection('來られる', '來る', ['v1'], ['vk']) + ] + }, + { + name: 'volitional', + 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('ましょう', 'ます', [], ['v']) + ] + }, + { + name: 'causative passive', + rules: [ + suffixInflection('かされる', 'く', ['v1'], ['v5']), + suffixInflection('がされる', 'ぐ', ['v1'], ['v5']), + suffixInflection('たされる', 'つ', ['v1'], ['v5']), + suffixInflection('なされる', 'ぬ', ['v1'], ['v5']), + suffixInflection('ばされる', 'ぶ', ['v1'], ['v5']), + suffixInflection('まされる', 'む', ['v1'], ['v5']), + suffixInflection('らされる', 'る', ['v1'], ['v5']), + suffixInflection('わされる', 'う', ['v1'], ['v5']) + ] + }, + { + name: '-toku', + rules: [ + suffixInflection('とく', 'る', ['v5'], ['v1']), + suffixInflection('いとく', 'く', ['v5'], ['v5']), + suffixInflection('いどく', 'ぐ', ['v5'], ['v5']), + suffixInflection('しとく', 'す', ['v5'], ['v5']), + suffixInflection('っとく', 'う', ['v5'], ['v5']), + suffixInflection('っとく', 'つ', ['v5'], ['v5']), + suffixInflection('っとく', 'る', ['v5'], ['v5']), + suffixInflection('んどく', 'ぬ', ['v5'], ['v5']), + suffixInflection('んどく', 'ぶ', ['v5'], ['v5']), + suffixInflection('んどく', 'む', ['v5'], ['v5']), + suffixInflection('じとく', 'ずる', ['v5'], ['vz']), + suffixInflection('しとく', 'する', ['v5'], ['vs']), + suffixInflection('為とく', '為る', ['v5'], ['vs']), + suffixInflection('きとく', 'くる', ['v5'], ['vk']), + suffixInflection('来とく', '来る', ['v5'], ['vk']), + suffixInflection('來とく', '來る', ['v5'], ['vk']) + ] + }, + { + name: 'progressive or perfect', + rules: [ + suffixInflection('ている', 'て', ['v1'], ['-te']), + suffixInflection('ておる', 'て', ['v5'], ['-te']), + suffixInflection('てる', 'て', ['v1p'], ['-te']), + suffixInflection('でいる', 'で', ['v1'], ['-te']), + suffixInflection('でおる', 'で', ['v5'], ['-te']), + suffixInflection('でる', 'で', ['v1p'], ['-te']), + suffixInflection('とる', 'て', ['v5'], ['-te']), + suffixInflection('ないでいる', 'ない', ['v1'], ['adj-i']) + ] + }, + { + name: '-ki', + rules: [ + suffixInflection('き', 'い', [], ['adj-i']) + ] + }, + { + name: '-ge', + rules: [ + suffixInflection('しげ', 'しい', [], ['adj-i']) + ] + }, + { + name: '-e', + rules: [ + suffixInflection('ねえ', 'ない', [], ['adj-i']), + suffixInflection('めえ', 'むい', [], ['adj-i']), + suffixInflection('みい', 'むい', [], ['adj-i']), + suffixInflection('ちぇえ', 'つい', [], ['adj-i']), + suffixInflection('ちい', 'つい', [], ['adj-i']), + suffixInflection('せえ', 'すい', [], ['adj-i']), + suffixInflection('ええ', 'いい', [], ['adj-i']), + suffixInflection('ええ', 'わい', [], ['adj-i']), + suffixInflection('ええ', 'よい', [], ['adj-i']), + suffixInflection('いぇえ', 'よい', [], ['adj-i']), + suffixInflection('うぇえ', 'わい', [], ['adj-i']), + suffixInflection('けえ', 'かい', [], ['adj-i']), + suffixInflection('げえ', 'がい', [], ['adj-i']), + suffixInflection('げえ', 'ごい', [], ['adj-i']), + suffixInflection('せえ', 'さい', [], ['adj-i']), + suffixInflection('めえ', 'まい', [], ['adj-i']), + suffixInflection('ぜえ', 'ずい', [], ['adj-i']), + suffixInflection('っぜえ', 'ずい', [], ['adj-i']), + suffixInflection('れえ', 'らい', [], ['adj-i']), + suffixInflection('れえ', 'らい', [], ['adj-i']), + suffixInflection('ちぇえ', 'ちゃい', [], ['adj-i']), + suffixInflection('でえ', 'どい', [], ['adj-i']), + suffixInflection('れえ', 'れい', [], ['adj-i']), + suffixInflection('べえ', 'ばい', [], ['adj-i']), + suffixInflection('てえ', 'たい', [], ['adj-i']), + suffixInflection('ねぇ', 'ない', [], ['adj-i']), + suffixInflection('めぇ', 'むい', [], ['adj-i']), + suffixInflection('みぃ', 'むい', [], ['adj-i']), + suffixInflection('ちぃ', 'つい', [], ['adj-i']), + suffixInflection('せぇ', 'すい', [], ['adj-i']), + suffixInflection('けぇ', 'かい', [], ['adj-i']), + suffixInflection('げぇ', 'がい', [], ['adj-i']), + suffixInflection('げぇ', 'ごい', [], ['adj-i']), + suffixInflection('せぇ', 'さい', [], ['adj-i']), + suffixInflection('めぇ', 'まい', [], ['adj-i']), + suffixInflection('ぜぇ', 'ずい', [], ['adj-i']), + suffixInflection('っぜぇ', 'ずい', [], ['adj-i']), + suffixInflection('れぇ', 'らい', [], ['adj-i']), + suffixInflection('でぇ', 'どい', [], ['adj-i']), + suffixInflection('れぇ', 'れい', [], ['adj-i']), + suffixInflection('べぇ', 'ばい', [], ['adj-i']), + suffixInflection('てぇ', 'たい', [], ['adj-i']) + ] + }, + { + name: 'slang', + rules: [ + suffixInflection('てぇてぇ', 'とうとい', [], ['adj-i']), + suffixInflection('てぇてぇ', '尊い', [], ['adj-i']), + suffixInflection('おなしゃす', 'おねがいします', [], ['v5']), + suffixInflection('おなしゃす', 'お願いします', [], ['v5']), + suffixInflection('あざす', 'ありがとうございます', [], ['v5']), + suffixInflection('さーせん', 'すみません', [], ['v5']), + suffixInflection('神ってる', '神がかっている', [], ['v1p']), + suffixInflection('じわる', 'じわじわ来る', [], ['vk']), + suffixInflection('おさしみ', 'おやすみ', [], []), + suffixInflection('おやさい', 'おやすみ', [], []) + ] + }, + { + name: 'kansai-ben', + description: 'Negative form of kansai-ben verbs', + rules: [ + suffixInflection('へん', 'ない', [], ['adj-i']), + suffixInflection('ひん', 'ない', [], ['adj-i']), + suffixInflection('せえへん', 'しない', [], ['adj-i']), + suffixInflection('へんかった', 'なかった', ['past'], ['past']), + suffixInflection('ひんかった', 'なかった', ['past'], ['past']), + suffixInflection('うてへん', 'ってない', [], ['adj-i']) + ] + }, + { + name: 'kansai-ben', + description: '-te form of kansai-ben verbs', + rules: [ + suffixInflection('うて', 'って', ['-te'], ['-te']), + suffixInflection('おうて', 'あって', ['-te'], ['-te']), + suffixInflection('こうて', 'かって', ['-te'], ['-te']), + suffixInflection('ごうて', 'がって', ['-te'], ['-te']), + suffixInflection('そうて', 'さって', ['-te'], ['-te']), + suffixInflection('ぞうて', 'ざって', ['-te'], ['-te']), + suffixInflection('とうて', 'たって', ['-te'], ['-te']), + suffixInflection('どうて', 'だって', ['-te'], ['-te']), + suffixInflection('のうて', 'なって', ['-te'], ['-te']), + suffixInflection('ほうて', 'はって', ['-te'], ['-te']), + suffixInflection('ぼうて', 'ばって', ['-te'], ['-te']), + suffixInflection('もうて', 'まって', ['-te'], ['-te']), + suffixInflection('ろうて', 'らって', ['-te'], ['-te']), + suffixInflection('ようて', 'やって', ['-te'], ['-te']), + suffixInflection('ゆうて', 'いって', ['-te'], ['-te']) + ] + }, + { + name: 'kansai-ben', + description: 'past form of kansai-ben terms', + rules: [ + suffixInflection('うた', 'った', ['past'], ['past']), + suffixInflection('おうた', 'あった', ['past'], ['past']), + suffixInflection('こうた', 'かった', ['past'], ['past']), + suffixInflection('ごうた', 'がった', ['past'], ['past']), + suffixInflection('そうた', 'さった', ['past'], ['past']), + suffixInflection('ぞうた', 'ざった', ['past'], ['past']), + suffixInflection('とうた', 'たった', ['past'], ['past']), + suffixInflection('どうた', 'だった', ['past'], ['past']), + suffixInflection('のうた', 'なった', ['past'], ['past']), + suffixInflection('ほうた', 'はった', ['past'], ['past']), + suffixInflection('ぼうた', 'ばった', ['past'], ['past']), + suffixInflection('もうた', 'まった', ['past'], ['past']), + suffixInflection('ろうた', 'らった', ['past'], ['past']), + suffixInflection('ようた', 'やった', ['past'], ['past']), + suffixInflection('ゆうた', 'いった', ['past'], ['past']) + ] + }, + { + name: 'kansai-ben', + description: '-tara form of kansai-ben terms', + rules: [ + suffixInflection('うたら', 'ったら', [], []), + suffixInflection('おうたら', 'あったら', [], []), + suffixInflection('こうたら', 'かったら', [], []), + suffixInflection('ごうたら', 'がったら', [], []), + suffixInflection('そうたら', 'さったら', [], []), + suffixInflection('ぞうたら', 'ざったら', [], []), + suffixInflection('とうたら', 'たったら', [], []), + suffixInflection('どうたら', 'だったら', [], []), + suffixInflection('のうたら', 'なったら', [], []), + suffixInflection('ほうたら', 'はったら', [], []), + suffixInflection('ぼうたら', 'ばったら', [], []), + suffixInflection('もうたら', 'まったら', [], []), + suffixInflection('ろうたら', 'らったら', [], []), + suffixInflection('ようたら', 'やったら', [], []), + suffixInflection('ゆうたら', 'いったら', [], []) + ] + }, + { + name: 'kansai-ben', + description: '-ku stem of kansai-ben adjectives', + rules: [ + suffixInflection('う', 'く', [], ['adv']), + suffixInflection('こう', 'かく', [], ['adv']), + suffixInflection('ごう', 'がく', [], ['adv']), + suffixInflection('そう', 'さく', [], ['adv']), + suffixInflection('とう', 'たく', [], ['adv']), + suffixInflection('のう', 'なく', [], ['adv']), + suffixInflection('ぼう', 'ばく', [], ['adv']), + suffixInflection('もう', 'まく', [], ['adv']), + suffixInflection('ろう', 'らく', [], ['adv']), + suffixInflection('よう', 'よく', [], ['adv']), + suffixInflection('しゅう', 'しく', [], ['adv']) + ] + }, + { + name: 'kansai-ben', + description: '-te form of kansai-ben adjectives', + rules: [ + suffixInflection('うて', 'くて', ['-te'], ['-te']), + suffixInflection('こうて', 'かくて', ['-te'], ['-te']), + suffixInflection('ごうて', 'がくて', ['-te'], ['-te']), + suffixInflection('そうて', 'さくて', ['-te'], ['-te']), + suffixInflection('とうて', 'たくて', ['-te'], ['-te']), + suffixInflection('のうて', 'なくて', ['-te'], ['-te']), + suffixInflection('ぼうて', 'ばくて', ['-te'], ['-te']), + suffixInflection('もうて', 'まくて', ['-te'], ['-te']), + suffixInflection('ろうて', 'らくて', ['-te'], ['-te']), + suffixInflection('ようて', 'よくて', ['-te'], ['-te']), + suffixInflection('しゅうて', 'しくて', ['-te'], ['-te']) + ] + }, + { + name: 'kansai-ben', + description: 'Negative form of kansai-ben adjectives', + rules: [ + suffixInflection('うない', 'くない', ['adj-i'], ['adj-i']), + suffixInflection('こうない', 'かくない', ['adj-i'], ['adj-i']), + suffixInflection('ごうない', 'がくない', ['adj-i'], ['adj-i']), + suffixInflection('そうない', 'さくない', ['adj-i'], ['adj-i']), + suffixInflection('とうない', 'たくない', ['adj-i'], ['adj-i']), + suffixInflection('のうない', 'なくない', ['adj-i'], ['adj-i']), + suffixInflection('ぼうない', 'ばくない', ['adj-i'], ['adj-i']), + suffixInflection('もうない', 'まくない', ['adj-i'], ['adj-i']), + suffixInflection('ろうない', 'らくない', ['adj-i'], ['adj-i']), + suffixInflection('ようない', 'よくない', ['adj-i'], ['adj-i']), + suffixInflection('しゅうない', 'しくない', ['adj-i'], ['adj-i']) + ] + } + ] +}; diff --git a/ext/js/language/ja/japanese-transforms.json b/ext/js/language/ja/japanese-transforms.json deleted file mode 100644 index c5983526..00000000 --- a/ext/js/language/ja/japanese-transforms.json +++ /dev/null @@ -1,1013 +0,0 @@ -{ - "language": "ja", - "conditions": { - "v": { - "name": "Verb", - "i18n": [ - { - "language": "ja", - "name": "動詞" - } - ], - "isDictionaryForm": false, - "subConditions": ["v1", "v5", "vk", "vs", "vz"] - }, - "v1": { - "name": "Ichidan verb", - "i18n": [ - { - "language": "ja", - "name": "一段動詞" - } - ], - "isDictionaryForm": true, - "subConditions": ["v1d", "v1p"] - }, - "v1d": { - "name": "Ichidan verb, dictionary form", - "i18n": [ - { - "language": "ja", - "name": "一段動詞、辞書形" - } - ], - "isDictionaryForm": false - }, - "v1p": { - "name": "Ichidan verb, progressive or perfect form", - "i18n": [ - { - "language": "ja", - "name": "一段動詞、進行形または完了形" - } - ], - "isDictionaryForm": false - }, - "v5": { - "name": "Godan verb", - "i18n": [ - { - "language": "ja", - "name": "五段動詞" - } - ], - "isDictionaryForm": true - }, - "vk": { - "name": "Kuru verb", - "i18n": [ - { - "language": "ja", - "name": "来る動詞" - } - ], - "isDictionaryForm": true - }, - "vs": { - "name": "Suru verb", - "i18n": [ - { - "language": "ja", - "name": "する動詞" - } - ], - "isDictionaryForm": true - }, - "vz": { - "name": "Zuru verb", - "i18n": [ - { - "language": "ja", - "name": "ずる動詞" - } - ], - "isDictionaryForm": true - }, - "adj-i": { - "name": "Adjective with i ending", - "i18n": [ - { - "language": "ja", - "name": "形容詞" - } - ], - "isDictionaryForm": true - }, - "-te": { - "name": "Intermediate -te endings for progressive or perfect tense", - "isDictionaryForm": false - }, - "adv": { - "name": "Intermediate -ku endings for adverbs", - "isDictionaryForm": false - }, - "past": { - "name": "-ta past form ending", - "isDictionaryForm": false - } - }, - "transforms": [ - { - "name": "-ba", - "description": "Conditional", - "i18n": [ - { - "language": "ja", - "name": "ば", - "description": "仮定形" - } - ], - "rules": [ - {"suffixIn": "ければ", "suffixOut": "い", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "えば", "suffixOut": "う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "けば", "suffixOut": "く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "げば", "suffixOut": "ぐ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "せば", "suffixOut": "す", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "てば", "suffixOut": "つ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ねば", "suffixOut": "ぬ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "べば", "suffixOut": "ぶ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "めば", "suffixOut": "む", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "れば", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v1", "v5", "vk", "vs", "vz"]} - ] - }, - { - "name": "-chau", - "rules": [ - {"suffixIn": "ちゃう", "suffixOut": "る", "conditionsIn": ["v5"], "conditionsOut": ["v1"]}, - {"suffixIn": "いじゃう", "suffixOut": "ぐ", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "いちゃう", "suffixOut": "く", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "しちゃう", "suffixOut": "す", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "っちゃう", "suffixOut": "う", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "っちゃう", "suffixOut": "く", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "っちゃう", "suffixOut": "つ", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "っちゃう", "suffixOut": "る", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "んじゃう", "suffixOut": "ぬ", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "んじゃう", "suffixOut": "ぶ", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "んじゃう", "suffixOut": "む", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "じちゃう", "suffixOut": "ずる", "conditionsIn": ["v5"], "conditionsOut": ["vz"]}, - {"suffixIn": "しちゃう", "suffixOut": "する", "conditionsIn": ["v5"], "conditionsOut": ["vs"]}, - {"suffixIn": "為ちゃう", "suffixOut": "為る", "conditionsIn": ["v5"], "conditionsOut": ["vs"]}, - {"suffixIn": "きちゃう", "suffixOut": "くる", "conditionsIn": ["v5"], "conditionsOut": ["vk"]}, - {"suffixIn": "来ちゃう", "suffixOut": "来る", "conditionsIn": ["v5"], "conditionsOut": ["vk"]}, - {"suffixIn": "來ちゃう", "suffixOut": "來る", "conditionsIn": ["v5"], "conditionsOut": ["vk"]} - ] - }, - { - "name": "-chimau", - "rules": [ - {"suffixIn": "ちまう", "suffixOut": "る", "conditionsIn": ["v5"], "conditionsOut": ["v1"]}, - {"suffixIn": "いじまう", "suffixOut": "ぐ", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "いちまう", "suffixOut": "く", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "しちまう", "suffixOut": "す", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "っちまう", "suffixOut": "う", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "っちまう", "suffixOut": "く", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "っちまう", "suffixOut": "つ", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "っちまう", "suffixOut": "る", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "んじまう", "suffixOut": "ぬ", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "んじまう", "suffixOut": "ぶ", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "んじまう", "suffixOut": "む", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "じちまう", "suffixOut": "ずる", "conditionsIn": ["v5"], "conditionsOut": ["vz"]}, - {"suffixIn": "しちまう", "suffixOut": "する", "conditionsIn": ["v5"], "conditionsOut": ["vs"]}, - {"suffixIn": "為ちまう", "suffixOut": "為る", "conditionsIn": ["v5"], "conditionsOut": ["vs"]}, - {"suffixIn": "きちまう", "suffixOut": "くる", "conditionsIn": ["v5"], "conditionsOut": ["vk"]}, - {"suffixIn": "来ちまう", "suffixOut": "来る", "conditionsIn": ["v5"], "conditionsOut": ["vk"]}, - {"suffixIn": "來ちまう", "suffixOut": "來る", "conditionsIn": ["v5"], "conditionsOut": ["vk"]} - ] - }, - { - "name": "-shimau", - "rules": [ - {"suffixIn": "てしまう", "suffixOut": "て", "conditionsIn": ["v5"], "conditionsOut": ["-te"]}, - {"suffixIn": "でしまう", "suffixOut": "で", "conditionsIn": ["v5"], "conditionsOut": ["-te"]} - ] - }, - { - "name": "-nasai", - "rules": [ - {"suffixIn": "なさい", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v1"]}, - {"suffixIn": "いなさい", "suffixOut": "う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "きなさい", "suffixOut": "く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ぎなさい", "suffixOut": "ぐ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "しなさい", "suffixOut": "す", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ちなさい", "suffixOut": "つ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "になさい", "suffixOut": "ぬ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "びなさい", "suffixOut": "ぶ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "みなさい", "suffixOut": "む", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "りなさい", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "じなさい", "suffixOut": "ずる", "conditionsIn": [], "conditionsOut": ["vz"]}, - {"suffixIn": "しなさい", "suffixOut": "する", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "為なさい", "suffixOut": "為る", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "きなさい", "suffixOut": "くる", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "来なさい", "suffixOut": "来る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "來なさい", "suffixOut": "來る", "conditionsIn": [], "conditionsOut": ["vk"]} - ] - }, - { - "name": "-sou", - "rules": [ - {"suffixIn": "そう", "suffixOut": "い", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "そう", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v1"]}, - {"suffixIn": "いそう", "suffixOut": "う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "きそう", "suffixOut": "く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ぎそう", "suffixOut": "ぐ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "しそう", "suffixOut": "す", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ちそう", "suffixOut": "つ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "にそう", "suffixOut": "ぬ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "びそう", "suffixOut": "ぶ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "みそう", "suffixOut": "む", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "りそう", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "じそう", "suffixOut": "ずる", "conditionsIn": [], "conditionsOut": ["vz"]}, - {"suffixIn": "しそう", "suffixOut": "する", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "為そう", "suffixOut": "為る", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "きそう", "suffixOut": "くる", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "来そう", "suffixOut": "来る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "來そう", "suffixOut": "來る", "conditionsIn": [], "conditionsOut": ["vk"]} - ] - }, - { - "name": "-sugiru", - "rules": [ - {"suffixIn": "すぎる", "suffixOut": "い", "conditionsIn": ["v1"], "conditionsOut": ["adj-i"]}, - {"suffixIn": "すぎる", "suffixOut": "る", "conditionsIn": ["v1"], "conditionsOut": ["v1"]}, - {"suffixIn": "いすぎる", "suffixOut": "う", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "きすぎる", "suffixOut": "く", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "ぎすぎる", "suffixOut": "ぐ", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "しすぎる", "suffixOut": "す", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "ちすぎる", "suffixOut": "つ", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "にすぎる", "suffixOut": "ぬ", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "びすぎる", "suffixOut": "ぶ", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "みすぎる", "suffixOut": "む", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "りすぎる", "suffixOut": "る", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "じすぎる", "suffixOut": "ずる", "conditionsIn": ["v1"], "conditionsOut": ["vz"]}, - {"suffixIn": "しすぎる", "suffixOut": "する", "conditionsIn": ["v1"], "conditionsOut": ["vs"]}, - {"suffixIn": "為すぎる", "suffixOut": "為る", "conditionsIn": ["v1"], "conditionsOut": ["vs"]}, - {"suffixIn": "きすぎる", "suffixOut": "くる", "conditionsIn": ["v1"], "conditionsOut": ["vk"]}, - {"suffixIn": "来すぎる", "suffixOut": "来る", "conditionsIn": ["v1"], "conditionsOut": ["vk"]}, - {"suffixIn": "來すぎる", "suffixOut": "來る", "conditionsIn": ["v1"], "conditionsOut": ["vk"]} - ] - }, - { - "name": "-tai", - "rules": [ - {"suffixIn": "たい", "suffixOut": "る", "conditionsIn": ["adj-i"], "conditionsOut": ["v1"]}, - {"suffixIn": "いたい", "suffixOut": "う", "conditionsIn": ["adj-i"], "conditionsOut": ["v5"]}, - {"suffixIn": "きたい", "suffixOut": "く", "conditionsIn": ["adj-i"], "conditionsOut": ["v5"]}, - {"suffixIn": "ぎたい", "suffixOut": "ぐ", "conditionsIn": ["adj-i"], "conditionsOut": ["v5"]}, - {"suffixIn": "したい", "suffixOut": "す", "conditionsIn": ["adj-i"], "conditionsOut": ["v5"]}, - {"suffixIn": "ちたい", "suffixOut": "つ", "conditionsIn": ["adj-i"], "conditionsOut": ["v5"]}, - {"suffixIn": "にたい", "suffixOut": "ぬ", "conditionsIn": ["adj-i"], "conditionsOut": ["v5"]}, - {"suffixIn": "びたい", "suffixOut": "ぶ", "conditionsIn": ["adj-i"], "conditionsOut": ["v5"]}, - {"suffixIn": "みたい", "suffixOut": "む", "conditionsIn": ["adj-i"], "conditionsOut": ["v5"]}, - {"suffixIn": "りたい", "suffixOut": "る", "conditionsIn": ["adj-i"], "conditionsOut": ["v5"]}, - {"suffixIn": "じたい", "suffixOut": "ずる", "conditionsIn": ["adj-i"], "conditionsOut": ["vz"]}, - {"suffixIn": "したい", "suffixOut": "する", "conditionsIn": ["adj-i"], "conditionsOut": ["vs"]}, - {"suffixIn": "為たい", "suffixOut": "為る", "conditionsIn": ["adj-i"], "conditionsOut": ["vs"]}, - {"suffixIn": "きたい", "suffixOut": "くる", "conditionsIn": ["adj-i"], "conditionsOut": ["vk"]}, - {"suffixIn": "来たい", "suffixOut": "来る", "conditionsIn": ["adj-i"], "conditionsOut": ["vk"]}, - {"suffixIn": "來たい", "suffixOut": "來る", "conditionsIn": ["adj-i"], "conditionsOut": ["vk"]} - ] - }, - { - "name": "-tara", - "rules": [ - {"suffixIn": "かったら", "suffixOut": "い", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "たら", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v1"]}, - {"suffixIn": "いたら", "suffixOut": "く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "いだら", "suffixOut": "ぐ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "したら", "suffixOut": "す", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ったら", "suffixOut": "う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ったら", "suffixOut": "つ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ったら", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "んだら", "suffixOut": "ぬ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "んだら", "suffixOut": "ぶ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "んだら", "suffixOut": "む", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "じたら", "suffixOut": "ずる", "conditionsIn": [], "conditionsOut": ["vz"]}, - {"suffixIn": "したら", "suffixOut": "する", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "為たら", "suffixOut": "為る", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "きたら", "suffixOut": "くる", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "来たら", "suffixOut": "来る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "來たら", "suffixOut": "來る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "いったら", "suffixOut": "いく", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "おうたら", "suffixOut": "おう", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "こうたら", "suffixOut": "こう", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "そうたら", "suffixOut": "そう", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "とうたら", "suffixOut": "とう", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "行ったら", "suffixOut": "行く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "逝ったら", "suffixOut": "逝く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "往ったら", "suffixOut": "往く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "請うたら", "suffixOut": "請う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "乞うたら", "suffixOut": "乞う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "恋うたら", "suffixOut": "恋う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "問うたら", "suffixOut": "問う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "負うたら", "suffixOut": "負う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "沿うたら", "suffixOut": "沿う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "添うたら", "suffixOut": "添う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "副うたら", "suffixOut": "副う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "厭うたら", "suffixOut": "厭う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "のたもうたら", "suffixOut": "のたまう", "conditionsIn": [], "conditionsOut": ["v5"]} - ] - }, - { - "name": "-tari", - "rules": [ - {"suffixIn": "かったり", "suffixOut": "い", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "たり", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v1"]}, - {"suffixIn": "いたり", "suffixOut": "く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "いだり", "suffixOut": "ぐ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "したり", "suffixOut": "す", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ったり", "suffixOut": "う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ったり", "suffixOut": "つ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ったり", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "んだり", "suffixOut": "ぬ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "んだり", "suffixOut": "ぶ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "んだり", "suffixOut": "む", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "じたり", "suffixOut": "ずる", "conditionsIn": [], "conditionsOut": ["vz"]}, - {"suffixIn": "したり", "suffixOut": "する", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "為たり", "suffixOut": "為る", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "きたり", "suffixOut": "くる", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "来たり", "suffixOut": "来る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "來たり", "suffixOut": "來る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "いったり", "suffixOut": "いく", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "おうたり", "suffixOut": "おう", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "こうたり", "suffixOut": "こう", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "そうたり", "suffixOut": "そう", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "とうたり", "suffixOut": "とう", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "行ったり", "suffixOut": "行く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "逝ったり", "suffixOut": "逝く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "往ったり", "suffixOut": "往く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "請うたり", "suffixOut": "請う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "乞うたり", "suffixOut": "乞う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "恋うたり", "suffixOut": "恋う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "問うたり", "suffixOut": "問う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "負うたり", "suffixOut": "負う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "沿うたり", "suffixOut": "沿う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "添うたり", "suffixOut": "添う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "副うたり", "suffixOut": "副う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "厭うたり", "suffixOut": "厭う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "のたもうたり", "suffixOut": "のたまう", "conditionsIn": [], "conditionsOut": ["v5"]} - ] - }, - { - "name": "-te", - "rules": [ - {"suffixIn": "くて", "suffixOut": "い", "conditionsIn": ["-te"], "conditionsOut": ["adj-i"]}, - {"suffixIn": "て", "suffixOut": "る", "conditionsIn": ["-te"], "conditionsOut": ["v1"]}, - {"suffixIn": "いて", "suffixOut": "く", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "いで", "suffixOut": "ぐ", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "して", "suffixOut": "す", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "って", "suffixOut": "う", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "って", "suffixOut": "つ", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "って", "suffixOut": "る", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "んで", "suffixOut": "ぬ", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "んで", "suffixOut": "ぶ", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "んで", "suffixOut": "む", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "じて", "suffixOut": "ずる", "conditionsIn": ["-te"], "conditionsOut": ["vz"]}, - {"suffixIn": "して", "suffixOut": "する", "conditionsIn": ["-te"], "conditionsOut": ["vs"]}, - {"suffixIn": "為て", "suffixOut": "為る", "conditionsIn": ["-te"], "conditionsOut": ["vs"]}, - {"suffixIn": "きて", "suffixOut": "くる", "conditionsIn": ["-te"], "conditionsOut": ["vk"]}, - {"suffixIn": "来て", "suffixOut": "来る", "conditionsIn": ["-te"], "conditionsOut": ["vk"]}, - {"suffixIn": "來て", "suffixOut": "來る", "conditionsIn": ["-te"], "conditionsOut": ["vk"]}, - {"suffixIn": "いって", "suffixOut": "いく", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "おうて", "suffixOut": "おう", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "こうて", "suffixOut": "こう", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "そうて", "suffixOut": "そう", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "とうて", "suffixOut": "とう", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "行って", "suffixOut": "行く", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "逝って", "suffixOut": "逝く", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "往って", "suffixOut": "往く", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "請うて", "suffixOut": "請う", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "乞うて", "suffixOut": "乞う", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "恋うて", "suffixOut": "恋う", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "問うて", "suffixOut": "問う", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "負うて", "suffixOut": "負う", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "沿うて", "suffixOut": "沿う", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "添うて", "suffixOut": "添う", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "副うて", "suffixOut": "副う", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "厭うて", "suffixOut": "厭う", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "のたもうて", "suffixOut": "のたまう", "conditionsIn": ["-te"], "conditionsOut": ["v5"]}, - {"suffixIn": "まして", "suffixOut": "ます", "conditionsIn": [], "conditionsOut": ["v"]} - ] - }, - { - "name": "-zu", - "rules": [ - {"suffixIn": "ず", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v1"]}, - {"suffixIn": "かず", "suffixOut": "く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "がず", "suffixOut": "ぐ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "さず", "suffixOut": "す", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "たず", "suffixOut": "つ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "なず", "suffixOut": "ぬ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ばず", "suffixOut": "ぶ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "まず", "suffixOut": "む", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "らず", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "わず", "suffixOut": "う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ぜず", "suffixOut": "ずる", "conditionsIn": [], "conditionsOut": ["vz"]}, - {"suffixIn": "せず", "suffixOut": "する", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "為ず", "suffixOut": "為る", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "こず", "suffixOut": "くる", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "来ず", "suffixOut": "来る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "來ず", "suffixOut": "來る", "conditionsIn": [], "conditionsOut": ["vk"]} - ] - }, - { - "name": "-nu", - "rules": [ - {"suffixIn": "ぬ", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v1"]}, - {"suffixIn": "かぬ", "suffixOut": "く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "がぬ", "suffixOut": "ぐ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "さぬ", "suffixOut": "す", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "たぬ", "suffixOut": "つ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "なぬ", "suffixOut": "ぬ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ばぬ", "suffixOut": "ぶ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "まぬ", "suffixOut": "む", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "らぬ", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "わぬ", "suffixOut": "う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ぜぬ", "suffixOut": "ずる", "conditionsIn": [], "conditionsOut": ["vz"]}, - {"suffixIn": "せぬ", "suffixOut": "する", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "為ぬ", "suffixOut": "為る", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "こぬ", "suffixOut": "くる", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "来ぬ", "suffixOut": "来る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "來ぬ", "suffixOut": "來る", "conditionsIn": [], "conditionsOut": ["vk"]} - ] - }, - { - "name": "-mu", - "rules": [ - {"suffixIn": "む", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v1"]}, - {"suffixIn": "かむ", "suffixOut": "く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "がむ", "suffixOut": "ぐ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "さむ", "suffixOut": "す", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "たむ", "suffixOut": "つ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "なむ", "suffixOut": "ぬ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ばむ", "suffixOut": "ぶ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "まむ", "suffixOut": "む", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "らむ", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "わむ", "suffixOut": "う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ぜむ", "suffixOut": "ずる", "conditionsIn": [], "conditionsOut": ["vz"]}, - {"suffixIn": "せむ", "suffixOut": "する", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "為む", "suffixOut": "為る", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "こむ", "suffixOut": "くる", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "来む", "suffixOut": "来る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "來む", "suffixOut": "來る", "conditionsIn": [], "conditionsOut": ["vk"]} - ] - }, - { - "name": "-zaru", - "rules": [ - {"suffixIn": "ざる", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v1"]}, - {"suffixIn": "かざる", "suffixOut": "く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "がざる", "suffixOut": "ぐ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "さざる", "suffixOut": "す", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "たざる", "suffixOut": "つ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "なざる", "suffixOut": "ぬ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ばざる", "suffixOut": "ぶ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "まざる", "suffixOut": "む", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "らざる", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "わざる", "suffixOut": "う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ぜざる", "suffixOut": "ずる", "conditionsIn": [], "conditionsOut": ["vz"]}, - {"suffixIn": "せざる", "suffixOut": "する", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "為ざる", "suffixOut": "為る", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "こざる", "suffixOut": "くる", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "来ざる", "suffixOut": "来る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "來ざる", "suffixOut": "來る", "conditionsIn": [], "conditionsOut": ["vk"]} - ] - }, - { - "name": "-neba", - "rules": [ - {"suffixIn": "ねば", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v1"]}, - {"suffixIn": "かねば", "suffixOut": "く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "がねば", "suffixOut": "ぐ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "さねば", "suffixOut": "す", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "たねば", "suffixOut": "つ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "なねば", "suffixOut": "ぬ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ばねば", "suffixOut": "ぶ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "まねば", "suffixOut": "む", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "らねば", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "わねば", "suffixOut": "う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ぜねば", "suffixOut": "ずる", "conditionsIn": [], "conditionsOut": ["vz"]}, - {"suffixIn": "せねば", "suffixOut": "する", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "為ねば", "suffixOut": "為る", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "こねば", "suffixOut": "くる", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "来ねば", "suffixOut": "来る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "來ねば", "suffixOut": "來る", "conditionsIn": [], "conditionsOut": ["vk"]} - ] - }, - { - "name": "adv", - "rules": [ - {"suffixIn": "く", "suffixOut": "い", "conditionsIn": ["adv"], "conditionsOut": ["adj-i"]} - ] - }, - { - "name": "causative", - "rules": [ - {"suffixIn": "させる", "suffixOut": "る", "conditionsIn": ["v1"], "conditionsOut": ["v1"]}, - {"suffixIn": "かせる", "suffixOut": "く", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "がせる", "suffixOut": "ぐ", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "させる", "suffixOut": "す", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "たせる", "suffixOut": "つ", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "なせる", "suffixOut": "ぬ", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "ばせる", "suffixOut": "ぶ", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "ませる", "suffixOut": "む", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "らせる", "suffixOut": "る", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "わせる", "suffixOut": "う", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "じさせる", "suffixOut": "ずる", "conditionsIn": ["v1"], "conditionsOut": ["vz"]}, - {"suffixIn": "ぜさせる", "suffixOut": "ずる", "conditionsIn": ["v1"], "conditionsOut": ["vz"]}, - {"suffixIn": "させる", "suffixOut": "する", "conditionsIn": ["v1"], "conditionsOut": ["vs"]}, - {"suffixIn": "為せる", "suffixOut": "為る", "conditionsIn": ["v1"], "conditionsOut": ["vs"]}, - {"suffixIn": "せさせる", "suffixOut": "する", "conditionsIn": ["v1"], "conditionsOut": ["vs"]}, - {"suffixIn": "為させる", "suffixOut": "為る", "conditionsIn": ["v1"], "conditionsOut": ["vs"]}, - {"suffixIn": "こさせる", "suffixOut": "くる", "conditionsIn": ["v1"], "conditionsOut": ["vk"]}, - {"suffixIn": "来させる", "suffixOut": "来る", "conditionsIn": ["v1"], "conditionsOut": ["vk"]}, - {"suffixIn": "來させる", "suffixOut": "來る", "conditionsIn": ["v1"], "conditionsOut": ["vk"]} - ] - }, - { - "name": "imperative", - "rules": [ - {"suffixIn": "ろ", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v1"]}, - {"suffixIn": "よ", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v1"]}, - {"suffixIn": "え", "suffixOut": "う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "け", "suffixOut": "く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "げ", "suffixOut": "ぐ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "せ", "suffixOut": "す", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "て", "suffixOut": "つ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ね", "suffixOut": "ぬ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "べ", "suffixOut": "ぶ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "め", "suffixOut": "む", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "れ", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "じろ", "suffixOut": "ずる", "conditionsIn": [], "conditionsOut": ["vz"]}, - {"suffixIn": "ぜよ", "suffixOut": "ずる", "conditionsIn": [], "conditionsOut": ["vz"]}, - {"suffixIn": "しろ", "suffixOut": "する", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "せよ", "suffixOut": "する", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "為ろ", "suffixOut": "為る", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "為よ", "suffixOut": "為る", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "こい", "suffixOut": "くる", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "来い", "suffixOut": "来る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "來い", "suffixOut": "來る", "conditionsIn": [], "conditionsOut": ["vk"]} - ] - }, - { - "name": "imperative negative", - "rules": [ - {"suffixIn": "な", "suffixOut": "", "conditionsIn": [], "conditionsOut": ["v"]} - ] - }, - { - "name": "masu stem", - "rules": [ - {"suffixIn": "い", "suffixOut": "いる", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "え", "suffixOut": "える", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "き", "suffixOut": "きる", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "ぎ", "suffixOut": "ぎる", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "け", "suffixOut": "ける", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "げ", "suffixOut": "げる", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "じ", "suffixOut": "じる", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "せ", "suffixOut": "せる", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "ぜ", "suffixOut": "ぜる", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "ち", "suffixOut": "ちる", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "て", "suffixOut": "てる", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "で", "suffixOut": "でる", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "に", "suffixOut": "にる", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "ね", "suffixOut": "ねる", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "ひ", "suffixOut": "ひる", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "び", "suffixOut": "びる", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "へ", "suffixOut": "へる", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "べ", "suffixOut": "べる", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "み", "suffixOut": "みる", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "め", "suffixOut": "める", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "り", "suffixOut": "りる", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "れ", "suffixOut": "れる", "conditionsIn": [], "conditionsOut": ["v1d"]}, - {"suffixIn": "い", "suffixOut": "う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "き", "suffixOut": "く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ぎ", "suffixOut": "ぐ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "し", "suffixOut": "す", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ち", "suffixOut": "つ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "に", "suffixOut": "ぬ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "び", "suffixOut": "ぶ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "み", "suffixOut": "む", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "り", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "し", "suffixOut": "する", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "き", "suffixOut": "くる", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "来", "suffixOut": "来る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "來", "suffixOut": "來る", "conditionsIn": [], "conditionsOut": ["vk"]} - ] - }, - { - "name": "negative", - "rules": [ - {"suffixIn": "くない", "suffixOut": "い", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]}, - {"suffixIn": "ない", "suffixOut": "る", "conditionsIn": ["adj-i"], "conditionsOut": ["v1"]}, - {"suffixIn": "かない", "suffixOut": "く", "conditionsIn": ["adj-i"], "conditionsOut": ["v5"]}, - {"suffixIn": "がない", "suffixOut": "ぐ", "conditionsIn": ["adj-i"], "conditionsOut": ["v5"]}, - {"suffixIn": "さない", "suffixOut": "す", "conditionsIn": ["adj-i"], "conditionsOut": ["v5"]}, - {"suffixIn": "たない", "suffixOut": "つ", "conditionsIn": ["adj-i"], "conditionsOut": ["v5"]}, - {"suffixIn": "なない", "suffixOut": "ぬ", "conditionsIn": ["adj-i"], "conditionsOut": ["v5"]}, - {"suffixIn": "ばない", "suffixOut": "ぶ", "conditionsIn": ["adj-i"], "conditionsOut": ["v5"]}, - {"suffixIn": "まない", "suffixOut": "む", "conditionsIn": ["adj-i"], "conditionsOut": ["v5"]}, - {"suffixIn": "らない", "suffixOut": "る", "conditionsIn": ["adj-i"], "conditionsOut": ["v5"]}, - {"suffixIn": "わない", "suffixOut": "う", "conditionsIn": ["adj-i"], "conditionsOut": ["v5"]}, - {"suffixIn": "じない", "suffixOut": "ずる", "conditionsIn": ["adj-i"], "conditionsOut": ["vz"]}, - {"suffixIn": "しない", "suffixOut": "する", "conditionsIn": ["adj-i"], "conditionsOut": ["vs"]}, - {"suffixIn": "為ない", "suffixOut": "為る", "conditionsIn": ["adj-i"], "conditionsOut": ["vs"]}, - {"suffixIn": "こない", "suffixOut": "くる", "conditionsIn": ["adj-i"], "conditionsOut": ["vk"]}, - {"suffixIn": "来ない", "suffixOut": "来る", "conditionsIn": ["adj-i"], "conditionsOut": ["vk"]}, - {"suffixIn": "來ない", "suffixOut": "來る", "conditionsIn": ["adj-i"], "conditionsOut": ["vk"]}, - {"suffixIn": "ません", "suffixOut": "ます", "conditionsIn": ["v"], "conditionsOut": ["v"]} - ] - }, - { - "name": "noun", - "rules": [ - {"suffixIn": "さ", "suffixOut": "い", "conditionsIn": [], "conditionsOut": ["adj-i"]} - ] - }, - { - "name": "passive", - "rules": [ - {"suffixIn": "かれる", "suffixOut": "く", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "がれる", "suffixOut": "ぐ", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "される", "suffixOut": "す", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "たれる", "suffixOut": "つ", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "なれる", "suffixOut": "ぬ", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "ばれる", "suffixOut": "ぶ", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "まれる", "suffixOut": "む", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "われる", "suffixOut": "う", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "られる", "suffixOut": "る", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "じされる", "suffixOut": "ずる", "conditionsIn": ["v1"], "conditionsOut": ["vz"]}, - {"suffixIn": "ぜされる", "suffixOut": "ずる", "conditionsIn": ["v1"], "conditionsOut": ["vz"]}, - {"suffixIn": "される", "suffixOut": "する", "conditionsIn": ["v1"], "conditionsOut": ["vs"]}, - {"suffixIn": "為れる", "suffixOut": "為る", "conditionsIn": ["v1"], "conditionsOut": ["vs"]}, - {"suffixIn": "こられる", "suffixOut": "くる", "conditionsIn": ["v1"], "conditionsOut": ["vk"]}, - {"suffixIn": "来られる", "suffixOut": "来る", "conditionsIn": ["v1"], "conditionsOut": ["vk"]}, - {"suffixIn": "來られる", "suffixOut": "來る", "conditionsIn": ["v1"], "conditionsOut": ["vk"]} - ] - }, - { - "name": "past", - "rules": [ - {"suffixIn": "かった", "suffixOut": "い", "conditionsIn": ["past"], "conditionsOut": ["adj-i"]}, - {"suffixIn": "た", "suffixOut": "る", "conditionsIn": ["past"], "conditionsOut": ["v1"]}, - {"suffixIn": "いた", "suffixOut": "く", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "いだ", "suffixOut": "ぐ", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "した", "suffixOut": "す", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "った", "suffixOut": "う", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "った", "suffixOut": "つ", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "った", "suffixOut": "る", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "んだ", "suffixOut": "ぬ", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "んだ", "suffixOut": "ぶ", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "んだ", "suffixOut": "む", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "じた", "suffixOut": "ずる", "conditionsIn": ["past"], "conditionsOut": ["vz"]}, - {"suffixIn": "した", "suffixOut": "する", "conditionsIn": ["past"], "conditionsOut": ["vs"]}, - {"suffixIn": "為た", "suffixOut": "為る", "conditionsIn": ["past"], "conditionsOut": ["vs"]}, - {"suffixIn": "きた", "suffixOut": "くる", "conditionsIn": ["past"], "conditionsOut": ["vk"]}, - {"suffixIn": "来た", "suffixOut": "来る", "conditionsIn": ["past"], "conditionsOut": ["vk"]}, - {"suffixIn": "來た", "suffixOut": "來る", "conditionsIn": ["past"], "conditionsOut": ["vk"]}, - {"suffixIn": "いった", "suffixOut": "いく", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "おうた", "suffixOut": "おう", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "こうた", "suffixOut": "こう", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "そうた", "suffixOut": "そう", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "とうた", "suffixOut": "とう", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "行った", "suffixOut": "行く", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "逝った", "suffixOut": "逝く", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "往った", "suffixOut": "往く", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "請うた", "suffixOut": "請う", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "乞うた", "suffixOut": "乞う", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "恋うた", "suffixOut": "恋う", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "問うた", "suffixOut": "問う", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "負うた", "suffixOut": "負う", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "沿うた", "suffixOut": "沿う", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "添うた", "suffixOut": "添う", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "副うた", "suffixOut": "副う", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "厭うた", "suffixOut": "厭う", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "のたもうた", "suffixOut": "のたまう", "conditionsIn": ["past"], "conditionsOut": ["v5"]}, - {"suffixIn": "ました", "suffixOut": "ます", "conditionsIn": ["past"], "conditionsOut": ["v"]}, - {"suffixIn": "ませんでした", "suffixOut": "ません", "conditionsIn": ["past"], "conditionsOut": ["v"]} - ] - }, - { - "name": "polite", - "rules": [ - {"suffixIn": "ます", "suffixOut": "る", "conditionsIn": ["v1"], "conditionsOut": ["v1"]}, - {"suffixIn": "います", "suffixOut": "う", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "きます", "suffixOut": "く", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "ぎます", "suffixOut": "ぐ", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "します", "suffixOut": "す", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "ちます", "suffixOut": "つ", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "にます", "suffixOut": "ぬ", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "びます", "suffixOut": "ぶ", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "みます", "suffixOut": "む", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "ります", "suffixOut": "る", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "じます", "suffixOut": "ずる", "conditionsIn": ["vz"], "conditionsOut": ["vz"]}, - {"suffixIn": "します", "suffixOut": "する", "conditionsIn": ["vs"], "conditionsOut": ["vs"]}, - {"suffixIn": "為ます", "suffixOut": "為る", "conditionsIn": ["vs"], "conditionsOut": ["vs"]}, - {"suffixIn": "きます", "suffixOut": "くる", "conditionsIn": ["vk"], "conditionsOut": ["vk"]}, - {"suffixIn": "来ます", "suffixOut": "来る", "conditionsIn": ["vk"], "conditionsOut": ["vk"]}, - {"suffixIn": "來ます", "suffixOut": "來る", "conditionsIn": ["vk"], "conditionsOut": ["vk"]}, - {"suffixIn": "くあります", "suffixOut": "い", "conditionsIn": ["v"], "conditionsOut": ["adj-i"]} - ] - }, - { - "name": "potential", - "rules": [ - {"suffixIn": "れる", "suffixOut": "る", "conditionsIn": ["v1"], "conditionsOut": ["v1", "v5"]}, - {"suffixIn": "える", "suffixOut": "う", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "ける", "suffixOut": "く", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "げる", "suffixOut": "ぐ", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "せる", "suffixOut": "す", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "てる", "suffixOut": "つ", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "ねる", "suffixOut": "ぬ", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "べる", "suffixOut": "ぶ", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "める", "suffixOut": "む", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "できる", "suffixOut": "する", "conditionsIn": ["v1"], "conditionsOut": ["vs"]}, - {"suffixIn": "出来る", "suffixOut": "する", "conditionsIn": ["v1"], "conditionsOut": ["vs"]}, - {"suffixIn": "これる", "suffixOut": "くる", "conditionsIn": ["v1"], "conditionsOut": ["vk"]}, - {"suffixIn": "来れる", "suffixOut": "来る", "conditionsIn": ["v1"], "conditionsOut": ["vk"]}, - {"suffixIn": "來れる", "suffixOut": "來る", "conditionsIn": ["v1"], "conditionsOut": ["vk"]} - ] - }, - { - "name": "potential or passive", - "rules": [ - {"suffixIn": "られる", "suffixOut": "る", "conditionsIn": ["v1"], "conditionsOut": ["v1"]}, - {"suffixIn": "ざれる", "suffixOut": "ずる", "conditionsIn": ["v1"], "conditionsOut": ["vz"]}, - {"suffixIn": "ぜられる", "suffixOut": "ずる", "conditionsIn": ["v1"], "conditionsOut": ["vz"]}, - {"suffixIn": "せられる", "suffixOut": "する", "conditionsIn": ["v1"], "conditionsOut": ["vs"]}, - {"suffixIn": "為られる", "suffixOut": "為る", "conditionsIn": ["v1"], "conditionsOut": ["vs"]}, - {"suffixIn": "こられる", "suffixOut": "くる", "conditionsIn": ["v1"], "conditionsOut": ["vk"]}, - {"suffixIn": "来られる", "suffixOut": "来る", "conditionsIn": ["v1"], "conditionsOut": ["vk"]}, - {"suffixIn": "來られる", "suffixOut": "來る", "conditionsIn": ["v1"], "conditionsOut": ["vk"]} - ] - }, - { - "name": "volitional", - "rules": [ - {"suffixIn": "よう", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v1"]}, - {"suffixIn": "おう", "suffixOut": "う", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "こう", "suffixOut": "く", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ごう", "suffixOut": "ぐ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "そう", "suffixOut": "す", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "とう", "suffixOut": "つ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "のう", "suffixOut": "ぬ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ぼう", "suffixOut": "ぶ", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "もう", "suffixOut": "む", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "ろう", "suffixOut": "る", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "じよう", "suffixOut": "ずる", "conditionsIn": [], "conditionsOut": ["vz"]}, - {"suffixIn": "しよう", "suffixOut": "する", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "為よう", "suffixOut": "為る", "conditionsIn": [], "conditionsOut": ["vs"]}, - {"suffixIn": "こよう", "suffixOut": "くる", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "来よう", "suffixOut": "来る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "來よう", "suffixOut": "來る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "ましょう", "suffixOut": "ます", "conditionsIn": [], "conditionsOut": ["v"]} - ] - }, - { - "name": "causative passive", - "rules": [ - {"suffixIn": "かされる", "suffixOut": "く", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "がされる", "suffixOut": "ぐ", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "たされる", "suffixOut": "つ", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "なされる", "suffixOut": "ぬ", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "ばされる", "suffixOut": "ぶ", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "まされる", "suffixOut": "む", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "らされる", "suffixOut": "る", "conditionsIn": ["v1"], "conditionsOut": ["v5"]}, - {"suffixIn": "わされる", "suffixOut": "う", "conditionsIn": ["v1"], "conditionsOut": ["v5"]} - ] - }, - { - "name": "-toku", - "rules": [ - {"suffixIn": "とく", "suffixOut": "る", "conditionsIn": ["v5"], "conditionsOut": ["v1"]}, - {"suffixIn": "いとく", "suffixOut": "く", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "いどく", "suffixOut": "ぐ", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "しとく", "suffixOut": "す", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "っとく", "suffixOut": "う", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "っとく", "suffixOut": "つ", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "っとく", "suffixOut": "る", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "んどく", "suffixOut": "ぬ", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "んどく", "suffixOut": "ぶ", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "んどく", "suffixOut": "む", "conditionsIn": ["v5"], "conditionsOut": ["v5"]}, - {"suffixIn": "じとく", "suffixOut": "ずる", "conditionsIn": ["v5"], "conditionsOut": ["vz"]}, - {"suffixIn": "しとく", "suffixOut": "する", "conditionsIn": ["v5"], "conditionsOut": ["vs"]}, - {"suffixIn": "為とく", "suffixOut": "為る", "conditionsIn": ["v5"], "conditionsOut": ["vs"]}, - {"suffixIn": "きとく", "suffixOut": "くる", "conditionsIn": ["v5"], "conditionsOut": ["vk"]}, - {"suffixIn": "来とく", "suffixOut": "来る", "conditionsIn": ["v5"], "conditionsOut": ["vk"]}, - {"suffixIn": "來とく", "suffixOut": "來る", "conditionsIn": ["v5"], "conditionsOut": ["vk"]} - ] - }, - { - "name": "progressive or perfect", - "rules": [ - {"suffixIn": "ている", "suffixOut": "て", "conditionsIn": ["v1"], "conditionsOut": ["-te"]}, - {"suffixIn": "ておる", "suffixOut": "て", "conditionsIn": ["v5"], "conditionsOut": ["-te"]}, - {"suffixIn": "てる", "suffixOut": "て", "conditionsIn": ["v1p"], "conditionsOut": ["-te"]}, - {"suffixIn": "でいる", "suffixOut": "で", "conditionsIn": ["v1"], "conditionsOut": ["-te"]}, - {"suffixIn": "でおる", "suffixOut": "で", "conditionsIn": ["v5"], "conditionsOut": ["-te"]}, - {"suffixIn": "でる", "suffixOut": "で", "conditionsIn": ["v1p"], "conditionsOut": ["-te"]}, - {"suffixIn": "とる", "suffixOut": "て", "conditionsIn": ["v5"], "conditionsOut": ["-te"]}, - {"suffixIn": "ないでいる", "suffixOut": "ない", "conditionsIn": ["v1"], "conditionsOut": ["adj-i"]} - ] - }, - { - "name": "-ki", - "rules": [ - {"suffixIn": "き", "suffixOut": "い", "conditionsIn": [], "conditionsOut": ["adj-i"]} - ] - }, - { - "name": "-ge", - "rules": [ - {"suffixIn": "しげ", "suffixOut": "しい", "conditionsIn": [], "conditionsOut": ["adj-i"]} - ] - }, - { - "name": "-e", - "rules": [ - {"suffixIn": "ねえ", "suffixOut": "ない", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "めえ", "suffixOut": "むい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "みい", "suffixOut": "むい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "ちぇえ", "suffixOut": "つい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "ちい", "suffixOut": "つい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "せえ", "suffixOut": "すい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "ええ", "suffixOut": "いい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "ええ", "suffixOut": "わい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "ええ", "suffixOut": "よい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "いぇえ", "suffixOut": "よい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "うぇえ", "suffixOut": "わい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "けえ", "suffixOut": "かい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "げえ", "suffixOut": "がい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "げえ", "suffixOut": "ごい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "せえ", "suffixOut": "さい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "めえ", "suffixOut": "まい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "ぜえ", "suffixOut": "ずい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "っぜえ", "suffixOut": "ずい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "れえ", "suffixOut": "らい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "れえ", "suffixOut": "らい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "ちぇえ", "suffixOut": "ちゃい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "でえ", "suffixOut": "どい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "れえ", "suffixOut": "れい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "べえ", "suffixOut": "ばい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "てえ", "suffixOut": "たい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "ねぇ", "suffixOut": "ない", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "めぇ", "suffixOut": "むい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "みぃ", "suffixOut": "むい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "ちぃ", "suffixOut": "つい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "せぇ", "suffixOut": "すい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "けぇ", "suffixOut": "かい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "げぇ", "suffixOut": "がい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "げぇ", "suffixOut": "ごい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "せぇ", "suffixOut": "さい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "めぇ", "suffixOut": "まい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "ぜぇ", "suffixOut": "ずい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "っぜぇ", "suffixOut": "ずい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "れぇ", "suffixOut": "らい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "でぇ", "suffixOut": "どい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "れぇ", "suffixOut": "れい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "べぇ", "suffixOut": "ばい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "てぇ", "suffixOut": "たい", "conditionsIn": [], "conditionsOut": ["adj-i"]} - ] - }, - { - "name": "slang", - "rules": [ - {"suffixIn": "てぇてぇ", "suffixOut": "とうとい", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "てぇてぇ", "suffixOut": "尊い", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "おなしゃす", "suffixOut": "おねがいします", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "おなしゃす", "suffixOut": "お願いします", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "あざす", "suffixOut": "ありがとうございます", "conditionsIn": [], "conditionsOut": ["v5"]}, - {"suffixIn": "さーせん", "suffixOut": "すみません", "conditionsIn": [], "conditionsOut": []}, - {"suffixIn": "神ってる", "suffixOut": "神がかっている", "conditionsIn": [], "conditionsOut": ["v1p"]}, - {"suffixIn": "じわる", "suffixOut": "じわじわ来る", "conditionsIn": [], "conditionsOut": ["vk"]}, - {"suffixIn": "おさしみ", "suffixOut": "おやすみ", "conditionsIn": [], "conditionsOut": []}, - {"suffixIn": "おやさい", "suffixOut": "おやすみ", "conditionsIn": [], "conditionsOut": []} - ] - }, - { - "name": "kansai-ben", - "description": "Negative form of kansai-ben verbs", - "rules": [ - {"suffixIn": "へん", "suffixOut": "ない", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "ひん", "suffixOut": "ない", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "せえへん", "suffixOut": "しない", "conditionsIn": [], "conditionsOut": ["adj-i"]}, - {"suffixIn": "へんかった", "suffixOut": "なかった", "conditionsIn": ["past"], "conditionsOut": ["past"]}, - {"suffixIn": "ひんかった", "suffixOut": "なかった", "conditionsIn": ["past"], "conditionsOut": ["past"]}, - {"suffixIn": "うてへん", "suffixOut": "ってない", "conditionsIn": [], "conditionsOut": ["adj-i"]} - ] - }, - { - "name": "kansai-ben", - "description": "-te form of kansai-ben verbs", - "rules": [ - {"suffixIn": "うて", "suffixOut": "って", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "おうて", "suffixOut": "あって", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "こうて", "suffixOut": "かって", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "ごうて", "suffixOut": "がって", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "そうて", "suffixOut": "さって", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "ぞうて", "suffixOut": "ざって", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "とうて", "suffixOut": "たって", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "どうて", "suffixOut": "だって", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "のうて", "suffixOut": "なって", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "ほうて", "suffixOut": "はって", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "ぼうて", "suffixOut": "ばって", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "もうて", "suffixOut": "まって", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "ろうて", "suffixOut": "らって", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "ようて", "suffixOut": "やって", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "ゆうて", "suffixOut": "いって", "conditionsIn": ["-te"], "conditionsOut": ["-te"]} - ] - }, - { - "name": "kansai-ben", - "description": "past form of kansai-ben terms", - "rules": [ - {"suffixIn": "うた", "suffixOut": "った", "conditionsIn": ["past"], "conditionsOut": ["past"]}, - {"suffixIn": "おうた", "suffixOut": "あった", "conditionsIn": ["past"], "conditionsOut": ["past"]}, - {"suffixIn": "こうた", "suffixOut": "かった", "conditionsIn": ["past"], "conditionsOut": ["past"]}, - {"suffixIn": "ごうた", "suffixOut": "がった", "conditionsIn": ["past"], "conditionsOut": ["past"]}, - {"suffixIn": "そうた", "suffixOut": "さった", "conditionsIn": ["past"], "conditionsOut": ["past"]}, - {"suffixIn": "ぞうた", "suffixOut": "ざった", "conditionsIn": ["past"], "conditionsOut": ["past"]}, - {"suffixIn": "とうた", "suffixOut": "たった", "conditionsIn": ["past"], "conditionsOut": ["past"]}, - {"suffixIn": "どうた", "suffixOut": "だった", "conditionsIn": ["past"], "conditionsOut": ["past"]}, - {"suffixIn": "のうた", "suffixOut": "なった", "conditionsIn": ["past"], "conditionsOut": ["past"]}, - {"suffixIn": "ほうた", "suffixOut": "はった", "conditionsIn": ["past"], "conditionsOut": ["past"]}, - {"suffixIn": "ぼうた", "suffixOut": "ばった", "conditionsIn": ["past"], "conditionsOut": ["past"]}, - {"suffixIn": "もうた", "suffixOut": "まった", "conditionsIn": ["past"], "conditionsOut": ["past"]}, - {"suffixIn": "ろうた", "suffixOut": "らった", "conditionsIn": ["past"], "conditionsOut": ["past"]}, - {"suffixIn": "ようた", "suffixOut": "やった", "conditionsIn": ["past"], "conditionsOut": ["past"]}, - {"suffixIn": "ゆうた", "suffixOut": "いった", "conditionsIn": ["past"], "conditionsOut": ["past"]} - ] - }, - { - "name": "kansai-ben", - "description": "-tara form of kansai-ben terms", - "rules": [ - {"suffixIn": "うたら", "suffixOut": "ったら", "conditionsIn": [], "conditionsOut": []}, - {"suffixIn": "おうたら", "suffixOut": "あったら", "conditionsIn": [], "conditionsOut": []}, - {"suffixIn": "こうたら", "suffixOut": "かったら", "conditionsIn": [], "conditionsOut": []}, - {"suffixIn": "ごうたら", "suffixOut": "がったら", "conditionsIn": [], "conditionsOut": []}, - {"suffixIn": "そうたら", "suffixOut": "さったら", "conditionsIn": [], "conditionsOut": []}, - {"suffixIn": "ぞうたら", "suffixOut": "ざったら", "conditionsIn": [], "conditionsOut": []}, - {"suffixIn": "とうたら", "suffixOut": "たったら", "conditionsIn": [], "conditionsOut": []}, - {"suffixIn": "どうたら", "suffixOut": "だったら", "conditionsIn": [], "conditionsOut": []}, - {"suffixIn": "のうたら", "suffixOut": "なったら", "conditionsIn": [], "conditionsOut": []}, - {"suffixIn": "ほうたら", "suffixOut": "はったら", "conditionsIn": [], "conditionsOut": []}, - {"suffixIn": "ぼうたら", "suffixOut": "ばったら", "conditionsIn": [], "conditionsOut": []}, - {"suffixIn": "もうたら", "suffixOut": "まったら", "conditionsIn": [], "conditionsOut": []}, - {"suffixIn": "ろうたら", "suffixOut": "らったら", "conditionsIn": [], "conditionsOut": []}, - {"suffixIn": "ようたら", "suffixOut": "やったら", "conditionsIn": [], "conditionsOut": []}, - {"suffixIn": "ゆうたら", "suffixOut": "いったら", "conditionsIn": [], "conditionsOut": []} - ] - }, - { - "name": "kansai-ben", - "description": "-ku stem of kansai-ben adjectives", - "rules": [ - {"suffixIn": "う", "suffixOut": "く", "conditionsIn": [], "conditionsOut": ["adv"]}, - {"suffixIn": "こう", "suffixOut": "かく", "conditionsIn": [], "conditionsOut": ["adv"]}, - {"suffixIn": "ごう", "suffixOut": "がく", "conditionsIn": [], "conditionsOut": ["adv"]}, - {"suffixIn": "そう", "suffixOut": "さく", "conditionsIn": [], "conditionsOut": ["adv"]}, - {"suffixIn": "とう", "suffixOut": "たく", "conditionsIn": [], "conditionsOut": ["adv"]}, - {"suffixIn": "のう", "suffixOut": "なく", "conditionsIn": [], "conditionsOut": ["adv"]}, - {"suffixIn": "ぼう", "suffixOut": "ばく", "conditionsIn": [], "conditionsOut": ["adv"]}, - {"suffixIn": "もう", "suffixOut": "まく", "conditionsIn": [], "conditionsOut": ["adv"]}, - {"suffixIn": "ろう", "suffixOut": "らく", "conditionsIn": [], "conditionsOut": ["adv"]}, - {"suffixIn": "よう", "suffixOut": "よく", "conditionsIn": [], "conditionsOut": ["adv"]}, - {"suffixIn": "しゅう", "suffixOut": "しく", "conditionsIn": [], "conditionsOut": ["adv"]} - ] - }, - { - "name": "kansai-ben", - "description": "-te form of kansai-ben adjectives", - "rules": [ - {"suffixIn": "うて", "suffixOut": "くて", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "こうて", "suffixOut": "かくて", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "ごうて", "suffixOut": "がくて", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "そうて", "suffixOut": "さくて", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "とうて", "suffixOut": "たくて", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "のうて", "suffixOut": "なくて", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "ぼうて", "suffixOut": "ばくて", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "もうて", "suffixOut": "まくて", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "ろうて", "suffixOut": "らくて", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "ようて", "suffixOut": "よくて", "conditionsIn": ["-te"], "conditionsOut": ["-te"]}, - {"suffixIn": "しゅうて", "suffixOut": "しくて", "conditionsIn": ["-te"], "conditionsOut": ["-te"]} - ] - }, - { - "name": "kansai-ben", - "description": "Negative form of kansai-ben adjectives", - "rules": [ - {"suffixIn": "うない", "suffixOut": "くない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]}, - {"suffixIn": "こうない", "suffixOut": "かくない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]}, - {"suffixIn": "ごうない", "suffixOut": "がくない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]}, - {"suffixIn": "そうない", "suffixOut": "さくない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]}, - {"suffixIn": "とうない", "suffixOut": "たくない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]}, - {"suffixIn": "のうない", "suffixOut": "なくない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]}, - {"suffixIn": "ぼうない", "suffixOut": "ばくない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]}, - {"suffixIn": "もうない", "suffixOut": "まくない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]}, - {"suffixIn": "ろうない", "suffixOut": "らくない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]}, - {"suffixIn": "ようない", "suffixOut": "よくない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]}, - {"suffixIn": "しゅうない", "suffixOut": "しくない", "conditionsIn": ["adj-i"], "conditionsOut": ["adj-i"]} - ] - } - ] -} diff --git a/ext/js/language/language-descriptors.js b/ext/js/language/language-descriptors.js index 6675f78e..b947649d 100644 --- a/ext/js/language/language-descriptors.js +++ b/ext/js/language/language-descriptors.js @@ -17,10 +17,13 @@ import {removeArabicScriptDiacritics} from './ar/arabic-text-preprocessors.js'; import {eszettPreprocessor} from './de/german-text-preprocessors.js'; +import {englishTransforms} from './en/english-transforms.js'; import {collapseEmphaticSequences, convertAlphabeticCharacters, convertHalfWidthCharacters, convertHiraganaToKatakana, convertNumericCharacters} from './ja/japanese-text-preprocessors.js'; +import {japaneseTransforms} from './ja/japanese-transforms.js'; import {isStringPartiallyJapanese} from './ja/japanese.js'; import {removeLatinDiacritics} from './la/latin-text-preprocessors.js'; import {removeRussianDiacritics, yoToE} from './ru/russian-text-preprocessors.js'; +import {albanianTransforms} from './sq/albanian-transforms.js'; import {capitalizeFirstLetter, decapitalize} from './text-preprocessors.js'; const capitalizationPreprocessors = { @@ -58,7 +61,7 @@ const languageDescriptors = [ name: 'English', exampleText: 'read', textPreprocessors: capitalizationPreprocessors, - languageTransformsFile: '/js/language/en/english-transforms.json' + languageTransforms: englishTransforms }, { iso: 'es', @@ -109,6 +112,7 @@ const languageDescriptors = [ name: 'Latin', exampleText: 'legere', textPreprocessors: { + ...capitalizationPreprocessors, removeLatinDiacritics } }, @@ -124,7 +128,7 @@ const languageDescriptors = [ convertHiraganaToKatakana, collapseEmphaticSequences }, - languageTransformsFile: '/js/language/ja/japanese-transforms.json' + languageTransforms: japaneseTransforms }, { iso: 'km', @@ -170,7 +174,8 @@ const languageDescriptors = [ iso: 'sq', name: 'Albanian', exampleText: 'ndihmojme', - textPreprocessors: capitalizationPreprocessors + textPreprocessors: capitalizationPreprocessors, + languageTransforms: albanianTransforms }, { iso: 'sv', diff --git a/ext/js/language/language-transformer.js b/ext/js/language/language-transformer.js index 8a82e4d2..47f31b5f 100644 --- a/ext/js/language/language-transformer.js +++ b/ext/js/language/language-transformer.js @@ -15,7 +15,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import {escapeRegExp} from '../core/utilities.js'; +import {log} from '../core/log.js'; export class LanguageTransformer { constructor() { @@ -55,21 +55,22 @@ export class LanguageTransformer { /** @type {import('language-transformer-internal').Rule[]} */ const rules2 = []; for (let j = 0, jj = rules.length; j < jj; ++j) { - const {suffixIn, suffixOut, conditionsIn, conditionsOut} = rules[j]; + const {type, isInflected, deinflect, conditionsIn, conditionsOut} = rules[j]; const conditionFlagsIn = this._getConditionFlagsStrict(conditionFlagsMap, conditionsIn); if (conditionFlagsIn === null) { throw new Error(`Invalid conditionsIn for transform[${i}].rules[${j}]`); } const conditionFlagsOut = this._getConditionFlagsStrict(conditionFlagsMap, conditionsOut); if (conditionFlagsOut === null) { throw new Error(`Invalid conditionsOut for transform[${i}].rules[${j}]`); } rules2.push({ - suffixIn, - suffixOut, + type, + isInflected, + deinflect, conditionsIn: conditionFlagsIn, conditionsOut: conditionFlagsOut }); } - const suffixes = rules.map((rule) => rule.suffixIn); - const suffixHeuristic = new RegExp(`(${suffixes.map((suffix) => escapeRegExp(suffix)).join('|')})$`); - transforms2.push({name, rules: rules2, suffixHeuristic}); + const isInflectedTests = rules.map((rule) => rule.isInflected); + const heuristic = new RegExp(isInflectedTests.map((regExp) => regExp.source).join('|')); + transforms2.push({name, rules: rules2, heuristic}); } this._nextFlagIndex = nextFlagIndex; @@ -120,18 +121,25 @@ export class LanguageTransformer { for (let i = 0; i < results.length; ++i) { const {text, conditions, trace} = results[i]; for (const transform of this._transforms) { - if (!transform.suffixHeuristic.test(text)) { continue; } + if (!transform.heuristic.test(text)) { continue; } const {name, rules} = transform; for (let j = 0, jj = rules.length; j < jj; ++j) { const rule = rules[j]; if (!LanguageTransformer.conditionsMatch(conditions, rule.conditionsIn)) { continue; } - const {suffixIn, suffixOut} = rule; - if (!text.endsWith(suffixIn) || (text.length - suffixIn.length + suffixOut.length) <= 0) { continue; } + const {isInflected, deinflect} = rule; + if (!isInflected.test(text)) { continue; } + + const isCycle = trace.some((frame) => frame.transform === name && frame.ruleIndex === j && frame.text === text); + if (isCycle) { + log.warn(new Error(`Cycle detected in transform[${name}] rule[${j}] for text: ${text}`)); + continue; + } + results.push(LanguageTransformer.createTransformedText( - text.substring(0, text.length - suffixIn.length) + suffixOut, + deinflect(text), rule.conditionsOut, - this._extendTrace(trace, {transform: name, ruleIndex: j}) + this._extendTrace(trace, {transform: name, ruleIndex: j, text}) )); } } @@ -245,8 +253,8 @@ export class LanguageTransformer { */ _extendTrace(trace, newFrame) { const newTrace = [newFrame]; - for (const {transform, ruleIndex} of trace) { - newTrace.push({transform, ruleIndex}); + for (const {transform, ruleIndex, text} of trace) { + newTrace.push({transform, ruleIndex, text}); } return newTrace; } diff --git a/ext/js/language/language-transforms.js b/ext/js/language/language-transforms.js new file mode 100644 index 00000000..ee8af88b --- /dev/null +++ b/ext/js/language/language-transforms.js @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2024 Yomitan Authors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + + +/** + * @param {string} inflectedSuffix + * @param {string} deinflectedSuffix + * @param {string[]} conditionsIn + * @param {string[]} conditionsOut + * @returns {import('language-transformer').SuffixRule} + */ +export function suffixInflection(inflectedSuffix, deinflectedSuffix, conditionsIn, conditionsOut) { + const suffixRegExp = new RegExp(inflectedSuffix + '$'); + return { + type: 'suffix', + isInflected: suffixRegExp, + deinflected: deinflectedSuffix, + deinflect: (text) => text.slice(0, -inflectedSuffix.length) + deinflectedSuffix, + conditionsIn, + conditionsOut + }; +} + +/** + * @param {string} inflectedPrefix + * @param {string} deinflectedPrefix + * @param {string[]} conditionsIn + * @param {string[]} conditionsOut + * @returns {import('language-transformer').Rule} + */ +export function prefixInflection(inflectedPrefix, deinflectedPrefix, conditionsIn, conditionsOut) { + const prefixRegExp = new RegExp('^' + inflectedPrefix); + return { + type: 'prefix', + isInflected: prefixRegExp, + deinflect: (text) => deinflectedPrefix + text.slice(inflectedPrefix.length), + conditionsIn, + conditionsOut + }; +} diff --git a/ext/js/language/languages.js b/ext/js/language/languages.js index 63bbc791..4b196c2c 100755 --- a/ext/js/language/languages.js +++ b/ext/js/language/languages.js @@ -22,8 +22,8 @@ import {languageDescriptorMap} from './language-descriptors.js'; */ export function getLanguageSummaries() { const results = []; - for (const {name, iso, exampleText, languageTransformsFile} of languageDescriptorMap.values()) { - results.push({name, iso, exampleText, languageTransformsFile}); + for (const {name, iso, exampleText} of languageDescriptorMap.values()) { + results.push({name, iso, exampleText}); } return results; } @@ -58,3 +58,16 @@ export function isTextLookupWorthy(text, language) { if (typeof descriptor === 'undefined') { return false; } return typeof descriptor.isTextLookupWorthy === 'undefined' || descriptor.isTextLookupWorthy(text); } + +/** + * @returns {import('language').LanguageAndTransforms[]} + */ +export function getAllLanguageTransformDescriptors() { + const results = []; + for (const {iso, languageTransforms} of languageDescriptorMap.values()) { + if (languageTransforms) { + results.push({iso, languageTransforms}); + } + } + return results; +} diff --git a/ext/js/language/multi-language-transformer.js b/ext/js/language/multi-language-transformer.js index 692e1718..4e85aa65 100644 --- a/ext/js/language/multi-language-transformer.js +++ b/ext/js/language/multi-language-transformer.js @@ -16,6 +16,7 @@ */ import {LanguageTransformer} from './language-transformer.js'; +import {getAllLanguageTransformDescriptors} from './languages.js'; export class MultiLanguageTransformer { constructor() { @@ -23,11 +24,10 @@ export class MultiLanguageTransformer { this._languageTransformers = new Map(); } - /** - * @param {import('language-transformer').LanguageTransformDescriptor[]} languageTransformDescriptors - */ - prepare(languageTransformDescriptors) { - for (const descriptor of languageTransformDescriptors) { + /** */ + prepare() { + const languagesWithTransforms = getAllLanguageTransformDescriptors(); + for (const {languageTransforms: descriptor} of languagesWithTransforms) { const languageTransformer = new LanguageTransformer(); languageTransformer.addDescriptor(descriptor); this._languageTransformers.set(descriptor.language, languageTransformer); diff --git a/ext/js/language/sq/albanian-transforms.js b/ext/js/language/sq/albanian-transforms.js new file mode 100644 index 00000000..16ce202d --- /dev/null +++ b/ext/js/language/sq/albanian-transforms.js @@ -0,0 +1,351 @@ +/* + * Copyright (C) 2024 Yomitan Authors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +import {suffixInflection} from '../language-transforms.js'; + +/** + * @param {string} inflectedSuffix + * @param {string} deinflectedSuffix + * @param {string[]} conditionsIn + * @param {string[]} conditionsOut + * @returns {import('language-transformer').Rule} + */ +function conjugationIISuffixInflection(inflectedSuffix, deinflectedSuffix, conditionsIn, conditionsOut) { + return { + ...suffixInflection(inflectedSuffix, deinflectedSuffix, conditionsIn, conditionsOut), + type: 'other', + isInflected: new RegExp('.*[^j]' + inflectedSuffix + '$') + }; +} + +/** @type {import('language-transformer').LanguageTransformDescriptor} */ +export const albanianTransforms = { + language: 'sq', + conditions: { + v: { + name: 'Verb', + isDictionaryForm: true + }, + n: { + name: 'Noun', + isDictionaryForm: true, + subConditions: ['np', 'ns'] + }, + np: { + name: 'Noun plural', + isDictionaryForm: true + }, + ns: { + name: 'Noun singular', + isDictionaryForm: true + }, + adj: { + name: 'Adjective', + isDictionaryForm: true + }, + adv: { + name: 'Adverb', + isDictionaryForm: true + } + }, + transforms: [ + // Nouns + { + name: 'definite', + description: 'Definite form of a noun', + rules: [ + // Masculine + suffixInflection('ku', 'k', [], ['n']), + suffixInflection('gu', 'g', [], ['n']), + suffixInflection('hu', 'h', [], ['n']), + suffixInflection('au', 'a', [], ['n']), + suffixInflection('iu', 'i', [], ['n']), + suffixInflection('eu', 'e', [], ['n']), + suffixInflection('i', 'ë', [], ['n']), + suffixInflection('i', '', [], ['n']), + suffixInflection('ri', '', [], ['n']), + suffixInflection('oi', 'ua', [], ['n']), + // Feminine + suffixInflection('a', 'ë', [], ['n']), + suffixInflection('a', '', [], ['n']), + suffixInflection('ja', 'e', [], ['n']) + ] + }, + { + name: 'singular definite accusative', + description: 'Singular definite accusative form of a noun', + rules: [ + suffixInflection('n', '', [], ['n']) + ] + }, + { + name: 'plural', + description: 'Plural form of a noun', + rules: [ + suffixInflection('e', '', ['np'], ['ns']), + suffixInflection('t', '', ['np'], ['ns']) // Pijet + ] + }, + // Verbs + { + name: 'present indicative second-person singular', + description: 'Present indicative second-person singular form of a verb', + rules: [ + suffixInflection('on', 'oj', [], ['v']), + suffixInflection('uan', 'uaj', [], ['v']), + suffixInflection('n', 'j', [], ['v']), // Fshin + suffixInflection('hesh', 'hem', [], ['v']) + ] + }, + { + name: 'present indicative third-person singular', + description: 'Present indicative third-person singular form of a verb', + rules: [ + suffixInflection('on', 'oj', [], ['v']), + suffixInflection('uan', 'uaj', [], ['v']), + suffixInflection('n', 'j', [], ['v']), // Fshin + suffixInflection('het', 'hem', [], ['v']) + ] + }, + { + name: 'present indicative first-person plural', + description: 'Present indicative first-person plural form of a verb', + rules: [ + suffixInflection('më', '', [], ['v']), // Ndihmojmë, paguajmë, fshijmë + suffixInflection('im', '', [], ['v']), // Vendosim, hapim + suffixInflection('hemi', 'hem', [], ['v']) + ] + }, + { + name: 'present indicative second-person plural', + description: 'Present indicative second-person plural form of a verb', + rules: [ + suffixInflection('ni', 'j', [], ['v']), // Ndihmoni, paguani, fshini + suffixInflection('ni', '', [], ['v']), // Vendosni, hapni + suffixInflection('heni', 'hem', [], ['v']) + ] + }, + { + name: 'present indicative third-person plural', + description: 'Present indicative third-person plural form of a verb', + rules: [ + suffixInflection('në', '', [], ['v']), // Ndihmojnë, paguajnë, fshijnë + suffixInflection('in', '', [], ['v']), // Vendosin, hapin + suffixInflection('hen', 'hem', [], ['v']) + ] + }, + { + name: 'imperfect first-person singular indicative', + description: 'Imperfect first-person singular indicative form of a verb', + rules: [ + suffixInflection('ja', 'j', [], ['v']), // Ndihmoja, paguaja, fshija + suffixInflection('ja', '', [], ['v']), // Vendosja, hapja + suffixInflection('hesha', 'hem', [], ['v']) + ] + }, + { + name: 'imperfect second-person singular indicative', + description: 'Imperfect second-person singular indicative form of a verb', + rules: [ + suffixInflection('je', 'j', [], ['v']), // Ndihmoje, paguaje, fshije + suffixInflection('je', '', [], ['v']), // Vendosje, hapje + suffixInflection('heshe', 'hem', [], ['v']) + ] + }, + { + name: 'imperfect third-person singular indicative', + description: 'Imperfect third-person singular indicative form of a verb', + rules: [ + suffixInflection('nte', 'j', [], ['v']), // Ndihmonte, paguante, fshinte + suffixInflection('te', '', [], ['v']), // Vendoste, hapte + suffixInflection('hej', 'hem', [], ['v']) + ] + }, + { + name: 'imperfect first-person plural indicative', + description: 'Imperfect first-person plural indicative form of a verb', + rules: [ + suffixInflection('nim', 'j', [], ['v']), // Ndihmonim, paguanim, fshinim + suffixInflection('nim', '', [], ['v']), // Vendosnim, hapnim + suffixInflection('heshim', 'hem', [], ['v']) + ] + }, + { + name: 'imperfect second-person plural indicative', + description: 'Imperfect second-person plural indicative form of a verb', + rules: [ + suffixInflection('nit', 'j', [], ['v']), // Ndihmonit, paguanit, fshinit + suffixInflection('nit', '', [], ['v']), // Vendosnit, hapnit + suffixInflection('heshit', 'hem', [], ['v']) + ] + }, + { + name: 'imperfect third-person plural indicative', + description: 'Imperfect third-person plural indicative form of a verb', + rules: [ + suffixInflection('nin', 'j', [], ['v']), // Ndihmonin, paguanin, fshinin + suffixInflection('nin', '', [], ['v']), // Vendosnin, hapnin + suffixInflection('heshin', 'hem', [], ['v']) + ] + }, + { + name: 'aorist first-person singular indicative', + description: 'Aorist first-person singular indicative form of a verb', + rules: [ + suffixInflection('ova', 'uaj', [], ['v']), // Pagova + suffixInflection('va', 'j', [], ['v']), // Ndihmova, fshiva + conjugationIISuffixInflection('a', '', [], ['v']) // Vendosa, hapa + ] + }, + { + name: 'aorist second-person singular indicative', + description: 'Aorist second-person singular indicative form of a verb', + rules: [ + suffixInflection('ove', 'uaj', [], ['v']), // Pagove + suffixInflection('ve', 'j', [], ['v']), // Ndihmove, fshive + conjugationIISuffixInflection('e', '', [], ['v']) // Vendose, hape + ] + }, + { + name: 'aorist third-person singular indicative', + description: 'Aorist third-person singular indicative form of a verb', + rules: [ + suffixInflection('oi', 'oj', [], ['v']), // Ndihmoi + suffixInflection('oi', 'uaj', [], ['v']), // Pagoi + suffixInflection('u', 'j', [], ['v']), // Fshiu + conjugationIISuffixInflection('i', '', [], ['v']) // Vendosi, hapi + ] + }, + { + name: 'aorist first-person plural indicative', + description: 'Aorist first-person plural indicative form of a verb', + rules: [ + suffixInflection('uam', 'oj', [], ['v']), // Ndihmuam + suffixInflection('uam', 'uaj', [], ['v']), // Paguam + suffixInflection('më', 'j', [], ['v']), // Fshimë + conjugationIISuffixInflection('ëm', '', [], ['v']) // Vendosëm, hapëm + ] + }, + { + name: 'aorist second-person plural indicative', + description: 'Aorist second-person plural indicative form of a verb', + rules: [ + suffixInflection('uat', 'oj', [], ['v']), // Ndihmuat + suffixInflection('uat', 'uaj', [], ['v']), // Paguat + suffixInflection('të', 'j', [], ['v']), // Fshitë + conjugationIISuffixInflection('ët', '', [], ['v']) // Vendosët, hapët + ] + }, + { + name: 'aorist third-person plural indicative', + description: 'Aorist third-person plural indicative form of a verb', + rules: [ + suffixInflection('uan', 'oj', [], ['v']), // Ndihmuan + suffixInflection('uan', 'uaj', [], ['v']), // Paguan + suffixInflection('në', 'j', [], ['v']), // Fshinë + suffixInflection('ye', 'ej', [], ['v']), // U kthye ? + conjugationIISuffixInflection('ën', '', [], ['v']) // Vendosën, hapën + ] + }, + { + name: 'imperative second-person singular present', + description: 'Imperative second-person singular present form of a verb', + rules: [ + suffixInflection('o', 'oj', [], ['v']), + suffixInflection('hu', 'hem', [], ['v']) // Kujtohu + ] + }, + { + name: 'imperative second-person plural present', + description: 'Imperative second-person plural present form of a verb', + rules: [ + suffixInflection('ni', 'j', [], ['v']), // Ndihmoni, paguani, fshini + suffixInflection('ni', '', [], ['v']), // Vendosni, hapni + suffixInflection('huni', 'hem', [], ['v']) // Kujtohuni + ] + }, + { + name: 'participle', + description: 'Participle form of a verb', + rules: [ + suffixInflection('uar', 'oj', [], ['v']), + suffixInflection('ur', '', [], ['v']), + suffixInflection('rë', 'j', [], ['v']), // Fshirë, + suffixInflection('yer', 'ej', [], ['v']) // Shkëlqyer + ] + }, + { + name: 'mediopassive', + description: 'Mediopassive form of a verb', + rules: [ + suffixInflection('hem', 'h', ['v'], ['v']), + suffixInflection('hem', 'j', ['v'], ['v']) + ] + }, + { + name: 'optative first-person singular present', + description: 'Optative first-person singular present form of a verb', + rules: [ + suffixInflection('fsha', 'j', [], ['v']) // Ndihmofsha + ] + }, + { + name: 'optative second-person singular present', + description: 'Optative second-person singular present form of a verb', + rules: [ + suffixInflection('fsh', 'j', [], ['v']) // Ndihmofsh + ] + }, + { + name: 'optative third-person singular present', + description: 'Optative third-person singular present form of a verb', + rules: [ + suffixInflection('ftë', 'j', [], ['v']) // Ndihmoftë + ] + }, + { + name: 'optative first-person plural present', + description: 'Optative first-person plural present form of a verb', + rules: [ + suffixInflection('fshim', 'j', [], ['v']) // Ndihmofshim + ] + }, + { + name: 'optative second-person plural present', + description: 'Optative second-person plural present form of a verb', + rules: [ + suffixInflection('fshi', 'j', [], ['v']) // Ndihmofshi + ] + }, + { + name: 'optative third-person plural present', + description: 'Optative third-person plural present form of a verb', + rules: [ + suffixInflection('fshin', 'j', [], ['v']) // Ndihmofshin + ] + }, + { + name: 'noun', + description: 'Noun form of a verb', + rules: [ + suffixInflection('im', 'oj', [], ['v']), // Gëzim, zbulim + suffixInflection('im', 'ej', [], ['v']), // Përkthim + suffixInflection('je', '', [], ['v']) // Lëvizje + ] + } + ] +}; diff --git a/ext/js/language/translator.js b/ext/js/language/translator.js index 04319e60..af275c07 100644 --- a/ext/js/language/translator.js +++ b/ext/js/language/translator.js @@ -47,10 +47,9 @@ export class Translator { /** * Initializes the instance for use. The public API should not be used until this function has been called. - * @param {import('language-transformer').LanguageTransformDescriptor[]} languageTransformDescriptors */ - prepare(languageTransformDescriptors) { - this._multiLanguageTransformer.prepare(languageTransformDescriptors); + prepare() { + this._multiLanguageTransformer.prepare(); for (const {iso, textPreprocessors} of getAllLanguageTextPreprocessors()) { /** @type {Map<string, import('language').TextPreprocessorOptions<unknown>>} */ const optionSpace = new Map(); diff --git a/test/data/json.json b/test/data/json.json index 16ca6f01..73709fd5 100644 --- a/test/data/json.json +++ b/test/data/json.json @@ -93,16 +93,6 @@ "type": "AjvSchema" }, { - "path": "ext/js/language/ja/japanese-transforms.json", - "typeFile": "types/ext/language-transformer.d.ts", - "type": "LanguageTransformDescriptor" - }, - { - "path": "ext/js/language/en/english-transforms.json", - "typeFile": "types/ext/language-transformer.d.ts", - "type": "LanguageTransformDescriptor" - }, - { "path": "test/data/translator-test-inputs.json", "typeFile": "types/test/translator.d.ts", "type": "TranslatorTestInputs", diff --git a/test/fixtures/translator-test.js b/test/fixtures/translator-test.js index 6b6eaad8..9f1e87df 100644 --- a/test/fixtures/translator-test.js +++ b/test/fixtures/translator-test.js @@ -17,12 +17,8 @@ */ import {IDBKeyRange, indexedDB} from 'fake-indexeddb'; -import {readFileSync} from 'fs'; -import {fileURLToPath} from 'node:url'; -import {dirname, join} from 'path'; import {expect, vi} from 'vitest'; import {createDictionaryArchiveData} from '../../dev/dictionary-archive-util.js'; -import {parseJson} from '../../dev/json.js'; import {DictionaryDatabase} from '../../ext/js/dictionary/dictionary-database.js'; import {DictionaryImporter} from '../../ext/js/dictionary/dictionary-importer.js'; import {Translator} from '../../ext/js/language/translator.js'; @@ -30,9 +26,6 @@ import {chrome, fetch} from '../mocks/common.js'; import {DictionaryImporterMediaLoader} from '../mocks/dictionary-importer-media-loader.js'; import {createDomTest} from './dom-test.js'; -const extDir = join(dirname(fileURLToPath(import.meta.url)), '../../ext'); -const languageTransformDescriptorPath = join(extDir, 'js/language/ja/japanese-transforms.json'); - vi.stubGlobal('indexedDB', indexedDB); vi.stubGlobal('IDBKeyRange', IDBKeyRange); vi.stubGlobal('fetch', fetch); @@ -63,9 +56,7 @@ export async function createTranslatorContext(dictionaryDirectory, dictionaryNam // Setup translator const translator = new Translator(dictionaryDatabase); - /** @type {import('language-transformer').LanguageTransformDescriptor} */ - const deinflectionReasons = parseJson(readFileSync(languageTransformDescriptorPath, {encoding: 'utf8'})); - translator.prepare([deinflectionReasons]); + translator.prepare(); return translator; } diff --git a/test/language-transformer-cycles.test.js b/test/language-transformer-cycles.test.js index 751f65a6..ab14eaa4 100644 --- a/test/language-transformer-cycles.test.js +++ b/test/language-transformer-cycles.test.js @@ -15,13 +15,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import {readFileSync} from 'fs'; -import {join, dirname as pathDirname} from 'path'; -import {fileURLToPath} from 'url'; import {describe, test} from 'vitest'; -import {parseJson} from '../dev/json.js'; import {LanguageTransformer} from '../ext/js/language/language-transformer.js'; -import {getLanguageSummaries} from '../ext/js/language/languages.js'; +import {getAllLanguageTransformDescriptors} from '../ext/js/language/languages.js'; class DeinflectionNode { /** @@ -80,12 +76,12 @@ class DeinflectionNode { class RuleNode { /** * @param {string} groupName - * @param {import('language-transformer').Rule} rule + * @param {import('language-transformer').SuffixRule} rule */ constructor(groupName, rule) { /** @type {string} */ this.groupName = groupName; - /** @type {import('language-transformer').Rule} */ + /** @type {import('language-transformer').SuffixRule} */ this.rule = rule; } } @@ -104,39 +100,36 @@ function arraysAreEqual(rules1, rules2) { return true; } -const dirname = pathDirname(fileURLToPath(import.meta.url)); -const descriptors = []; -const languageSummaries = getLanguageSummaries(); -for (const {languageTransformsFile} of languageSummaries) { - if (!languageTransformsFile) { continue; } - /** @type {import('language-transformer').LanguageTransformDescriptor} */ - const descriptor = parseJson(readFileSync(join(dirname, `../ext/${languageTransformsFile}`), {encoding: 'utf8'})); - descriptors.push(descriptor); -} +const languagesWithTransforms = getAllLanguageTransformDescriptors(); -describe.each(descriptors)('Cycles Test $language', (descriptor) => { +describe.each(languagesWithTransforms)('Cycles Test $iso', ({languageTransforms}) => { test('Check for cycles', ({expect}) => { const languageTransformer = new LanguageTransformer(); - languageTransformer.addDescriptor(descriptor); + languageTransformer.addDescriptor(languageTransforms); /** @type {RuleNode[]} */ const ruleNodes = []; - for (const [groupName, reasonInfo] of Object.entries(descriptor.transforms)) { + for (const [groupName, reasonInfo] of Object.entries(languageTransforms.transforms)) { for (const rule of reasonInfo.rules) { - ruleNodes.push(new RuleNode(groupName, rule)); + if (rule.type === 'suffix') { + ruleNodes.push(new RuleNode(groupName, /** @type {import('language-transformer').SuffixRule}*/ (rule))); + } } } /** @type {DeinflectionNode[]} */ const deinflectionNodes = []; - for (const ruleNode of ruleNodes) { - deinflectionNodes.push(new DeinflectionNode(`?${ruleNode.rule.suffixIn}`, [], null, null)); + for (const {rule: {isInflected}} of ruleNodes) { + const suffixIn = isInflected.source.substring(0, isInflected.source.length - 1); + deinflectionNodes.push(new DeinflectionNode(`?${suffixIn}`, [], null, null)); } + for (let i = 0; i < deinflectionNodes.length; ++i) { const deinflectionNode = deinflectionNodes[i]; const {text, ruleNames} = deinflectionNode; for (const ruleNode of ruleNodes) { - const {suffixIn, suffixOut, conditionsIn, conditionsOut} = ruleNode.rule; + const {isInflected, deinflected: suffixOut, conditionsIn, conditionsOut} = ruleNode.rule; + const suffixIn = isInflected.source.substring(0, isInflected.source.length - 1); if ( !LanguageTransformer.conditionsMatch( languageTransformer.getConditionFlagsFromConditionTypes(ruleNames), @@ -158,12 +151,14 @@ describe.each(descriptors)('Cycles Test $language', (descriptor) => { // Cycle check if (deinflectionNode.historyIncludes(newDeinflectionNode)) { const stack = []; - for (const item of newDeinflectionNode.getHistory()) { - stack.push( - item.ruleNode === null ? - `${item.text} (start)` : - `${item.text} (${item.ruleNode.groupName}, ${item.ruleNode.rule.conditionsIn.join(',')}=>${item.ruleNode.rule.conditionsOut.join(',')}, ${item.ruleNode.rule.suffixIn}=>${item.ruleNode.rule.suffixOut})` - ); + for (const {text: itemText, ruleNode: itemNode} of newDeinflectionNode.getHistory()) { + if (itemNode !== null) { + const itemSuffixIn = itemNode.rule.isInflected.source.substring(0, itemNode.rule.isInflected.source.length - 1); + const itemSuffixOut = itemNode.rule.deinflected; + stack.push(`${itemText} (${itemNode.groupName}, ${itemNode.rule.conditionsIn.join(',')}=>${itemNode.rule.conditionsOut.join(',')}, ${itemSuffixIn}=>${itemSuffixOut})`); + } else { + stack.push(`${itemText} (start)`); + } } const message = `Cycle detected:\n ${stack.join('\n ')}`; expect.soft(true, message).toEqual(false); diff --git a/test/language-transformer.test.js b/test/language-transformer.test.js index 16f044c3..6e6de0a0 100644 --- a/test/language-transformer.test.js +++ b/test/language-transformer.test.js @@ -16,15 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import fs from 'fs'; -import {fileURLToPath} from 'node:url'; -import path from 'path'; import {describe, expect, test} from 'vitest'; -import {parseJson} from '../dev/json.js'; +import {japaneseTransforms} from '../ext/js/language/ja/japanese-transforms.js'; import {LanguageTransformer} from '../ext/js/language/language-transformer.js'; -const dirname = path.dirname(fileURLToPath(import.meta.url)); - /** * @param {LanguageTransformer} languageTransformer * @param {string} source @@ -1146,10 +1141,8 @@ describe('LanguageTransformer', () => { ]; /* eslint-enable @stylistic/no-multi-spaces */ - /** @type {import('language-transformer').LanguageTransformDescriptor} */ - const descriptor = parseJson(fs.readFileSync(path.join(dirname, '..', 'ext', 'js/language/ja/japanese-transforms.json'), {encoding: 'utf8'})); const languageTransformer = new LanguageTransformer(); - languageTransformer.addDescriptor(descriptor); + languageTransformer.addDescriptor(japaneseTransforms); describe('deinflections', () => { describe.each(data)('$category', ({valid, tests}) => { diff --git a/types/ext/language-descriptors.d.ts b/types/ext/language-descriptors.d.ts index 79668da4..c85b5fc0 100644 --- a/types/ext/language-descriptors.d.ts +++ b/types/ext/language-descriptors.d.ts @@ -16,6 +16,7 @@ */ import type {TextPreprocessor, BidirectionalConversionPreprocessor} from './language'; +import type {LanguageTransformDescriptor} from './language-transformer'; import type {SafeAny} from './core'; export type IsTextLookupWorthyFunction = (text: string) => boolean; @@ -32,7 +33,7 @@ type LanguageDescriptor<TIso extends string, TTextPreprocessorDescriptor extends */ isTextLookupWorthy?: IsTextLookupWorthyFunction; textPreprocessors: TTextPreprocessorDescriptor; - languageTransformsFile?: string; + languageTransforms?: LanguageTransformDescriptor; }; type TextPreprocessorDescriptor = { @@ -72,7 +73,7 @@ type AllTextPreprocessors = { hu: CapitalizationPreprocessors; id: CapitalizationPreprocessors; it: CapitalizationPreprocessors; - la: { + la: CapitalizationPreprocessors & { removeLatinDiacritics: TextPreprocessor<boolean>; }; ja: { diff --git a/types/ext/language-transformer-internal.d.ts b/types/ext/language-transformer-internal.d.ts index fdabc0fb..9ae412d3 100644 --- a/types/ext/language-transformer-internal.d.ts +++ b/types/ext/language-transformer-internal.d.ts @@ -18,12 +18,13 @@ export type Transform = { name: string; rules: Rule[]; - suffixHeuristic: RegExp; + heuristic: RegExp; }; export type Rule = { - suffixIn: string; - suffixOut: string; + type: 'suffix' | 'prefix' | 'other'; + isInflected: RegExp; + deinflect: (inflectedWord: string) => string; conditionsIn: number; conditionsOut: number; }; @@ -37,6 +38,7 @@ export type TransformedText = { export type Trace = TraceFrame[]; export type TraceFrame = { + text: string; transform: string; ruleIndex: number; }; diff --git a/types/ext/language-transformer.d.ts b/types/ext/language-transformer.d.ts index 88dce0b5..95da602d 100644 --- a/types/ext/language-transformer.d.ts +++ b/types/ext/language-transformer.d.ts @@ -55,8 +55,18 @@ export type TransformI18n = { }; export type Rule = { - suffixIn: string; - suffixOut: string; + type: 'suffix' | 'prefix' | 'other'; + isInflected: RegExp; + deinflect: (inflectedWord: string) => string; + conditionsIn: string[]; + conditionsOut: string[]; +}; + +export type SuffixRule = { + type: 'suffix'; + isInflected: RegExp; + deinflected: string; + deinflect: (inflectedWord: string) => string; conditionsIn: string[]; conditionsOut: string[]; }; diff --git a/types/ext/language.d.ts b/types/ext/language.d.ts index a50d3d4b..8fa6f0e7 100644 --- a/types/ext/language.d.ts +++ b/types/ext/language.d.ts @@ -16,6 +16,7 @@ */ import type {TextSourceMap} from '../../ext/js/general/text-source-map.js'; +import type {LanguageTransformDescriptor} from './language-transformer.js'; export type TextPreprocessorOptions<T = unknown> = T[]; @@ -42,6 +43,11 @@ export type LanguageAndPreprocessors = { textPreprocessors: TextPreprocessorWithId<unknown>[]; }; +export type LanguageAndTransforms = { + iso: string; + languageTransforms: LanguageTransformDescriptor; +}; + export type TextPreprocessorWithId<T = unknown> = { id: string; textPreprocessor: TextPreprocessor<T>; @@ -51,5 +57,4 @@ export type LanguageSummary = { name: string; iso: string; exampleText: string; - languageTransformsFile?: string; }; diff --git a/types/ext/offscreen.d.ts b/types/ext/offscreen.d.ts index 777756b9..2f180e21 100644 --- a/types/ext/offscreen.d.ts +++ b/types/ext/offscreen.d.ts @@ -29,7 +29,6 @@ import type { ApiReturn as BaseApiReturn, ApiNames as BaseApiNames, } from './api-map'; -import type {LanguageTransformDescriptor} from './language-transformer'; type ApiSurface = { databasePrepareOffscreen: { @@ -51,9 +50,7 @@ type ApiSurface = { return: DictionaryDatabase.Media<string>[]; }; translatorPrepareOffscreen: { - params: { - descriptors: LanguageTransformDescriptor[]; - }; + params: void; return: void; }; findKanjiOffscreen: { |