Use dictionary priority later in the definition sorting algorithm (#1492)
This commit is contained in:
parent
019c8cd4d7
commit
4bc53d2348
@ -1304,12 +1304,8 @@ class Translator {
|
|||||||
if (definitions.length <= 1) { return; }
|
if (definitions.length <= 1) { return; }
|
||||||
const stringComparer = this._stringComparer;
|
const stringComparer = this._stringComparer;
|
||||||
const compareFunction = (v1, v2) => {
|
const compareFunction = (v1, v2) => {
|
||||||
// Sort by dictionary priority
|
|
||||||
let i = v2.dictionaryOrder.priority - v1.dictionaryOrder.priority;
|
|
||||||
if (i !== 0) { return i; }
|
|
||||||
|
|
||||||
// Sort by length of source term
|
// Sort by length of source term
|
||||||
i = v2.source.length - v1.source.length;
|
let i = v2.source.length - v1.source.length;
|
||||||
if (i !== 0) { return i; }
|
if (i !== 0) { return i; }
|
||||||
|
|
||||||
// Sort by the number of inflection reasons
|
// Sort by the number of inflection reasons
|
||||||
@ -1320,6 +1316,10 @@ class Translator {
|
|||||||
i = v2.sourceTermExactMatchCount - v1.sourceTermExactMatchCount;
|
i = v2.sourceTermExactMatchCount - v1.sourceTermExactMatchCount;
|
||||||
if (i !== 0) { return i; }
|
if (i !== 0) { return i; }
|
||||||
|
|
||||||
|
// Sort by dictionary priority
|
||||||
|
i = v2.dictionaryOrder.priority - v1.dictionaryOrder.priority;
|
||||||
|
if (i !== 0) { return i; }
|
||||||
|
|
||||||
// Sort by term score
|
// Sort by term score
|
||||||
i = v2.score - v1.score;
|
i = v2.score - v1.score;
|
||||||
if (i !== 0) { return i; }
|
if (i !== 0) { return i; }
|
||||||
|
Loading…
Reference in New Issue
Block a user