From 7955fc85ac089d856b44bdea78eccd26ffbd690c Mon Sep 17 00:00:00 2001 From: StefanVukovic99 Date: Mon, 3 Jun 2024 19:25:51 +0200 Subject: display inflection rule descriptions (#1000) * load descriptions in deinflector * description functions in deinflectors * show descriptions in title * use toaster * use names without internal * css lint * reformat transform descriptors * fix merge errors * done? * rename method --- test/data/translator-test-results-note-data1.json | 214 +++++++++++++++----- test/data/translator-test-results.json | 230 ++++++++++++++++------ test/language/japanese-transforms.test.js | 46 ++--- test/options-util.test.js | 2 +- 4 files changed, 358 insertions(+), 134 deletions(-) (limited to 'test') diff --git a/test/data/translator-test-results-note-data1.json b/test/data/translator-test-results-note-data1.json index 11c9d078..81f98a77 100644 --- a/test/data/translator-test-results-note-data1.json +++ b/test/data/translator-test-results-note-data1.json @@ -4579,7 +4579,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -4895,7 +4897,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -5211,7 +5215,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -5527,7 +5533,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -9718,7 +9726,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -10034,7 +10044,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -11199,7 +11211,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -11515,7 +11529,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -12899,7 +12915,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -13246,7 +13264,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -15003,7 +15023,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -16209,11 +16231,21 @@ { "source": "algorithm", "inflectionRules": [ - "-te", - "progressive or perfect", - "polite", - "negative", - "past" + { + "name": "-te" + }, + { + "name": "progressive or perfect" + }, + { + "name": "polite" + }, + { + "name": "negative" + }, + { + "name": "past" + } ] } ], @@ -16637,11 +16669,21 @@ { "source": "algorithm", "inflectionRules": [ - "-te", - "progressive or perfect", - "polite", - "negative", - "past" + { + "name": "-te" + }, + { + "name": "progressive or perfect" + }, + { + "name": "polite" + }, + { + "name": "negative" + }, + { + "name": "past" + } ] } ], @@ -17065,11 +17107,21 @@ { "source": "algorithm", "inflectionRules": [ - "-te", - "progressive or perfect", - "polite", - "negative", - "past" + { + "name": "-te" + }, + { + "name": "progressive or perfect" + }, + { + "name": "polite" + }, + { + "name": "negative" + }, + { + "name": "past" + } ] } ], @@ -17493,11 +17545,21 @@ { "source": "algorithm", "inflectionRules": [ - "-te", - "progressive or perfect", - "polite", - "negative", - "past" + { + "name": "-te" + }, + { + "name": "progressive or perfect" + }, + { + "name": "polite" + }, + { + "name": "negative" + }, + { + "name": "past" + } ] } ], @@ -17921,7 +17983,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -18237,7 +18301,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -18553,7 +18619,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -18869,7 +18937,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -21515,7 +21585,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -21831,7 +21903,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -22147,7 +22221,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -22463,7 +22539,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -25109,7 +25187,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -25425,7 +25505,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -25741,7 +25823,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -26057,7 +26141,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -27015,7 +27101,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -27337,8 +27425,12 @@ { "source": "algorithm", "inflectionRules": [ - "polite", - "past" + { + "name": "polite" + }, + { + "name": "past" + } ] } ], @@ -28271,7 +28363,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -30322,14 +30416,21 @@ { "source": "both", "inflectionRules": [ - "past" + { + "name": "past" + } ] }, { "source": "algorithm", "inflectionRules": [ - "past", - "kansai-ben" + { + "name": "past" + }, + { + "name": "kansai-ben", + "description": "past form of kansai-ben terms" + } ] } ], @@ -32831,8 +32932,13 @@ { "source": "algorithm", "inflectionRules": [ - "adv", - "kansai-ben" + { + "name": "adv" + }, + { + "name": "kansai-ben", + "description": "-ku stem of kansai-ben adjectives" + } ] } ], @@ -33184,7 +33290,9 @@ { "source": "algorithm", "inflectionRules": [ - "-거나" + { + "name": "-거나" + } ] } ], diff --git a/test/data/translator-test-results.json b/test/data/translator-test-results.json index ba251347..d63996c8 100644 --- a/test/data/translator-test-results.json +++ b/test/data/translator-test-results.json @@ -2461,7 +2461,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -2633,7 +2635,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -2805,7 +2809,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -2977,7 +2983,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -5231,7 +5239,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -5403,7 +5413,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -5969,7 +5981,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -6141,7 +6155,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -6695,7 +6711,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -6759,7 +6777,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -6823,7 +6843,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -6887,7 +6909,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -7565,7 +7589,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -7785,7 +7811,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -8820,7 +8848,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -9590,11 +9620,21 @@ { "source": "algorithm", "inflectionRules": [ - "-te", - "progressive or perfect", - "polite", - "negative", - "past" + { + "name": "-te" + }, + { + "name": "progressive or perfect" + }, + { + "name": "polite" + }, + { + "name": "negative" + }, + { + "name": "past" + } ] } ], @@ -9790,11 +9830,21 @@ { "source": "algorithm", "inflectionRules": [ - "-te", - "progressive or perfect", - "polite", - "negative", - "past" + { + "name": "-te" + }, + { + "name": "progressive or perfect" + }, + { + "name": "polite" + }, + { + "name": "negative" + }, + { + "name": "past" + } ] } ], @@ -9990,11 +10040,21 @@ { "source": "algorithm", "inflectionRules": [ - "-te", - "progressive or perfect", - "polite", - "negative", - "past" + { + "name": "-te" + }, + { + "name": "progressive or perfect" + }, + { + "name": "polite" + }, + { + "name": "negative" + }, + { + "name": "past" + } ] } ], @@ -10190,11 +10250,21 @@ { "source": "algorithm", "inflectionRules": [ - "-te", - "progressive or perfect", - "polite", - "negative", - "past" + { + "name": "-te" + }, + { + "name": "progressive or perfect" + }, + { + "name": "polite" + }, + { + "name": "negative" + }, + { + "name": "past" + } ] } ], @@ -10390,7 +10460,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -10562,7 +10634,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -10734,7 +10808,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -10906,7 +10982,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -12209,7 +12287,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -12381,7 +12461,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -12553,7 +12635,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -12725,7 +12809,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -14028,7 +14114,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -14200,7 +14288,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -14372,7 +14462,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -14544,7 +14636,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -15071,7 +15165,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -15289,8 +15385,12 @@ { "source": "algorithm", "inflectionRules": [ - "polite", - "past" + { + "name": "polite" + }, + { + "name": "past" + } ] } ], @@ -15860,7 +15960,9 @@ { "source": "algorithm", "inflectionRules": [ - "masu stem" + { + "name": "masu stem" + } ] } ], @@ -17068,14 +17170,21 @@ { "source": "both", "inflectionRules": [ - "past" + { + "name": "past" + } ] }, { "source": "algorithm", "inflectionRules": [ - "past", - "kansai-ben" + { + "name": "past" + }, + { + "name": "kansai-ben", + "description": "past form of kansai-ben terms" + } ] } ], @@ -18534,8 +18643,13 @@ { "source": "algorithm", "inflectionRules": [ - "adv", - "kansai-ben" + { + "name": "adv" + }, + { + "name": "kansai-ben", + "description": "-ku stem of kansai-ben adjectives" + } ] } ], @@ -18778,7 +18892,9 @@ { "source": "algorithm", "inflectionRules": [ - "-거나" + { + "name": "-거나" + } ] } ], diff --git a/test/language/japanese-transforms.test.js b/test/language/japanese-transforms.test.js index 64d935d5..d0ff131e 100644 --- a/test/language/japanese-transforms.test.js +++ b/test/language/japanese-transforms.test.js @@ -1108,65 +1108,65 @@ const tests = [ category: '-ku stem of kansai-ben adjectives', valid: true, tests: [ - {term: '宜しい', source: '宜しゅう', rule: null, reasons: ['adv', 'kansai-ben']}, - {term: 'よろしい', source: 'よろしゅう', rule: null, reasons: ['adv', 'kansai-ben']}, - {term: '良い', source: '良う', rule: null, reasons: ['adv', 'kansai-ben']}, - {term: 'よい', source: 'よう', rule: null, reasons: ['adv', 'kansai-ben']}, + {term: '宜しい', source: '宜しゅう', rule: null, reasons: ['adv', 'kansai-ben -ku']}, + {term: 'よろしい', source: 'よろしゅう', rule: null, reasons: ['adv', 'kansai-ben -ku']}, + {term: '良い', source: '良う', rule: null, reasons: ['adv', 'kansai-ben -ku']}, + {term: 'よい', source: 'よう', rule: null, reasons: ['adv', 'kansai-ben -ku']}, ], }, { category: '-te form of kansai-ben adjectives', valid: true, tests: [ - {term: 'よろしい', source: 'よろしゅうて', rule: null, reasons: ['-te', 'kansai-ben']}, - {term: '宜しい', source: '宜しゅうて', rule: null, reasons: ['-te', 'kansai-ben']}, - {term: 'よい', source: 'ようて', rule: null, reasons: ['-te', 'kansai-ben']}, - {term: '良い', source: '良うて', rule: null, reasons: ['-te', 'kansai-ben']}, + {term: 'よろしい', source: 'よろしゅうて', rule: null, reasons: ['-te', 'kansai-ben adjective -te']}, + {term: '宜しい', source: '宜しゅうて', rule: null, reasons: ['-te', 'kansai-ben adjective -te']}, + {term: 'よい', source: 'ようて', rule: null, reasons: ['-te', 'kansai-ben adjective -te']}, + {term: '良い', source: '良うて', rule: null, reasons: ['-te', 'kansai-ben adjective -te']}, ], }, { category: 'Negative form of kansai-ben adjectives', valid: true, tests: [ - {term: 'よろしい', source: 'よろしゅうない', rule: null, reasons: ['negative', 'kansai-ben']}, - {term: '宜しい', source: '宜しゅうない', rule: null, reasons: ['negative', 'kansai-ben']}, - {term: 'よい', source: 'ようない', rule: null, reasons: ['negative', 'kansai-ben']}, - {term: '良い', source: '良うない', rule: null, reasons: ['negative', 'kansai-ben']}, + {term: 'よろしい', source: 'よろしゅうない', rule: null, reasons: ['negative', 'kansai-ben adjective negative']}, + {term: '宜しい', source: '宜しゅうない', rule: null, reasons: ['negative', 'kansai-ben adjective negative']}, + {term: 'よい', source: 'ようない', rule: null, reasons: ['negative', 'kansai-ben adjective negative']}, + {term: '良い', source: '良うない', rule: null, reasons: ['negative', 'kansai-ben adjective negative']}, ], }, { category: 'Negative form of kansai-ben verbs', valid: true, tests: [ - {term: '食べる', source: '食べへん', rule: null, reasons: ['negative', 'kansai-ben']}, - {term: '食べる', source: '食べへんかった', rule: null, reasons: ['negative', 'past', 'kansai-ben']}, + {term: '食べる', source: '食べへん', rule: null, reasons: ['negative', 'kansai-ben negative']}, + {term: '食べる', source: '食べへんかった', rule: null, reasons: ['negative', 'past', 'kansai-ben negative']}, ], }, { category: '-te form of kansai-ben verbs', valid: true, tests: [ - {term: '買う', source: '買うて', rule: null, reasons: ['-te', 'kansai-ben']}, - {term: 'かう', source: 'こうて', rule: null, reasons: ['-te', 'kansai-ben']}, - {term: 'はう', source: 'ほうて', rule: null, reasons: ['-te', 'kansai-ben']}, + {term: '買う', source: '買うて', rule: null, reasons: ['-te', 'kansai-ben -te']}, + {term: 'かう', source: 'こうて', rule: null, reasons: ['-te', 'kansai-ben -te']}, + {term: 'はう', source: 'ほうて', rule: null, reasons: ['-te', 'kansai-ben -te']}, ], }, { category: 'past form of kansai-ben terms', valid: true, tests: [ - {term: '買う', source: '買うた', rule: null, reasons: ['past', 'kansai-ben']}, - {term: 'かう', source: 'こうた', rule: null, reasons: ['past', 'kansai-ben']}, - {term: 'はう', source: 'ほうた', rule: null, reasons: ['past', 'kansai-ben']}, + {term: '買う', source: '買うた', rule: null, reasons: ['past', 'kansai-ben past']}, + {term: 'かう', source: 'こうた', rule: null, reasons: ['past', 'kansai-ben past']}, + {term: 'はう', source: 'ほうた', rule: null, reasons: ['past', 'kansai-ben past']}, ], }, { category: '-tara form of kansai-ben terms', valid: true, tests: [ - {term: '買う', source: '買うたら', rule: null, reasons: ['-tara', 'kansai-ben']}, - {term: 'かう', source: 'こうたら', rule: null, reasons: ['-tara', 'kansai-ben']}, - {term: 'はう', source: 'ほうたら', rule: null, reasons: ['-tara', 'kansai-ben']}, + {term: '買う', source: '買うたら', rule: null, reasons: ['-tara', 'kansai-ben -tara']}, + {term: 'かう', source: 'こうたら', rule: null, reasons: ['-tara', 'kansai-ben -tara']}, + {term: 'はう', source: 'ほうたら', rule: null, reasons: ['-tara', 'kansai-ben -tara']}, ], }, ]; diff --git a/test/options-util.test.js b/test/options-util.test.js index a849fa32..af4daef9 100644 --- a/test/options-util.test.js +++ b/test/options-util.test.js @@ -605,7 +605,7 @@ function createOptionsUpdatedTestData1() { }, ], profileCurrent: 0, - version: 37, + version: 38, global: { database: { prefixWildcardsSupported: false, -- cgit v1.2.3