mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 03:58:14 +00:00
[improvement][chat] The similarity of MapModeEnum.STRICT is 1 (#1851)
This commit is contained in:
@@ -20,7 +20,7 @@ import java.util.Set;
|
||||
public abstract class BaseMatchStrategy<T extends MapResult> implements MatchStrategy<T> {
|
||||
@Override
|
||||
public Map<MatchText, List<T>> match(ChatQueryContext chatQueryContext, List<S2Term> terms,
|
||||
Set<Long> detectDataSetIds) {
|
||||
Set<Long> detectDataSetIds) {
|
||||
String text = chatQueryContext.getRequest().getQueryText();
|
||||
if (Objects.isNull(terms) || StringUtils.isEmpty(text)) {
|
||||
return null;
|
||||
@@ -36,7 +36,7 @@ public abstract class BaseMatchStrategy<T extends MapResult> implements MatchStr
|
||||
}
|
||||
|
||||
public List<T> detect(ChatQueryContext chatQueryContext, List<S2Term> terms,
|
||||
Set<Long> detectDataSetIds) {
|
||||
Set<Long> detectDataSetIds) {
|
||||
throw new RuntimeException("Not implemented");
|
||||
}
|
||||
|
||||
@@ -64,6 +64,9 @@ public abstract class BaseMatchStrategy<T extends MapResult> implements MatchStr
|
||||
}
|
||||
|
||||
public double getThreshold(Double threshold, Double minThreshold, MapModeEnum mapModeEnum) {
|
||||
if (MapModeEnum.STRICT.equals(mapModeEnum)) {
|
||||
return 1.0d;
|
||||
}
|
||||
double decreaseAmount = (threshold - minThreshold) / 4;
|
||||
double divideThreshold = threshold - mapModeEnum.threshold * decreaseAmount;
|
||||
return divideThreshold >= minThreshold ? divideThreshold : minThreshold;
|
||||
|
||||
Reference in New Issue
Block a user