|
|
@ -46,8 +46,8 @@ public class SimilarityUtil {
|
|
|
|
qaSimilarityQuestionAnswer.setDictId(String.valueOf(document.getMetadata().get("dictId")));
|
|
|
|
qaSimilarityQuestionAnswer.setDictId(String.valueOf(document.getMetadata().get("dictId")));
|
|
|
|
qaSimilarityQuestionAnswer.setMatchQuestionCode(String.valueOf(document.getMetadata().get("standardQuestionId")));
|
|
|
|
qaSimilarityQuestionAnswer.setMatchQuestionCode(String.valueOf(document.getMetadata().get("standardQuestionId")));
|
|
|
|
// 1- 可以使数据进行排序,相似度越高,数值越大(redis相似度给的数据是越小相似度越高)
|
|
|
|
// 1- 可以使数据进行排序,相似度越高,数值越大(redis相似度给的数据是越小相似度越高)
|
|
|
|
// -0.35目的是使数据趋近于中间,相似度不要太大(太大也不好调整),以使我们数据和张总之前提供的方法相似度差异稍小一点,但是不能小于0,如果小于0,取一个较大的值
|
|
|
|
// -0.25目的是使数据趋近于中间,相似度不要太大(太大也不好调整),以使我们数据和张总之前提供的方法相似度差异稍小一点,但是不能小于0,如果小于0,取一个较大的值
|
|
|
|
double score = Math.max(0, 1 - Double.parseDouble(String.valueOf(document.getMetadata().get("vector_score"))) - 0.35);
|
|
|
|
double score = Math.max(0, 1 - Double.parseDouble(String.valueOf(document.getMetadata().get("vector_score"))) - 0.25);
|
|
|
|
qaSimilarityQuestionAnswer.setMatchScore(score);
|
|
|
|
qaSimilarityQuestionAnswer.setMatchScore(score);
|
|
|
|
return qaSimilarityQuestionAnswer;
|
|
|
|
return qaSimilarityQuestionAnswer;
|
|
|
|
// 排序,降序,取最高的
|
|
|
|
// 排序,降序,取最高的
|
|
|
|