summaryrefslogtreecommitdiff
path: root/test/language
diff options
context:
space:
mode:
authorStefanVukovic99 <stefanvukovic44@gmail.com>2024-05-11 01:37:09 +0200
committerGitHub <noreply@github.com>2024-05-10 23:37:09 +0000
commitd68e93e9ca210a3653e3a464391a77b27cfd353a (patch)
treebb6bbb5fb1d7d2d59d66cb4e01fa5014db9afc0b /test/language
parentfdfbfc27c6b731cbc41b2dd1239e70a549bcc8f4 (diff)
add a few deinflections for Latin (#901)
* 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 * start * organize language transform test by language * simpler folders * wip * wip * delete german test * cleanup
Diffstat (limited to 'test/language')
-rw-r--r--test/language/latin-transforms.test.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/language/latin-transforms.test.js b/test/language/latin-transforms.test.js
new file mode 100644
index 00000000..238d8eaf
--- /dev/null
+++ b/test/language/latin-transforms.test.js
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2023-2024 Yomitan Authors
+ * Copyright (C) 2020-2022 Yomichan 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 {latinTransforms} from '../../ext/js/language/la/latin-transforms.js';
+import {LanguageTransformer} from '../../ext/js/language/language-transformer.js';
+import {testLanguageTransformer} from '../fixtures/language-transformer-test.js';
+
+/* eslint-disable @stylistic/no-multi-spaces */
+const tests = [
+ {
+ category: 'plural',
+ valid: true,
+ tests: [
+ {term: 'fluvius', source: 'fluvii', rule: 'n', reasons: ['plural']},
+ {term: 'magnus', source: 'magni', rule: 'adj', reasons: ['plural']},
+ {term: 'insula', source: 'insulae', rule: 'n', reasons: ['plural']}
+ ]
+ },
+ {
+ category: 'adjective',
+ valid: true,
+ tests: [
+ {term: 'magnus', source: 'magna', rule: 'adj', reasons: ['feminine']},
+ {term: 'Graecus', source: 'Graecum', rule: 'adj', reasons: ['neuter']},
+ {term: 'primus', source: 'prima', rule: 'adj', reasons: ['neuter', 'plural']}
+ ]
+ },
+ {
+ category: 'ablative',
+ valid: true,
+ tests: [
+ {term: 'vocabulum', source: 'vocabulo', rule: 'n', reasons: ['ablative']}
+ ]
+ }
+];
+/* eslint-enable @stylistic/no-multi-spaces */
+
+const languageTransformer = new LanguageTransformer();
+languageTransformer.addDescriptor(latinTransforms);
+
+testLanguageTransformer(languageTransformer, tests);