From 8a377cabe6b3d177aac50cdb7ffb5a4328d27fd0 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Fri, 17 Dec 2021 17:02:13 -0500 Subject: matchType/deinflect distinction (#2040) * Pass a "deinflect" option to findTerms * Update Translator to use deinflect option * Fix test input options --- ext/js/background/backend.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ext/js/background') diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js index ce830361..994a6184 100644 --- a/ext/js/background/backend.js +++ b/ext/js/background/backend.js @@ -1080,7 +1080,7 @@ class Backend { const jp = this._japaneseUtil; const mode = 'simple'; const options = this._getProfileOptions(optionsContext); - const details = {matchType: 'exact'}; + const details = {matchType: 'exact', deinflect: true}; const findTermsOptions = this._getTranslatorFindTermsOptions(mode, details, options); const results = []; let previousUngroupedSegment = null; @@ -1959,8 +1959,9 @@ class Backend { } _getTranslatorFindTermsOptions(mode, details, options) { - let {matchType} = details; + let {matchType, deinflect} = details; if (typeof matchType !== 'string') { matchType = 'exact'; } + if (typeof deinflect !== 'boolean') { deinflect = true; } const enabledDictionaryMap = this._getTranslatorEnabledDictionaryMap(options); const { general: {mainDictionary, sortFrequencyDictionary, sortFrequencyDictionaryOrder}, @@ -1988,6 +1989,7 @@ class Backend { } return { matchType, + deinflect, mainDictionary, sortFrequencyDictionary, sortFrequencyDictionaryOrder, -- cgit v1.2.3