From d2e9841f96ebff61d4a5c26a322484f6268115f1 Mon Sep 17 00:00:00 2001 From: StefanVukovic99 Date: Fri, 22 Mar 2024 15:27:35 +0100 Subject: 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 --- test/fixtures/translator-test.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'test/fixtures') 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; } -- cgit v1.2.3