fix priority of readings in epwing lookups
This commit is contained in:
1 parent
1e8447cda3
commit
78eb8734f2
1 file changed
+22
-2
+22
-2
@@ -847,7 +847,27 @@ function add_epwing_info(lookups)
|
|||||||
{
|
{
|
||||||
console.log("looking for epwing possibilities");
|
console.log("looking for epwing possibilities");
|
||||||
let possibilities = lookup_epwing_kan.get(text);
|
let possibilities = lookup_epwing_kan.get(text);
|
||||||
// FIXME we want to try epwing matches in the order they match the epwing entry's spellings/readings instead of the order they're in in the map.get() return list
|
|
||||||
|
// FIXME this is disgusting
|
||||||
|
let priority = [];
|
||||||
|
for(let reading of entry.r_ele)
|
||||||
|
{
|
||||||
|
let rtext = reading.reb;
|
||||||
|
for(let wing of possibilities)
|
||||||
|
{
|
||||||
|
if(epwing[wing]["r"] === rtext)
|
||||||
|
priority.push(wing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(let wing of priority)
|
||||||
|
{
|
||||||
|
var index = possibilities.indexOf(wing);
|
||||||
|
if (index > -1)
|
||||||
|
possibilities.splice(index, 1);
|
||||||
|
}
|
||||||
|
possibilities = priority.concat(possibilities);
|
||||||
|
priority = [];
|
||||||
|
|
||||||
for(let wing of possibilities)
|
for(let wing of possibilities)
|
||||||
{
|
{
|
||||||
console.log("checking an epwing possibility");
|
console.log("checking an epwing possibility");
|
||||||
@@ -859,7 +879,7 @@ function add_epwing_info(lookups)
|
|||||||
exact = epwing[wing]["r"].includes(foundtext);
|
exact = epwing[wing]["r"].includes(foundtext);
|
||||||
for(let spelling of epwing[wing]["s"])
|
for(let spelling of epwing[wing]["s"])
|
||||||
exact |= spelling.includes(foundtext);
|
exact |= spelling.includes(foundtext);
|
||||||
// FIXME duplicated
|
// FIXME duplicated below
|
||||||
if(exact)
|
if(exact)
|
||||||
{
|
{
|
||||||
for(let reading of entry.r_ele)
|
for(let reading of entry.r_ele)
|
||||||
|
|||||||
Reference in new issue
Block a user