summaryrefslogtreecommitdiff
path: root/ext/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2022-05-29 13:32:22 -0400
committerGitHub <noreply@github.com>2022-05-29 13:32:22 -0400
commit5d0c22e76d3ee15a672de2d93f9e1abcc55c72f0 (patch)
tree584be561bf523ea665cd243de054ac43101f7695 /ext/js
parent46fda6e6534544509f114f8c2a84900aa7f01341 (diff)
Sort using frequency dictionary before using dictionary priority (#2165)
Diffstat (limited to 'ext/js')
-rw-r--r--ext/js/language/translator.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/ext/js/language/translator.js b/ext/js/language/translator.js
index 73f27ff9..ddbd01e6 100644
--- a/ext/js/language/translator.js
+++ b/ext/js/language/translator.js
@@ -1376,14 +1376,14 @@ class Translator {
i = v2.sourceTermExactMatchCount - v1.sourceTermExactMatchCount;
if (i !== 0) { return i; }
- // Sort by dictionary priority
- i = v2.dictionaryPriority - v1.dictionaryPriority;
- if (i !== 0) { return i; }
-
// Sort by frequency order
i = v1.frequencyOrder - v2.frequencyOrder;
if (i !== 0) { return i; }
+ // Sort by dictionary priority
+ i = v2.dictionaryPriority - v1.dictionaryPriority;
+ if (i !== 0) { return i; }
+
// Sort by term score
i = v2.score - v1.score;
if (i !== 0) { return i; }
@@ -1411,12 +1411,12 @@ class Translator {
_sortTermDictionaryEntryDefinitions(definitions) {
const compareFunction = (v1, v2) => {
- // Sort by dictionary priority
- let i = v2.dictionaryPriority - v1.dictionaryPriority;
+ // Sort by frequency order
+ let i = v1.frequencyOrder - v2.frequencyOrder;
if (i !== 0) { return i; }
- // Sort by frequency order
- i = v1.frequencyOrder - v2.frequencyOrder;
+ // Sort by dictionary priority
+ i = v2.dictionaryPriority - v1.dictionaryPriority;
if (i !== 0) { return i; }
// Sort by term score