Skip to content

Commit

Permalink
TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
toasted-nutbread committed Mar 7, 2021
1 parent 49bf562 commit 8582e1d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions ext/js/language/translator.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class Translator {

for (const groupedDefinition of this._groupTerms(unsequencedDefinitions, enabledDictionaryMap)) {
const {reasons, score, expression, reading, source, rawSource, sourceTerm, furiganaSegments, termTags, definitions: definitions2} = groupedDefinition;
const termDetailsList = [this._createTermDetails(sourceTerm, expression, reading, furiganaSegments, termTags)];
const termDetailsList = [this._createTermDetails(sourceTerm, expression, reading, furiganaSegments, termTags, rules)];

Check failure on line 194 in ext/js/language/translator.js

View workflow job for this annotation

GitHub Actions / test

'rules' is not defined
const compatibilityDefinition = this._createMergedTermDefinition(
source,
rawSource,
Expand Down Expand Up @@ -979,6 +979,9 @@ class Translator {
return definitions;
}

_getAllRules(definitions) {

Check failure on line 982 in ext/js/language/translator.js

View workflow job for this annotation

GitHub Actions / test

'definitions' is defined but never used. Allowed unused args must match /^_/u
}

// Reduction functions

_getTermTagsScoreSum(termTags) {
Expand Down Expand Up @@ -1078,7 +1081,7 @@ class Translator {
}

async _createTermDefinitionFromDatabaseDefinition(databaseDefinition, source, rawSource, sourceTerm, reasons, isPrimary, enabledDictionaryMap) {
const {expression, reading: rawReading, definitionTags, termTags, glossary, score, dictionary, id, sequence} = databaseDefinition;
const {expression, reading: rawReading, definitionTags, termTags, glossary, score, dictionary, id, sequence, rules} = databaseDefinition;
const reading = (rawReading.length > 0 ? rawReading : expression);
const dictionaryOrder = this._getDictionaryOrder(dictionary, enabledDictionaryMap);
const termTagsExpanded = await this._expandTags(termTags, dictionary);
Expand All @@ -1088,7 +1091,7 @@ class Translator {
this._sortTags(termTagsExpanded);

const furiganaSegments = this._japaneseUtil.distributeFurigana(expression, reading);
const termDetailsList = [this._createTermDetails(sourceTerm, expression, reading, furiganaSegments, termTagsExpanded)];
const termDetailsList = [this._createTermDetails(sourceTerm, expression, reading, furiganaSegments, termTagsExpanded, [...rules])];
const sourceTermExactMatchCount = (sourceTerm === expression ? 1 : 0);

return {
Expand Down Expand Up @@ -1125,7 +1128,7 @@ class Translator {
const dictionaryOrder = this._getBestDictionaryOrder(definitions);
const dictionaryNames = this._getUniqueDictionaryNames(definitions);
const termTags = this._getUniqueTermTags(definitions);
const termDetailsList = [this._createTermDetails(sourceTerm, expression, reading, furiganaSegments, termTags)];
const termDetailsList = [this._createTermDetails(sourceTerm, expression, reading, furiganaSegments, termTags, rules)];

Check failure on line 1131 in ext/js/language/translator.js

View workflow job for this annotation

GitHub Actions / test

'rules' is not defined
const sourceTermExactMatchCount = (sourceTerm === expression ? 1 : 0);
return {
type: 'termGrouped',
Expand Down Expand Up @@ -1267,13 +1270,13 @@ class Translator {
for (const [reading, {termTagsMap, sourceTerm, furiganaSegments}] of readingMap.entries()) {
const termTags = [...termTagsMap.values()];
this._sortTags(termTags);
termDetailsList.push(this._createTermDetails(sourceTerm, expression, reading, furiganaSegments, termTags));
termDetailsList.push(this._createTermDetails(sourceTerm, expression, reading, furiganaSegments, termTags, rules));

Check failure on line 1273 in ext/js/language/translator.js

View workflow job for this annotation

GitHub Actions / test

'rules' is not defined
}
}
return termDetailsList;
}

_createTermDetails(sourceTerm, expression, reading, furiganaSegments, termTags) {
_createTermDetails(sourceTerm, expression, reading, furiganaSegments, termTags, rules) {

Check failure on line 1279 in ext/js/language/translator.js

View workflow job for this annotation

GitHub Actions / test

'rules' is defined but never used. Allowed unused args must match /^_/u
const termFrequency = this._scoreToTermFrequency(this._getTermTagsScoreSum(termTags));
return {
sourceTerm,
Expand Down

0 comments on commit 8582e1d

Please sign in to comment.