Improve Chinese enterprise search segmentation and ranking
This commit is contained in:
1 parent
ada91c6c76
commit
482ebf57b5
3 files changed
+78
-1
No files matched your search
@@ -238,5 +238,21 @@ describe("fuzzy search utilities", () => {
|
||||
|
||||
expect(results).toEqual([]);
|
||||
});
|
||||
|
||||
test("matches Chinese name and industry words despite a contextual name typo", () => {
|
||||
const target = makeCorp("corp-yutai", "钰泰半导体股份有限公司");
|
||||
const sameIndustry = makeCorp("corp-other", "华芯半导体股份有限公司");
|
||||
for (const query of ["瑞泰半导体", "瑞泰 半导体", "半导体 瑞泰", "钰泰 半导体"]) {
|
||||
expect(filterCorpsFuzzy([sameIndustry, target], query).map((corp) => corp.id))
|
||||
.toEqual([target.id]);
|
||||
}
|
||||
});
|
||||
|
||||
test("requires another matching word before tolerating a typo in a short Chinese name", () => {
|
||||
const target = makeCorp("corp-yutai", "钰泰半导体股份有限公司");
|
||||
expect(filterCorpsFuzzy([target], "瑞泰")).toEqual([]);
|
||||
expect(filterCorpsFuzzy([target], "瑞泰 半导体", { strict: true })).toEqual([]);
|
||||
expect(filterCorpsFuzzy([target], "钰泰半导体", { strict: true })).toEqual([target]);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user