improve epwing fallback priority logic
This commit is contained in:
1 parent
75433e471e
commit
d41059ee0b
1 file changed
+14
-7
+14
-7
@@ -723,21 +723,28 @@ function add_epwing_info(lookups, other_settings)
|
|||||||
let spellings = [lookup.text, foundtext];
|
let spellings = [lookup.text, foundtext];
|
||||||
for(let spelling of entry.k_ele)
|
for(let spelling of entry.k_ele)
|
||||||
spellings.push(spelling.keb);
|
spellings.push(spelling.keb);
|
||||||
let core_readings = [foundtext, entry.r_ele[0].reb];
|
let core_readings_a = [lookup.text, foundtext];
|
||||||
console.log(core_readings);
|
let core_readings_b = [entry.r_ele[0].reb];
|
||||||
let readings = [];
|
let readings = [];
|
||||||
for(let reading of entry.r_ele)
|
for(let reading of entry.r_ele)
|
||||||
readings.push(reading.reb);
|
readings.push(reading.reb);
|
||||||
|
|
||||||
// try exact matches
|
// try exact matches
|
||||||
let possibilities = epwing_lookup_kanji(spellings, core_readings, false);
|
let possibilities = epwing_lookup_kanji(spellings, core_readings_a, false);
|
||||||
|
if(possibilities.length == 0)
|
||||||
|
possibilities = epwing_lookup_kanji(spellings, core_readings_b, false);
|
||||||
if(possibilities.length == 0)
|
if(possibilities.length == 0)
|
||||||
possibilities = epwing_lookup_kanji(spellings, readings, false);
|
possibilities = epwing_lookup_kanji(spellings, readings, false);
|
||||||
// try inexact matches
|
// try inexact matches
|
||||||
if(possibilities.length == 0 && !other_settings.strict_epwing)
|
if(!other_settings.strict_epwing)
|
||||||
possibilities = epwing_lookup_kanji(spellings, core_readings, true);
|
{
|
||||||
if(possibilities.length == 0 && !other_settings.strict_epwing)
|
if(possibilities.length == 0)
|
||||||
possibilities = epwing_lookup_kanji(spellings, readings, true);
|
possibilities = epwing_lookup_kanji(spellings, core_readings_a, true);
|
||||||
|
if(possibilities.length == 0)
|
||||||
|
possibilities = epwing_lookup_kanji(spellings, core_readings_b, true);
|
||||||
|
if(possibilities.length == 0)
|
||||||
|
possibilities = epwing_lookup_kanji(spellings, readings, true);
|
||||||
|
}
|
||||||
|
|
||||||
if(possibilities.length > 0)
|
if(possibilities.length > 0)
|
||||||
epwing_data = copy(epwing[possibilities[0]]);
|
epwing_data = copy(epwing[possibilities[0]]);
|
||||||
|
|||||||
Reference in new issue
Block a user