diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-01-03 12:12:55 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-03 12:12:55 -0500 |
commit | 8e304b83c685dde17a00d402877a21303b7c11f2 (patch) | |
tree | 0b2123575502c3e3cb5127582b03e9c196c9891d /test | |
parent | eda8534e195d653ee0dea36f70caed0d8d49acf1 (diff) |
Translator regex replacements (#1199)
* Add support for regex replacements during the translation process
* Allow assignment of textReplacements
* Rename
* Set up test data
* Write expected data
* Set up options
* Prevent infinite loop if regex matches empty string
* Implement setting controller
* Add support for testing pattern replacements
Diffstat (limited to 'test')
-rw-r--r-- | test/data/test-translator-data.json | 3845 | ||||
-rw-r--r-- | test/test-options-util.js | 8 | ||||
-rw-r--r-- | test/test-translator.js | 10 |
3 files changed, 3861 insertions, 2 deletions
diff --git a/test/data/test-translator-data.json b/test/data/test-translator-data.json index cdc56455..2a568141 100644 --- a/test/data/test-translator-data.json +++ b/test/data/test-translator-data.json @@ -20,6 +20,9 @@ "convertHiraganaToKatakana": false, "convertKatakanaToHiragana": false, "collapseEmphaticSequences": false, + "textReplacements": [ + null + ], "enabledDictionaryMap": [ [ "${title}", @@ -16874,6 +16877,3848 @@ } ] } + }, + { + "comment": "Ignore text inside parentheses", + "func": "findTerms", + "mode": "split", + "text": "打(う)ち込(こ)む", + "options": [ + "default", + { + "alphanumeric": true, + "textReplacements": [ + null, + [ + { + "pattern": "\\(([^)]*)(?:\\)|$)", + "flags": "g", + "replacement": "" + } + ] + ] + } + ], + "expected": { + "length": 10, + "definitions": [ + { + "type": "term", + "id": 7, + "source": "打ち込む", + "rawSource": "打(う)ち込(こ)む", + "sourceTerm": "打ち込む", + "reasons": [], + "score": 10, + "sequence": 4, + "dictionary": "Test Dictionary 2", + "dictionaryPriority": 0, + "dictionaryNames": [ + "Test Dictionary 2" + ], + "expression": "打ち込む", + "reading": "うちこむ", + "expressions": [ + { + "sourceTerm": "打ち込む", + "expression": "打ち込む", + "reading": "うちこむ", + "furiganaSegments": [ + { + "text": "打", + "furigana": "う" + }, + { + "text": "ち", + "furigana": "" + }, + { + "text": "込", + "furigana": "こ" + }, + { + "text": "む", + "furigana": "" + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termFrequency": "normal", + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "うちこむ", + "hasReading": false, + "frequency": 3 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "うちこむ", + "hasReading": true, + "frequency": 8 + } + ], + "pitches": [ + { + "expression": "打ち込む", + "reading": "うちこむ", + "dictionary": "Test Dictionary 2", + "pitches": [ + { + "position": 0, + "tags": [] + }, + { + "position": 3, + "tags": [] + } + ] + } + ] + } + ], + "furiganaSegments": [ + { + "text": "打", + "furigana": "う" + }, + { + "text": "ち", + "furigana": "" + }, + { + "text": "込", + "furigana": "こ" + }, + { + "text": "む", + "furigana": "" + } + ], + "glossary": [ + "definition13", + "definition14" + ], + "definitionTags": [ + { + "name": "tag1", + "category": "category1", + "notes": "tag1 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag2", + "category": "category2", + "notes": "tag2 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "Test Dictionary 2", + "category": "dictionary", + "notes": "", + "order": 100, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "うちこむ", + "hasReading": false, + "frequency": 3 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "うちこむ", + "hasReading": true, + "frequency": 8 + } + ], + "pitches": [ + { + "expression": "打ち込む", + "reading": "うちこむ", + "dictionary": "Test Dictionary 2", + "pitches": [ + { + "position": 0, + "tags": [] + }, + { + "position": 3, + "tags": [] + } + ] + } + ], + "sourceTermExactMatchCount": 1 + }, + { + "type": "term", + "id": 9, + "source": "打ち込む", + "rawSource": "打(う)ち込(こ)む", + "sourceTerm": "打ち込む", + "reasons": [], + "score": 10, + "sequence": 4, + "dictionary": "Test Dictionary 2", + "dictionaryPriority": 0, + "dictionaryNames": [ + "Test Dictionary 2" + ], + "expression": "打ち込む", + "reading": "ぶちこむ", + "expressions": [ + { + "sourceTerm": "打ち込む", + "expression": "打ち込む", + "reading": "ぶちこむ", + "furiganaSegments": [ + { + "text": "打", + "furigana": "ぶ" + }, + { + "text": "ち", + "furigana": "" + }, + { + "text": "込", + "furigana": "こ" + }, + { + "text": "む", + "furigana": "" + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termFrequency": "normal", + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "ぶちこむ", + "hasReading": false, + "frequency": 3 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "ぶちこむ", + "hasReading": true, + "frequency": 9 + } + ], + "pitches": [ + { + "expression": "打ち込む", + "reading": "ぶちこむ", + "dictionary": "Test Dictionary 2", + "pitches": [ + { + "position": 0, + "tags": [] + }, + { + "position": 3, + "tags": [] + } + ] + } + ] + } + ], + "furiganaSegments": [ + { + "text": "打", + "furigana": "ぶ" + }, + { + "text": "ち", + "furigana": "" + }, + { + "text": "込", + "furigana": "こ" + }, + { + "text": "む", + "furigana": "" + } + ], + "glossary": [ + "definition17", + "definition18" + ], + "definitionTags": [ + { + "name": "tag1", + "category": "category1", + "notes": "tag1 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag2", + "category": "category2", + "notes": "tag2 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "Test Dictionary 2", + "category": "dictionary", + "notes": "", + "order": 100, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "ぶちこむ", + "hasReading": false, + "frequency": 3 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "ぶちこむ", + "hasReading": true, + "frequency": 9 + } + ], + "pitches": [ + { + "expression": "打ち込む", + "reading": "ぶちこむ", + "dictionary": "Test Dictionary 2", + "pitches": [ + { + "position": 0, + "tags": [] + }, + { + "position": 3, + "tags": [] + } + ] + } + ], + "sourceTermExactMatchCount": 1 + }, + { + "type": "term", + "id": 8, + "source": "打ち込む", + "rawSource": "打(う)ち込(こ)む", + "sourceTerm": "打ち込む", + "reasons": [], + "score": 1, + "sequence": 4, + "dictionary": "Test Dictionary 2", + "dictionaryPriority": 0, + "dictionaryNames": [ + "Test Dictionary 2" + ], + "expression": "打ち込む", + "reading": "うちこむ", + "expressions": [ + { + "sourceTerm": "打ち込む", + "expression": "打ち込む", + "reading": "うちこむ", + "furiganaSegments": [ + { + "text": "打", + "furigana": "う" + }, + { + "text": "ち", + "furigana": "" + }, + { + "text": "込", + "furigana": "こ" + }, + { + "text": "む", + "furigana": "" + } + ], + "termTags": [ + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag6", + "category": "default", + "notes": "", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag7", + "category": "default", + "notes": "", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termFrequency": "normal", + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "うちこむ", + "hasReading": false, + "frequency": 3 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "うちこむ", + "hasReading": true, + "frequency": 8 + } + ], + "pitches": [ + { + "expression": "打ち込む", + "reading": "うちこむ", + "dictionary": "Test Dictionary 2", + "pitches": [ + { + "position": 0, + "tags": [] + }, + { + "position": 3, + "tags": [] + } + ] + } + ] + } + ], + "furiganaSegments": [ + { + "text": "打", + "furigana": "う" + }, + { + "text": "ち", + "furigana": "" + }, + { + "text": "込", + "furigana": "こ" + }, + { + "text": "む", + "furigana": "" + } + ], + "glossary": [ + "definition15", + "definition16" + ], + "definitionTags": [ + { + "name": "tag1", + "category": "category1", + "notes": "tag1 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag2", + "category": "category2", + "notes": "tag2 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "Test Dictionary 2", + "category": "dictionary", + "notes": "", + "order": 100, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termTags": [ + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag6", + "category": "default", + "notes": "", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag7", + "category": "default", + "notes": "", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "うちこむ", + "hasReading": false, + "frequency": 3 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "うちこむ", + "hasReading": true, + "frequency": 8 + } + ], + "pitches": [ + { + "expression": "打ち込む", + "reading": "うちこむ", + "dictionary": "Test Dictionary 2", + "pitches": [ + { + "position": 0, + "tags": [] + }, + { + "position": 3, + "tags": [] + } + ] + } + ], + "sourceTermExactMatchCount": 1 + }, + { + "type": "term", + "id": 10, + "source": "打ち込む", + "rawSource": "打(う)ち込(こ)む", + "sourceTerm": "打ち込む", + "reasons": [], + "score": 1, + "sequence": 4, + "dictionary": "Test Dictionary 2", + "dictionaryPriority": 0, + "dictionaryNames": [ + "Test Dictionary 2" + ], + "expression": "打ち込む", + "reading": "ぶちこむ", + "expressions": [ + { + "sourceTerm": "打ち込む", + "expression": "打ち込む", + "reading": "ぶちこむ", + "furiganaSegments": [ + { + "text": "打", + "furigana": "ぶ" + }, + { + "text": "ち", + "furigana": "" + }, + { + "text": "込", + "furigana": "こ" + }, + { + "text": "む", + "furigana": "" + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termFrequency": "normal", + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "ぶちこむ", + "hasReading": false, + "frequency": 3 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "ぶちこむ", + "hasReading": true, + "frequency": 9 + } + ], + "pitches": [ + { + "expression": "打ち込む", + "reading": "ぶちこむ", + "dictionary": "Test Dictionary 2", + "pitches": [ + { + "position": 0, + "tags": [] + }, + { + "position": 3, + "tags": [] + } + ] + } + ] + } + ], + "furiganaSegments": [ + { + "text": "打", + "furigana": "ぶ" + }, + { + "text": "ち", + "furigana": "" + }, + { + "text": "込", + "furigana": "こ" + }, + { + "text": "む", + "furigana": "" + } + ], + "glossary": [ + "definition19", + "definition20" + ], + "definitionTags": [ + { + "name": "tag1", + "category": "category1", + "notes": "tag1 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag2", + "category": "category2", + "notes": "tag2 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "Test Dictionary 2", + "category": "dictionary", + "notes": "", + "order": 100, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "ぶちこむ", + "hasReading": false, + "frequency": 3 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "ぶちこむ", + "hasReading": true, + "frequency": 9 + } + ], + "pitches": [ + { + "expression": "打ち込む", + "reading": "ぶちこむ", + "dictionary": "Test Dictionary 2", + "pitches": [ + { + "position": 0, + "tags": [] + }, + { + "position": 3, + "tags": [] + } + ] + } + ], + "sourceTermExactMatchCount": 1 + }, + { + "type": "term", + "id": 3, + "source": "打ち", + "rawSource": "打(う)ち", + "sourceTerm": "打つ", + "reasons": [ + "masu stem" + ], + "score": 10, + "sequence": 3, + "dictionary": "Test Dictionary 2", + "dictionaryPriority": 0, + "dictionaryNames": [ + "Test Dictionary 2" + ], + "expression": "打つ", + "reading": "うつ", + "expressions": [ + { + "sourceTerm": "打つ", + "expression": "打つ", + "reading": "うつ", + "furiganaSegments": [ + { + "text": "打", + "furigana": "う" + }, + { + "text": "つ", + "furigana": "" + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termFrequency": "normal", + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "うつ", + "hasReading": false, + "frequency": 2 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "うつ", + "hasReading": true, + "frequency": 6 + } + ], + "pitches": [] + } + ], + "furiganaSegments": [ + { + "text": "打", + "furigana": "う" + }, + { + "text": "つ", + "furigana": "" + } + ], + "glossary": [ + "definition5", + "definition6" + ], + "definitionTags": [ + { + "name": "tag1", + "category": "category1", + "notes": "tag1 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag2", + "category": "category2", + "notes": "tag2 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "Test Dictionary 2", + "category": "dictionary", + "notes": "", + "order": 100, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "うつ", + "hasReading": false, + "frequency": 2 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "うつ", + "hasReading": true, + "frequency": 6 + } + ], + "pitches": [], + "sourceTermExactMatchCount": 1 + }, + { + "type": "term", + "id": 5, + "source": "打ち", + "rawSource": "打(う)ち", + "sourceTerm": "打つ", + "reasons": [ + "masu stem" + ], + "score": 10, + "sequence": 3, + "dictionary": "Test Dictionary 2", + "dictionaryPriority": 0, + "dictionaryNames": [ + "Test Dictionary 2" + ], + "expression": "打つ", + "reading": "ぶつ", + "expressions": [ + { + "sourceTerm": "打つ", + "expression": "打つ", + "reading": "ぶつ", + "furiganaSegments": [ + { + "text": "打", + "furigana": "ぶ" + }, + { + "text": "つ", + "furigana": "" + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termFrequency": "normal", + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "ぶつ", + "hasReading": false, + "frequency": 2 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "ぶつ", + "hasReading": true, + "frequency": 7 + } + ], + "pitches": [] + } + ], + "furiganaSegments": [ + { + "text": "打", + "furigana": "ぶ" + }, + { + "text": "つ", + "furigana": "" + } + ], + "glossary": [ + "definition9", + "definition10" + ], + "definitionTags": [ + { + "name": "tag1", + "category": "category1", + "notes": "tag1 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag2", + "category": "category2", + "notes": "tag2 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "Test Dictionary 2", + "category": "dictionary", + "notes": "", + "order": 100, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "ぶつ", + "hasReading": false, + "frequency": 2 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "ぶつ", + "hasReading": true, + "frequency": 7 + } + ], + "pitches": [], + "sourceTermExactMatchCount": 1 + }, + { + "type": "term", + "id": 4, + "source": "打ち", + "rawSource": "打(う)ち", + "sourceTerm": "打つ", + "reasons": [ + "masu stem" + ], + "score": 1, + "sequence": 3, + "dictionary": "Test Dictionary 2", + "dictionaryPriority": 0, + "dictionaryNames": [ + "Test Dictionary 2" + ], + "expression": "打つ", + "reading": "うつ", + "expressions": [ + { + "sourceTerm": "打つ", + "expression": "打つ", + "reading": "うつ", + "furiganaSegments": [ + { + "text": "打", + "furigana": "う" + }, + { + "text": "つ", + "furigana": "" + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termFrequency": "normal", + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "うつ", + "hasReading": false, + "frequency": 2 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "うつ", + "hasReading": true, + "frequency": 6 + } + ], + "pitches": [] + } + ], + "furiganaSegments": [ + { + "text": "打", + "furigana": "う" + }, + { + "text": "つ", + "furigana": "" + } + ], + "glossary": [ + "definition7", + "definition8" + ], + "definitionTags": [ + { + "name": "tag1", + "category": "category1", + "notes": "tag1 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag2", + "category": "category2", + "notes": "tag2 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "Test Dictionary 2", + "category": "dictionary", + "notes": "", + "order": 100, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "うつ", + "hasReading": false, + "frequency": 2 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "うつ", + "hasReading": true, + "frequency": 6 + } + ], + "pitches": [], + "sourceTermExactMatchCount": 1 + }, + { + "type": "term", + "id": 6, + "source": "打ち", + "rawSource": "打(う)ち", + "sourceTerm": "打つ", + "reasons": [ + "masu stem" + ], + "score": 1, + "sequence": 3, + "dictionary": "Test Dictionary 2", + "dictionaryPriority": 0, + "dictionaryNames": [ + "Test Dictionary 2" + ], + "expression": "打つ", + "reading": "ぶつ", + "expressions": [ + { + "sourceTerm": "打つ", + "expression": "打つ", + "reading": "ぶつ", + "furiganaSegments": [ + { + "text": "打", + "furigana": "ぶ" + }, + { + "text": "つ", + "furigana": "" + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termFrequency": "normal", + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "ぶつ", + "hasReading": false, + "frequency": 2 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "ぶつ", + "hasReading": true, + "frequency": 7 + } + ], + "pitches": [] + } + ], + "furiganaSegments": [ + { + "text": "打", + "furigana": "ぶ" + }, + { + "text": "つ", + "furigana": "" + } + ], + "glossary": [ + "definition11", + "definition12" + ], + "definitionTags": [ + { + "name": "tag1", + "category": "category1", + "notes": "tag1 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag2", + "category": "category2", + "notes": "tag2 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "Test Dictionary 2", + "category": "dictionary", + "notes": "", + "order": 100, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "ぶつ", + "hasReading": false, + "frequency": 2 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "ぶつ", + "hasReading": true, + "frequency": 7 + } + ], + "pitches": [], + "sourceTermExactMatchCount": 1 + }, + { + "type": "term", + "id": 1, + "source": "打", + "rawSource": "打", + "sourceTerm": "打", + "reasons": [], + "score": 1, + "sequence": 1, + "dictionary": "Test Dictionary 2", + "dictionaryPriority": 0, + "dictionaryNames": [ + "Test Dictionary 2" + ], + "expression": "打", + "reading": "だ", + "expressions": [ + { + "sourceTerm": "打", + "expression": "打", + "reading": "だ", + "furiganaSegments": [ + { + "text": "打", + "furigana": "だ" + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termFrequency": "normal", + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打", + "reading": "だ", + "hasReading": false, + "frequency": 1 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打", + "reading": "だ", + "hasReading": true, + "frequency": 4 + } + ], + "pitches": [] + } + ], + "furiganaSegments": [ + { + "text": "打", + "furigana": "だ" + } + ], + "glossary": [ + "definition1", + "definition2" + ], + "definitionTags": [ + { + "name": "tag1", + "category": "category1", + "notes": "tag1 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag2", + "category": "category2", + "notes": "tag2 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "Test Dictionary 2", + "category": "dictionary", + "notes": "", + "order": 100, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打", + "reading": "だ", + "hasReading": false, + "frequency": 1 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打", + "reading": "だ", + "hasReading": true, + "frequency": 4 + } + ], + "pitches": [], + "sourceTermExactMatchCount": 1 + }, + { + "type": "term", + "id": 2, + "source": "打", + "rawSource": "打", + "sourceTerm": "打", + "reasons": [], + "score": 1, + "sequence": 2, + "dictionary": "Test Dictionary 2", + "dictionaryPriority": 0, + "dictionaryNames": [ + "Test Dictionary 2" + ], + "expression": "打", + "reading": "ダース", + "expressions": [ + { + "sourceTerm": "打", + "expression": "打", + "reading": "ダース", + "furiganaSegments": [ + { + "text": "打", + "furigana": "ダース" + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termFrequency": "normal", + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打", + "reading": "ダース", + "hasReading": false, + "frequency": 1 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打", + "reading": "ダース", + "hasReading": true, + "frequency": 5 + } + ], + "pitches": [] + } + ], + "furiganaSegments": [ + { + "text": "打", + "furigana": "ダース" + } + ], + "glossary": [ + "definition3", + "definition4" + ], + "definitionTags": [ + { + "name": "tag1", + "category": "category1", + "notes": "tag1 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag2", + "category": "category2", + "notes": "tag2 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "Test Dictionary 2", + "category": "dictionary", + "notes": "", + "order": 100, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打", + "reading": "ダース", + "hasReading": false, + "frequency": 1 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打", + "reading": "ダース", + "hasReading": true, + "frequency": 5 + } + ], + "pitches": [], + "sourceTermExactMatchCount": 1 + } + ] + } + }, + { + "comment": "Remove parentheses around text", + "func": "findTerms", + "mode": "split", + "text": "(打)(ち)(込)(む)", + "options": [ + "default", + { + "alphanumeric": true, + "textReplacements": [ + null, + [ + { + "pattern": "\\(([^)]*)(?:\\)|$)", + "flags": "g", + "replacement": "$1" + } + ] + ] + } + ], + "expected": { + "length": 12, + "definitions": [ + { + "type": "term", + "id": 7, + "source": "打ち込む", + "rawSource": "(打)(ち)(込)(む)", + "sourceTerm": "打ち込む", + "reasons": [], + "score": 10, + "sequence": 4, + "dictionary": "Test Dictionary 2", + "dictionaryPriority": 0, + "dictionaryNames": [ + "Test Dictionary 2" + ], + "expression": "打ち込む", + "reading": "うちこむ", + "expressions": [ + { + "sourceTerm": "打ち込む", + "expression": "打ち込む", + "reading": "うちこむ", + "furiganaSegments": [ + { + "text": "打", + "furigana": "う" + }, + { + "text": "ち", + "furigana": "" + }, + { + "text": "込", + "furigana": "こ" + }, + { + "text": "む", + "furigana": "" + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termFrequency": "normal", + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "うちこむ", + "hasReading": false, + "frequency": 3 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "うちこむ", + "hasReading": true, + "frequency": 8 + } + ], + "pitches": [ + { + "expression": "打ち込む", + "reading": "うちこむ", + "dictionary": "Test Dictionary 2", + "pitches": [ + { + "position": 0, + "tags": [] + }, + { + "position": 3, + "tags": [] + } + ] + } + ] + } + ], + "furiganaSegments": [ + { + "text": "打", + "furigana": "う" + }, + { + "text": "ち", + "furigana": "" + }, + { + "text": "込", + "furigana": "こ" + }, + { + "text": "む", + "furigana": "" + } + ], + "glossary": [ + "definition13", + "definition14" + ], + "definitionTags": [ + { + "name": "tag1", + "category": "category1", + "notes": "tag1 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag2", + "category": "category2", + "notes": "tag2 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "Test Dictionary 2", + "category": "dictionary", + "notes": "", + "order": 100, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "うちこむ", + "hasReading": false, + "frequency": 3 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "うちこむ", + "hasReading": true, + "frequency": 8 + } + ], + "pitches": [ + { + "expression": "打ち込む", + "reading": "うちこむ", + "dictionary": "Test Dictionary 2", + "pitches": [ + { + "position": 0, + "tags": [] + }, + { + "position": 3, + "tags": [] + } + ] + } + ], + "sourceTermExactMatchCount": 1 + }, + { + "type": "term", + "id": 9, + "source": "打ち込む", + "rawSource": "(打)(ち)(込)(む)", + "sourceTerm": "打ち込む", + "reasons": [], + "score": 10, + "sequence": 4, + "dictionary": "Test Dictionary 2", + "dictionaryPriority": 0, + "dictionaryNames": [ + "Test Dictionary 2" + ], + "expression": "打ち込む", + "reading": "ぶちこむ", + "expressions": [ + { + "sourceTerm": "打ち込む", + "expression": "打ち込む", + "reading": "ぶちこむ", + "furiganaSegments": [ + { + "text": "打", + "furigana": "ぶ" + }, + { + "text": "ち", + "furigana": "" + }, + { + "text": "込", + "furigana": "こ" + }, + { + "text": "む", + "furigana": "" + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termFrequency": "normal", + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "ぶちこむ", + "hasReading": false, + "frequency": 3 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "ぶちこむ", + "hasReading": true, + "frequency": 9 + } + ], + "pitches": [ + { + "expression": "打ち込む", + "reading": "ぶちこむ", + "dictionary": "Test Dictionary 2", + "pitches": [ + { + "position": 0, + "tags": [] + }, + { + "position": 3, + "tags": [] + } + ] + } + ] + } + ], + "furiganaSegments": [ + { + "text": "打", + "furigana": "ぶ" + }, + { + "text": "ち", + "furigana": "" + }, + { + "text": "込", + "furigana": "こ" + }, + { + "text": "む", + "furigana": "" + } + ], + "glossary": [ + "definition17", + "definition18" + ], + "definitionTags": [ + { + "name": "tag1", + "category": "category1", + "notes": "tag1 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag2", + "category": "category2", + "notes": "tag2 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "Test Dictionary 2", + "category": "dictionary", + "notes": "", + "order": 100, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "ぶちこむ", + "hasReading": false, + "frequency": 3 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "ぶちこむ", + "hasReading": true, + "frequency": 9 + } + ], + "pitches": [ + { + "expression": "打ち込む", + "reading": "ぶちこむ", + "dictionary": "Test Dictionary 2", + "pitches": [ + { + "position": 0, + "tags": [] + }, + { + "position": 3, + "tags": [] + } + ] + } + ], + "sourceTermExactMatchCount": 1 + }, + { + "type": "term", + "id": 8, + "source": "打ち込む", + "rawSource": "(打)(ち)(込)(む)", + "sourceTerm": "打ち込む", + "reasons": [], + "score": 1, + "sequence": 4, + "dictionary": "Test Dictionary 2", + "dictionaryPriority": 0, + "dictionaryNames": [ + "Test Dictionary 2" + ], + "expression": "打ち込む", + "reading": "うちこむ", + "expressions": [ + { + "sourceTerm": "打ち込む", + "expression": "打ち込む", + "reading": "うちこむ", + "furiganaSegments": [ + { + "text": "打", + "furigana": "う" + }, + { + "text": "ち", + "furigana": "" + }, + { + "text": "込", + "furigana": "こ" + }, + { + "text": "む", + "furigana": "" + } + ], + "termTags": [ + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag6", + "category": "default", + "notes": "", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag7", + "category": "default", + "notes": "", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termFrequency": "normal", + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "うちこむ", + "hasReading": false, + "frequency": 3 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "うちこむ", + "hasReading": true, + "frequency": 8 + } + ], + "pitches": [ + { + "expression": "打ち込む", + "reading": "うちこむ", + "dictionary": "Test Dictionary 2", + "pitches": [ + { + "position": 0, + "tags": [] + }, + { + "position": 3, + "tags": [] + } + ] + } + ] + } + ], + "furiganaSegments": [ + { + "text": "打", + "furigana": "う" + }, + { + "text": "ち", + "furigana": "" + }, + { + "text": "込", + "furigana": "こ" + }, + { + "text": "む", + "furigana": "" + } + ], + "glossary": [ + "definition15", + "definition16" + ], + "definitionTags": [ + { + "name": "tag1", + "category": "category1", + "notes": "tag1 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag2", + "category": "category2", + "notes": "tag2 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "Test Dictionary 2", + "category": "dictionary", + "notes": "", + "order": 100, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termTags": [ + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag6", + "category": "default", + "notes": "", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag7", + "category": "default", + "notes": "", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "うちこむ", + "hasReading": false, + "frequency": 3 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "うちこむ", + "hasReading": true, + "frequency": 8 + } + ], + "pitches": [ + { + "expression": "打ち込む", + "reading": "うちこむ", + "dictionary": "Test Dictionary 2", + "pitches": [ + { + "position": 0, + "tags": [] + }, + { + "position": 3, + "tags": [] + } + ] + } + ], + "sourceTermExactMatchCount": 1 + }, + { + "type": "term", + "id": 10, + "source": "打ち込む", + "rawSource": "(打)(ち)(込)(む)", + "sourceTerm": "打ち込む", + "reasons": [], + "score": 1, + "sequence": 4, + "dictionary": "Test Dictionary 2", + "dictionaryPriority": 0, + "dictionaryNames": [ + "Test Dictionary 2" + ], + "expression": "打ち込む", + "reading": "ぶちこむ", + "expressions": [ + { + "sourceTerm": "打ち込む", + "expression": "打ち込む", + "reading": "ぶちこむ", + "furiganaSegments": [ + { + "text": "打", + "furigana": "ぶ" + }, + { + "text": "ち", + "furigana": "" + }, + { + "text": "込", + "furigana": "こ" + }, + { + "text": "む", + "furigana": "" + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termFrequency": "normal", + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "ぶちこむ", + "hasReading": false, + "frequency": 3 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "ぶちこむ", + "hasReading": true, + "frequency": 9 + } + ], + "pitches": [ + { + "expression": "打ち込む", + "reading": "ぶちこむ", + "dictionary": "Test Dictionary 2", + "pitches": [ + { + "position": 0, + "tags": [] + }, + { + "position": 3, + "tags": [] + } + ] + } + ] + } + ], + "furiganaSegments": [ + { + "text": "打", + "furigana": "ぶ" + }, + { + "text": "ち", + "furigana": "" + }, + { + "text": "込", + "furigana": "こ" + }, + { + "text": "む", + "furigana": "" + } + ], + "glossary": [ + "definition19", + "definition20" + ], + "definitionTags": [ + { + "name": "tag1", + "category": "category1", + "notes": "tag1 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag2", + "category": "category2", + "notes": "tag2 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "Test Dictionary 2", + "category": "dictionary", + "notes": "", + "order": 100, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "ぶちこむ", + "hasReading": false, + "frequency": 3 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打ち込む", + "reading": "ぶちこむ", + "hasReading": true, + "frequency": 9 + } + ], + "pitches": [ + { + "expression": "打ち込む", + "reading": "ぶちこむ", + "dictionary": "Test Dictionary 2", + "pitches": [ + { + "position": 0, + "tags": [] + }, + { + "position": 3, + "tags": [] + } + ] + } + ], + "sourceTermExactMatchCount": 1 + }, + { + "type": "term", + "id": 3, + "source": "打ち", + "rawSource": "(打)(ち)(込)", + "sourceTerm": "打つ", + "reasons": [ + "masu stem" + ], + "score": 10, + "sequence": 3, + "dictionary": "Test Dictionary 2", + "dictionaryPriority": 0, + "dictionaryNames": [ + "Test Dictionary 2" + ], + "expression": "打つ", + "reading": "うつ", + "expressions": [ + { + "sourceTerm": "打つ", + "expression": "打つ", + "reading": "うつ", + "furiganaSegments": [ + { + "text": "打", + "furigana": "う" + }, + { + "text": "つ", + "furigana": "" + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termFrequency": "normal", + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "うつ", + "hasReading": false, + "frequency": 2 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "うつ", + "hasReading": true, + "frequency": 6 + } + ], + "pitches": [] + } + ], + "furiganaSegments": [ + { + "text": "打", + "furigana": "う" + }, + { + "text": "つ", + "furigana": "" + } + ], + "glossary": [ + "definition5", + "definition6" + ], + "definitionTags": [ + { + "name": "tag1", + "category": "category1", + "notes": "tag1 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag2", + "category": "category2", + "notes": "tag2 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "Test Dictionary 2", + "category": "dictionary", + "notes": "", + "order": 100, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "うつ", + "hasReading": false, + "frequency": 2 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "うつ", + "hasReading": true, + "frequency": 6 + } + ], + "pitches": [], + "sourceTermExactMatchCount": 1 + }, + { + "type": "term", + "id": 5, + "source": "打ち", + "rawSource": "(打)(ち)(込)", + "sourceTerm": "打つ", + "reasons": [ + "masu stem" + ], + "score": 10, + "sequence": 3, + "dictionary": "Test Dictionary 2", + "dictionaryPriority": 0, + "dictionaryNames": [ + "Test Dictionary 2" + ], + "expression": "打つ", + "reading": "ぶつ", + "expressions": [ + { + "sourceTerm": "打つ", + "expression": "打つ", + "reading": "ぶつ", + "furiganaSegments": [ + { + "text": "打", + "furigana": "ぶ" + }, + { + "text": "つ", + "furigana": "" + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termFrequency": "normal", + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "ぶつ", + "hasReading": false, + "frequency": 2 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "ぶつ", + "hasReading": true, + "frequency": 7 + } + ], + "pitches": [] + } + ], + "furiganaSegments": [ + { + "text": "打", + "furigana": "ぶ" + }, + { + "text": "つ", + "furigana": "" + } + ], + "glossary": [ + "definition9", + "definition10" + ], + "definitionTags": [ + { + "name": "tag1", + "category": "category1", + "notes": "tag1 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag2", + "category": "category2", + "notes": "tag2 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "Test Dictionary 2", + "category": "dictionary", + "notes": "", + "order": 100, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "ぶつ", + "hasReading": false, + "frequency": 2 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "ぶつ", + "hasReading": true, + "frequency": 7 + } + ], + "pitches": [], + "sourceTermExactMatchCount": 1 + }, + { + "type": "term", + "id": 4, + "source": "打ち", + "rawSource": "(打)(ち)(込)", + "sourceTerm": "打つ", + "reasons": [ + "masu stem" + ], + "score": 1, + "sequence": 3, + "dictionary": "Test Dictionary 2", + "dictionaryPriority": 0, + "dictionaryNames": [ + "Test Dictionary 2" + ], + "expression": "打つ", + "reading": "うつ", + "expressions": [ + { + "sourceTerm": "打つ", + "expression": "打つ", + "reading": "うつ", + "furiganaSegments": [ + { + "text": "打", + "furigana": "う" + }, + { + "text": "つ", + "furigana": "" + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termFrequency": "normal", + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "うつ", + "hasReading": false, + "frequency": 2 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "うつ", + "hasReading": true, + "frequency": 6 + } + ], + "pitches": [] + } + ], + "furiganaSegments": [ + { + "text": "打", + "furigana": "う" + }, + { + "text": "つ", + "furigana": "" + } + ], + "glossary": [ + "definition7", + "definition8" + ], + "definitionTags": [ + { + "name": "tag1", + "category": "category1", + "notes": "tag1 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag2", + "category": "category2", + "notes": "tag2 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "Test Dictionary 2", + "category": "dictionary", + "notes": "", + "order": 100, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "うつ", + "hasReading": false, + "frequency": 2 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "うつ", + "hasReading": true, + "frequency": 6 + } + ], + "pitches": [], + "sourceTermExactMatchCount": 1 + }, + { + "type": "term", + "id": 6, + "source": "打ち", + "rawSource": "(打)(ち)(込)", + "sourceTerm": "打つ", + "reasons": [ + "masu stem" + ], + "score": 1, + "sequence": 3, + "dictionary": "Test Dictionary 2", + "dictionaryPriority": 0, + "dictionaryNames": [ + "Test Dictionary 2" + ], + "expression": "打つ", + "reading": "ぶつ", + "expressions": [ + { + "sourceTerm": "打つ", + "expression": "打つ", + "reading": "ぶつ", + "furiganaSegments": [ + { + "text": "打", + "furigana": "ぶ" + }, + { + "text": "つ", + "furigana": "" + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termFrequency": "normal", + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "ぶつ", + "hasReading": false, + "frequency": 2 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "ぶつ", + "hasReading": true, + "frequency": 7 + } + ], + "pitches": [] + } + ], + "furiganaSegments": [ + { + "text": "打", + "furigana": "ぶ" + }, + { + "text": "つ", + "furigana": "" + } + ], + "glossary": [ + "definition11", + "definition12" + ], + "definitionTags": [ + { + "name": "tag1", + "category": "category1", + "notes": "tag1 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag2", + "category": "category2", + "notes": "tag2 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "Test Dictionary 2", + "category": "dictionary", + "notes": "", + "order": 100, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "ぶつ", + "hasReading": false, + "frequency": 2 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打つ", + "reading": "ぶつ", + "hasReading": true, + "frequency": 7 + } + ], + "pitches": [], + "sourceTermExactMatchCount": 1 + }, + { + "type": "term", + "id": 1, + "source": "打", + "rawSource": "(打)(ち)", + "sourceTerm": "打", + "reasons": [], + "score": 1, + "sequence": 1, + "dictionary": "Test Dictionary 2", + "dictionaryPriority": 0, + "dictionaryNames": [ + "Test Dictionary 2" + ], + "expression": "打", + "reading": "だ", + "expressions": [ + { + "sourceTerm": "打", + "expression": "打", + "reading": "だ", + "furiganaSegments": [ + { + "text": "打", + "furigana": "だ" + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termFrequency": "normal", + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打", + "reading": "だ", + "hasReading": false, + "frequency": 1 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打", + "reading": "だ", + "hasReading": true, + "frequency": 4 + } + ], + "pitches": [] + } + ], + "furiganaSegments": [ + { + "text": "打", + "furigana": "だ" + } + ], + "glossary": [ + "definition1", + "definition2" + ], + "definitionTags": [ + { + "name": "tag1", + "category": "category1", + "notes": "tag1 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag2", + "category": "category2", + "notes": "tag2 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "Test Dictionary 2", + "category": "dictionary", + "notes": "", + "order": 100, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打", + "reading": "だ", + "hasReading": false, + "frequency": 1 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打", + "reading": "だ", + "hasReading": true, + "frequency": 4 + } + ], + "pitches": [], + "sourceTermExactMatchCount": 1 + }, + { + "type": "term", + "id": 2, + "source": "打", + "rawSource": "(打)(ち)", + "sourceTerm": "打", + "reasons": [], + "score": 1, + "sequence": 2, + "dictionary": "Test Dictionary 2", + "dictionaryPriority": 0, + "dictionaryNames": [ + "Test Dictionary 2" + ], + "expression": "打", + "reading": "ダース", + "expressions": [ + { + "sourceTerm": "打", + "expression": "打", + "reading": "ダース", + "furiganaSegments": [ + { + "text": "打", + "furigana": "ダース" + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termFrequency": "normal", + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打", + "reading": "ダース", + "hasReading": false, + "frequency": 1 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打", + "reading": "ダース", + "hasReading": true, + "frequency": 5 + } + ], + "pitches": [] + } + ], + "furiganaSegments": [ + { + "text": "打", + "furigana": "ダース" + } + ], + "glossary": [ + "definition3", + "definition4" + ], + "definitionTags": [ + { + "name": "tag1", + "category": "category1", + "notes": "tag1 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag2", + "category": "category2", + "notes": "tag2 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "Test Dictionary 2", + "category": "dictionary", + "notes": "", + "order": 100, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "termTags": [ + { + "name": "tag3", + "category": "category3", + "notes": "tag3 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag4", + "category": "category4", + "notes": "tag4 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + }, + { + "name": "tag5", + "category": "category5", + "notes": "tag5 notes", + "order": 0, + "score": 0, + "dictionary": "Test Dictionary 2", + "redundant": false + } + ], + "frequencies": [ + { + "dictionary": "Test Dictionary 2", + "expression": "打", + "reading": "ダース", + "hasReading": false, + "frequency": 1 + }, + { + "dictionary": "Test Dictionary 2", + "expression": "打", + "reading": "ダース", + "hasReading": true, + "frequency": 5 + } + ], + "pitches": [], + "sourceTermExactMatchCount": 1 + } + ] + } } ] }
\ No newline at end of file diff --git a/test/test-options-util.js b/test/test-options-util.js index c78540cb..ca5f5065 100644 --- a/test/test-options-util.js +++ b/test/test-options-util.js @@ -394,7 +394,11 @@ function createProfileOptionsUpdatedTestData1() { convertAlphabeticCharacters: 'false', convertHiraganaToKatakana: 'false', convertKatakanaToHiragana: 'variant', - collapseEmphaticSequences: 'false' + collapseEmphaticSequences: 'false', + textReplacements: { + searchOriginal: true, + groups: [] + } }, dictionaries: {}, parsing: { @@ -502,7 +506,7 @@ function createOptionsUpdatedTestData1() { } ], profileCurrent: 0, - version: 7, + version: 8, global: { database: { prefixWildcardsSupported: false diff --git a/test/test-translator.js b/test/test-translator.js index 892448a5..cee7fe16 100644 --- a/test/test-translator.js +++ b/test/test-translator.js @@ -107,6 +107,16 @@ function buildOptions(optionsPresets, optionsArray, dictionaryTitle) { } } + // Construct regex + if (Array.isArray(options.textReplacements)) { + options.textReplacements = options.textReplacements.map((value) => { + if (Array.isArray(value)) { + value = value.map(({pattern, flags, replacement}) => ({pattern: new RegExp(pattern, flags), replacement})); + } + return value; + }); + } + // Update structure const placeholder = '${title}'; if (options.mainDictionary === placeholder) { |