mapping - Lucene.NET 2-Way Synonyms
问题描述
I'm able to get synonyms working in my custom analyzer, but it only appears to behave correctly if the phrase entered matches the input "key". I'd like to be able to match any synonym in a list of 2+ with any other synonym in that same list.
var map = new SynonymMap.Builder(true);
var synonyms = string.Join("\0", new string[] { "broken", "break", "malfunction" });
map.Add(new CharsRef("broke"), new CharsRef(synonyms), true);
stream = new SynonymFilter(stream, map.Build(), true);
Am I supposed to add a map for each synonym?
var synonyms2 = string.Join("\0", new string[] { "broke", "break", "malfunction" });
map.Add(new CharsRef("broken"), new CharsRef(synonyms2), true);
var synonyms3 = string.Join("\0", new string[] { "broken", "break", "broke" });
map.Add(new CharsRef("malfunction"), new CharsRef(synonyms3), true);
I can clean it up so it loops through a list and adds a map for each one, I just wanted to keep the issue clear.
If I have a database that manages synonyms for hundreds or thousands of words... is it expected to simply add tens of thousands of maps for every possible combination?
解决方案
推荐阅读
- typescript - 如何配置 mocha-sidebar 以使用 ttypescript
- docker - 在 alpine linux 上安装 gcc(坏档案)
- azure-api-management - 如何在 Azure api manager 中使用通配符路径创建代理?
- r - 用于执行 Q 模式因子分析的 R 函数或包
- flutter - 颤振下拉按钮问题
- c# - swashbuckle.aspnetcore 是否支持 asp.net core 3.0?
- kotlin - 从房间数据库中获取特定实体的最佳方法是什么
- dataframe - 火花联合不按预期工作,添加新行
- javascript - 返回不同的值:键对
- cuda - 如何在 cuSparse 中转置稀疏矩阵?