From 3e419aa562aab03ca20421aaf7e4d1a39194a5b4 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Wed, 31 Jan 2024 08:28:05 -0500 Subject: Language transformer (#582) * Set up new deinflection data file * Define types * Test * Add internal types * Set up loading for transforms * Add getPartOfSpeechFlags * Convert static methods * Add note * Add transform function * Update trace structure * Add a language tag to the language transform descriptor * Add clear function * Add function for multiple parts of speech * Clarify naming * Add getConditionFlagsFromConditionType * Add plural function * Replace usages of Deinflector * Update tests * Update config * Remove old * Rename * Rename files --- test/fixtures/translator-test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/fixtures') diff --git a/test/fixtures/translator-test.js b/test/fixtures/translator-test.js index 6562931c..58247b70 100644 --- a/test/fixtures/translator-test.js +++ b/test/fixtures/translator-test.js @@ -32,7 +32,7 @@ import {DictionaryImporterMediaLoader} from '../mocks/dictionary-importer-media- import {createDomTest} from './dom-test.js'; const extDir = join(dirname(fileURLToPath(import.meta.url)), '../../ext'); -const deinflectionReasonsPath = join(extDir, 'data/deinflect.json'); +const languageTransformDescriptorPath = join(extDir, 'data/language/japanese-transforms.json'); vi.stubGlobal('indexedDB', indexedDB); vi.stubGlobal('IDBKeyRange', IDBKeyRange); @@ -65,8 +65,8 @@ async function createTranslatorContext(dictionaryDirectory, dictionaryName) { // Setup translator const translator = new Translator({database: dictionaryDatabase}); - /** @type {import('deinflector').ReasonsRaw} */ - const deinflectionReasons = parseJson(readFileSync(deinflectionReasonsPath, {encoding: 'utf8'})); + /** @type {import('language-transformer').LanguageTransformDescriptor} */ + const deinflectionReasons = parseJson(readFileSync(languageTransformDescriptorPath, {encoding: 'utf8'})); translator.prepare(deinflectionReasons); // Assign properties -- cgit v1.2.3