diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-03-15 20:55:26 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-15 20:55:26 -0400 |
commit | cba45b5e304afe0623e1d032d65e5efc2fc3929b (patch) | |
tree | 0b8475f8dcf84198619dbda7d5ef793443d52564 /test/data/translator-test-inputs.json | |
parent | 9ad9961ca81d2ee41c26d2c2bc2a399abad1bac5 (diff) |
Improve translator test data (#1531)
* Organize files
* Split translator test data into two files
* Add test for AnkiNoteData
Diffstat (limited to 'test/data/translator-test-inputs.json')
-rw-r--r-- | test/data/translator-test-inputs.json | 295 |
1 files changed, 295 insertions, 0 deletions
diff --git a/test/data/translator-test-inputs.json b/test/data/translator-test-inputs.json new file mode 100644 index 00000000..f3000389 --- /dev/null +++ b/test/data/translator-test-inputs.json @@ -0,0 +1,295 @@ +{ + "optionsPresets": { + "kanji": { + "enabledDictionaryMap": [ + [ + "${title}", + { + "index": 0, + "priority": 0 + } + ] + ] + }, + "default": { + "wildcard": null, + "mainDictionary": "${title}", + "alphanumeric": false, + "convertHalfWidthCharacters": false, + "convertNumericCharacters": false, + "convertAlphabeticCharacters": false, + "convertHiraganaToKatakana": false, + "convertKatakanaToHiragana": false, + "collapseEmphaticSequences": false, + "textReplacements": [ + null + ], + "enabledDictionaryMap": [ + [ + "${title}", + { + "index": 0, + "priority": 0, + "allowSecondarySearches": false + } + ] + ] + } + }, + "tests": [ + { + "name": "Basic kanji test 1", + "func": "findKanji", + "text": "打", + "options": "kanji" + }, + { + "name": "Basic kanji test 2", + "func": "findKanji", + "text": "込", + "options": "kanji" + }, + { + "name": "Missing kanji test", + "func": "findKanji", + "text": "画", + "options": "kanji" + }, + { + "name": "Find term using expression text 1", + "func": "findTerms", + "mode": "split", + "text": "打", + "options": "default" + }, + { + "name": "Find term using expression text 2", + "func": "findTerms", + "mode": "split", + "text": "打つ", + "options": "default" + }, + { + "name": "Find term using expression text 3", + "func": "findTerms", + "mode": "split", + "text": "打ち込む", + "options": "default" + }, + { + "name": "Find term using expression text 4", + "func": "findTerms", + "mode": "split", + "text": "画像", + "options": "default" + }, + { + "name": "Find term using reading 1", + "func": "findTerms", + "mode": "split", + "text": "だ", + "options": "default" + }, + { + "name": "Find term using reading 2", + "func": "findTerms", + "mode": "split", + "text": "ダース", + "options": "default" + }, + { + "name": "Find term using reading 3", + "func": "findTerms", + "mode": "split", + "text": "うつ", + "options": "default" + }, + { + "name": "Find term using reading 4", + "func": "findTerms", + "mode": "split", + "text": "ぶつ", + "options": "default" + }, + { + "name": "Find term using reading 5", + "func": "findTerms", + "mode": "split", + "text": "うちこむ", + "options": "default" + }, + { + "name": "Find term using reading 6", + "func": "findTerms", + "mode": "split", + "text": "ぶちこむ", + "options": "default" + }, + { + "name": "Find term using reading 7", + "func": "findTerms", + "mode": "split", + "text": "がぞう", + "options": "default" + }, + { + "name": "Missing term 1", + "func": "findTerms", + "mode": "split", + "text": "為る", + "options": "default" + }, + { + "name": "Missing term 2", + "func": "findTerms", + "mode": "split", + "text": "する", + "options": "default" + }, + { + "name": "Search using different modes", + "func": "findTerms", + "mode": "simple", + "text": "打ち込む", + "options": "default" + }, + { + "name": "Search using different modes", + "func": "findTerms", + "mode": "group", + "text": "打ち込む", + "options": "default" + }, + { + "name": "Search using different modes", + "func": "findTerms", + "mode": "merge", + "text": "打ち込む", + "options": "default" + }, + { + "name": "Search inflected term", + "func": "findTerms", + "mode": "split", + "text": "打ち込んでいませんでした", + "options": "default" + }, + { + "name": "Ignore text inside parentheses", + "func": "findTerms", + "mode": "split", + "text": "打(う)ち込(こ)む", + "options": [ + "default", + { + "alphanumeric": true, + "textReplacements": [ + null, + [ + { + "pattern": "\\(([^)]*)(?:\\)|$)", + "flags": "g", + "replacement": "" + } + ] + ] + } + ] + }, + { + "name": "Remove parentheses around text", + "func": "findTerms", + "mode": "split", + "text": "(打)(ち)(込)(む)", + "options": [ + "default", + { + "alphanumeric": true, + "textReplacements": [ + null, + [ + { + "pattern": "\\(([^)]*)(?:\\)|$)", + "flags": "g", + "replacement": "$1" + } + ] + ] + } + ] + }, + { + "name": "Test non-empty replacement", + "func": "findTerms", + "mode": "split", + "text": "test", + "options": [ + "default", + { + "alphanumeric": true, + "textReplacements": [ + null, + [ + { + "pattern": "test", + "flags": "g", + "replacement": "よみ" + } + ] + ] + } + ] + }, + { + "name": "Test non-empty replacement at end", + "func": "findTerms", + "mode": "split", + "text": "つtest", + "options": [ + "default", + { + "alphanumeric": true, + "textReplacements": [ + null, + [ + { + "pattern": "test", + "flags": "g", + "replacement": "よみ" + } + ] + ] + } + ] + }, + { + "name": "Test non-empty replacement at start", + "func": "findTerms", + "mode": "split", + "text": "testました", + "options": [ + "default", + { + "alphanumeric": true, + "textReplacements": [ + null, + [ + { + "pattern": "test", + "flags": "g", + "replacement": "よみ" + } + ] + ] + } + ] + }, + { + "name": "Search merged mode with non-primary definitions", + "func": "findTerms", + "mode": "merge", + "text": "うちこむ", + "options": "default" + } + ] +}
\ No newline at end of file |