Pop-up dictionary browser extension for language learning. Successor to Yomichan. (PERSONAL FORK)
1/*
2 * Copyright (C) 2023-2025 Yomitan Authors
3 * Copyright (C) 2020-2022 Yomichan Authors
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
19import {germanTransforms} from '../../ext/js/language/de/german-transforms.js';
20import {LanguageTransformer} from '../../ext/js/language/language-transformer.js';
21import {testLanguageTransformer} from '../fixtures/language-transformer-test.js';
22
23/* eslint-disable @stylistic/no-multi-spaces */
24const tests = [
25 {
26 category: 'nominalization',
27 valid: true,
28 tests: [
29 {term: 'reinigen', source: 'reinigung', rule: 'v', reasons: ['nominalization']},
30 {term: 'säubern', source: 'säuberung', rule: 'v', reasons: ['nominalization']},
31 {term: 'entwickeln', source: 'entwicklung', rule: 'v', reasons: ['nominalization']},
32 ],
33 },
34 {
35 category: '-bar',
36 valid: true,
37 tests: [
38 {term: 'essen', source: 'essbar', rule: 'v', reasons: ['-bar']},
39 {term: 'liefern', source: 'lieferbar', rule: 'v', reasons: ['-bar']},
40 ],
41 },
42 {
43 category: 'negative',
44 valid: true,
45 tests: [
46 {term: 'möglich', source: 'unmöglich', rule: 'adj', reasons: ['negative']},
47 ],
48 },
49 {
50 category: 'past participle',
51 valid: true,
52 tests: [
53 {term: 'schnitzen', source: 'geschnitzt', rule: 'v', reasons: ['past participle']},
54 {term: 'scheitern', source: 'gescheitert', rule: 'v', reasons: ['past participle']},
55
56 {term: 'darstellen', source: 'dargestellt', rule: 'v', reasons: ['past participle']},
57 ],
58 },
59 {
60 category: 'separated prefix',
61 valid: true,
62 tests: [
63 {term: 'räum auf', source: 'räum den Tisch auf', rule: 'v', reasons: ['separated prefix']},
64 ],
65 },
66 {
67 category: 'zu-infinitive',
68 valid: true,
69 tests: [
70 {term: 'aufräumen', source: 'aufzuräumen', rule: 'v', reasons: ['zu-infinitive']},
71 ],
72 },
73 {
74 category: '-heit',
75 valid: true,
76 tests: [
77 {term: 'wahr', source: 'wahrheit', rule: 'adj', reasons: ['-heit']},
78 {term: 'Kind', source: 'Kindheit', rule: 'n', reasons: ['-heit']},
79 {term: 'anwenden', source: 'anwendbarkeit', rule: 'v', reasons: ['-bar', '-heit']},
80 ],
81 },
82];
83/* eslint-enable @stylistic/no-multi-spaces */
84
85const languageTransformer = new LanguageTransformer();
86languageTransformer.addDescriptor(germanTransforms);
87
88testLanguageTransformer(languageTransformer, tests);