mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-12 20:51:48 +00:00
(fix)(chat) Fix the issue of mapping in the map (#1825)
This commit is contained in:
@@ -58,9 +58,8 @@ public class SearchService {
|
||||
return new HanlpMapResult(name, entry.getValue(), key, similarity);
|
||||
}).sorted((a, b) -> -(b.getName().length() - a.getName().length()))
|
||||
.collect(Collectors.toList());
|
||||
hanlpMapResults = transformAndFilterByDataSet(hanlpMapResults, modelIdToDataSetIds,
|
||||
detectDataSetIds, limit);
|
||||
return hanlpMapResults;
|
||||
return transformAndFilterByDataSet(hanlpMapResults, modelIdToDataSetIds, detectDataSetIds,
|
||||
limit);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,15 +70,14 @@ public class SearchService {
|
||||
*/
|
||||
public static List<HanlpMapResult> suffixSearch(String key, int limit,
|
||||
Map<Long, List<Long>> modelIdToDataSetIds, Set<Long> detectDataSetIds) {
|
||||
String reverseDetectSegment = StringUtils.reverse(key);
|
||||
return suffixSearch(reverseDetectSegment, limit, suffixTrie, modelIdToDataSetIds,
|
||||
detectDataSetIds);
|
||||
return suffixSearch(key, limit, suffixTrie, modelIdToDataSetIds, detectDataSetIds);
|
||||
}
|
||||
|
||||
public static List<HanlpMapResult> suffixSearch(String key, int limit,
|
||||
BinTrie<List<String>> binTrie, Map<Long, List<Long>> modelIdToDataSetIds,
|
||||
Set<Long> detectDataSetIds) {
|
||||
Set<Map.Entry<String, List<String>>> result = search(key, binTrie);
|
||||
String reverseDetectSegment = StringUtils.reverse(key);
|
||||
Set<Map.Entry<String, List<String>>> result = search(reverseDetectSegment, binTrie);
|
||||
List<HanlpMapResult> hanlpMapResults = result.stream().map(entry -> {
|
||||
String name = entry.getKey().replace("#", " ");
|
||||
List<String> natures = entry.getValue().stream()
|
||||
|
||||
@@ -77,9 +77,9 @@ public class MapFilter {
|
||||
for (Map.Entry<Long, List<SchemaElementMatch>> entry : dataSetElementMatches.entrySet()) {
|
||||
List<SchemaElementMatch> value = entry.getValue();
|
||||
if (!CollectionUtils.isEmpty(value)) {
|
||||
value.removeIf(schemaElementMatch -> StringUtils
|
||||
.length(schemaElementMatch.getDetectWord()) <= 2
|
||||
&& schemaElementMatch.getSimilarity() < 1);
|
||||
value.removeIf(
|
||||
schemaElementMatch -> StringUtils.length(schemaElementMatch.getWord()) <= 2
|
||||
&& schemaElementMatch.getSimilarity() < 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public class MapperConfig extends ParameterConfig {
|
||||
"number", "Mapper相关配置");
|
||||
|
||||
public static final Parameter MAPPER_NAME_THRESHOLD =
|
||||
new Parameter("s2.mapper.name.threshold", "0.5", "指标名、维度名文本相似度阈值",
|
||||
new Parameter("s2.mapper.name.threshold", "0.3", "指标名、维度名文本相似度阈值",
|
||||
"文本片段和匹配到的指标、维度名计算出来的编辑距离阈值, 若超出该阈值, 则舍弃", "number", "Mapper相关配置");
|
||||
|
||||
public static final Parameter MAPPER_NAME_THRESHOLD_MIN =
|
||||
|
||||
Reference in New Issue
Block a user