updated 修复词义扩展出错bug

This commit is contained in:
PASSER-BY 2022-03-16 02:12:07 +08:00
parent 52cf8a9114
commit ac3d7d5e1c
2 changed files with 10 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@ -1242,7 +1242,6 @@
while(lists.length){ while(lists.length){
var name = lists.shift(); //当前匹配词 var name = lists.shift(); //当前匹配词
var items = []; //当前匹配词可能性 var items = []; //当前匹配词可能性
var keywords = [name];
for(var word in replaceMap){ for(var word in replaceMap){
var name1 = name.replace(word,replaceMap[word]); var name1 = name.replace(word,replaceMap[word]);
var name2 = name.replace(replaceMap[word],word); var name2 = name.replace(replaceMap[word],word);
@ -1253,6 +1252,7 @@
keywords.push(name2); keywords.push(name2);
} }
} }
var keywords = [name];
var getList = function(name){ var getList = function(name){
for(var filter in replaceFilter){ for(var filter in replaceFilter){
var word_list = replaceFilter[filter]; var word_list = replaceFilter[filter];
@ -1265,14 +1265,15 @@
}); });
} }
}; };
keywords.forEach(getList); getList(name);
// 是否存在该关系 // 是否存在该关系
for(var i in _data){ keywords.forEach(function(name){
var value = _data[i]; for(var i in _data){
if(value.indexOf(name)>-1){ if(_data[i].indexOf(name)>-1){
items.push(i); items.push(i);
}
} }
} });
// 同义词替换 // 同义词替换
if(!items.length){ if(!items.length){
for(var i in _data){ for(var i in _data){