fix a bug; also, prioritize searched text and/or main reading
This commit is contained in:
1 parent
d5d6bf6513
commit
75433e471e
1 file changed
+9
-3
@@ -723,13 +723,19 @@ 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];
|
||||||
|
console.log(core_readings);
|
||||||
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, readings, false);
|
let possibilities = epwing_lookup_kanji(spellings, core_readings, false);
|
||||||
|
if(possibilities.length == 0)
|
||||||
|
possibilities = epwing_lookup_kanji(spellings, readings, false);
|
||||||
// try inexact matches
|
// try inexact matches
|
||||||
|
if(possibilities.length == 0 && !other_settings.strict_epwing)
|
||||||
|
possibilities = epwing_lookup_kanji(spellings, core_readings, true);
|
||||||
if(possibilities.length == 0 && !other_settings.strict_epwing)
|
if(possibilities.length == 0 && !other_settings.strict_epwing)
|
||||||
possibilities = epwing_lookup_kanji(spellings, readings, true);
|
possibilities = epwing_lookup_kanji(spellings, readings, true);
|
||||||
|
|
||||||
@@ -744,14 +750,14 @@ function add_epwing_info(lookups, other_settings)
|
|||||||
for(let reading of entry.r_ele)
|
for(let reading of entry.r_ele)
|
||||||
{
|
{
|
||||||
if(possibilities.length == 0)
|
if(possibilities.length == 0)
|
||||||
possibilities = epwing_lookup_kana_exact(reading);
|
possibilities = epwing_lookup_kana_exact(reading.reb);
|
||||||
}
|
}
|
||||||
if(possibilities.length == 0)
|
if(possibilities.length == 0)
|
||||||
possibilities = epwing_lookup_kana_inexact(foundtext);
|
possibilities = epwing_lookup_kana_inexact(foundtext);
|
||||||
for(let reading of entry.r_ele)
|
for(let reading of entry.r_ele)
|
||||||
{
|
{
|
||||||
if(possibilities.length == 0)
|
if(possibilities.length == 0)
|
||||||
possibilities = epwing_lookup_kana_inexact(reading);
|
possibilities = epwing_lookup_kana_inexact(reading.reb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(possibilities.length > 0)
|
if(possibilities.length > 0)
|
||||||
|
|||||||
Reference in new issue
Block a user