diff options
author | StefanVukovic99 <stefanvukovic44@gmail.com> | 2024-01-13 12:41:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-13 11:41:38 +0000 |
commit | 273c2f22603abe563435a0f1d7a84c0d9037fe2c (patch) | |
tree | 0fe7600db81217379fa6e06d38945f10b7aec58a /ext/js/language/translator.js | |
parent | 2aea9291d66fd619c484abc2ab04b4350807f308 (diff) |
add option to disable part of speech rule check (#438)
* pos filter wip
* add part of speech filter option
* add part of speech filter option
* remove from deinflector
* update test
* remove return
* tie to dictionary
* duplicate to welcome page
* delete unused html
* fix ts
* typo
Diffstat (limited to 'ext/js/language/translator.js')
-rw-r--r-- | ext/js/language/translator.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/js/language/translator.js b/ext/js/language/translator.js index 36ed8b43..5441294b 100644 --- a/ext/js/language/translator.js +++ b/ext/js/language/translator.js @@ -269,10 +269,13 @@ export class Translator { const databaseEntries = await this._database.findTermsBulk(uniqueDeinflectionTerms, enabledDictionaryMap, matchType); for (const databaseEntry of databaseEntries) { + const entryDictionary = /** @type {import('translation').FindTermDictionary} */ (enabledDictionaryMap.get(databaseEntry.dictionary)); + const partsOfSpeechFilter = entryDictionary.partsOfSpeechFilter; + const definitionRules = Deinflector.rulesToRuleFlags(databaseEntry.rules); for (const deinflection of uniqueDeinflectionArrays[databaseEntry.index]) { const deinflectionRules = deinflection.rules; - if (deinflectionRules === 0 || (definitionRules & deinflectionRules) !== 0) { + if (!partsOfSpeechFilter || deinflectionRules === 0 || (definitionRules & deinflectionRules) !== 0) { deinflection.databaseEntries.push(databaseEntry); } } |