Updates for PR feedback
This commit is contained in:
parent
f143632f28
commit
54bb702b84
@ -49,8 +49,8 @@ function dictTermsSort(definitions, dictionaries=null) {
|
|||||||
if (dictionaries !== null) {
|
if (dictionaries !== null) {
|
||||||
const dictionaryInfo1 = dictionaries.get(v1.dictionary);
|
const dictionaryInfo1 = dictionaries.get(v1.dictionary);
|
||||||
const dictionaryInfo2 = dictionaries.get(v2.dictionary);
|
const dictionaryInfo2 = dictionaries.get(v2.dictionary);
|
||||||
const priority1 = typeof dictionaryInfo1 !== 'undefined' ? dictionaryInfo1.priority || 0 : 0;
|
const priority1 = typeof dictionaryInfo1 !== 'undefined' ? dictionaryInfo1.priority : 0;
|
||||||
const priority2 = typeof dictionaryInfo2 !== 'undefined' ? dictionaryInfo2.priority || 0 : 0;
|
const priority2 = typeof dictionaryInfo2 !== 'undefined' ? dictionaryInfo2.priority : 0;
|
||||||
i = priority2 - priority1;
|
i = priority2 - priority1;
|
||||||
if (i !== 0) { return i; }
|
if (i !== 0) { return i; }
|
||||||
}
|
}
|
||||||
@ -254,7 +254,7 @@ function dictTermsMergeByGloss(result, definitions, appendTo=null, mergedIndices
|
|||||||
if (appendTo === null) {
|
if (appendTo === null) {
|
||||||
/*
|
/*
|
||||||
Data layout:
|
Data layout:
|
||||||
result.expressions = new Map([
|
resultExpressionsMap = new Map([
|
||||||
[expression, new Map([
|
[expression, new Map([
|
||||||
[reading, new Map([
|
[reading, new Map([
|
||||||
[tagName, tagInfo],
|
[tagName, tagInfo],
|
||||||
@ -289,17 +289,17 @@ function dictTermsMergeByGloss(result, definitions, appendTo=null, mergedIndices
|
|||||||
const only = [];
|
const only = [];
|
||||||
const expressionSet = definition.expression;
|
const expressionSet = definition.expression;
|
||||||
const readingSet = definition.reading;
|
const readingSet = definition.reading;
|
||||||
definition.only = only;
|
|
||||||
if (!dictAreSetsEqual(expressionSet, resultExpressionSet)) {
|
if (!dictAreSetsEqual(expressionSet, resultExpressionSet)) {
|
||||||
only.push(...dictGetSetIntersection(expressionSet, resultExpressionSet));
|
only.push(...dictGetSetIntersection(expressionSet, resultExpressionSet));
|
||||||
}
|
}
|
||||||
if (!dictAreSetsEqual(readingSet, resultReadingSet)) {
|
if (!dictAreSetsEqual(readingSet, resultReadingSet)) {
|
||||||
only.push(...dictGetSetIntersection(readingSet, resultReadingSet));
|
only.push(...dictGetSetIntersection(readingSet, resultReadingSet));
|
||||||
}
|
}
|
||||||
|
definition.only = only;
|
||||||
}
|
}
|
||||||
|
|
||||||
return definitionsByGloss;
|
return definitionsByGloss;
|
||||||
}
|
}
|
||||||
|
|
||||||
function dictTagBuildSource(name) {
|
function dictTagBuildSource(name) {
|
||||||
return dictTagSanitize({name, category: 'dictionary', order: 100});
|
return dictTagSanitize({name, category: 'dictionary', order: 100});
|
||||||
|
@ -71,7 +71,7 @@ class Translator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getMergedSecondarySearchResults(text, expressionsMap, secondarySearchDictionaries) {
|
async getMergedSecondarySearchResults(text, expressionsMap, secondarySearchDictionaries) {
|
||||||
if (secondarySearchDictionaries.length === 0) {
|
if (secondarySearchDictionaries.size === 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user