更新词库,添加同义词和描述,删除冗余条目,优化意图识别逻辑,调整向量检索参数.
This commit is contained in:
@@ -167,13 +167,13 @@ class ProfessionalNounVectorizer:
|
||||
})
|
||||
|
||||
if len(synonymous) > 0:
|
||||
synonyms_str = ', '.join(synonymous)
|
||||
texts.append(synonyms_str.strip())
|
||||
metadatas.append({
|
||||
"name": name,
|
||||
"synonymous": synonymous,
|
||||
"description": description
|
||||
})
|
||||
for synonyms_str in synonymous:
|
||||
texts.append(synonyms_str.strip())
|
||||
metadatas.append({
|
||||
"name": name,
|
||||
"synonymous": synonymous,
|
||||
"description": description
|
||||
})
|
||||
|
||||
if len(description) > 0:
|
||||
texts.append(description.strip())
|
||||
@@ -306,7 +306,11 @@ class ProfessionalNounRetriever:
|
||||
set3 = set(json.dumps(i.metadata, sort_keys=True, ensure_ascii=False)
|
||||
for i in retriever3.invoke(query_text))
|
||||
|
||||
intersection = set1 | set2 | set3
|
||||
# 如果use_intersection为True,取交集;否则取并集
|
||||
if use_intersection:
|
||||
intersection = set1 & set2 & set3
|
||||
else:
|
||||
intersection = set1 | set2 | set3
|
||||
|
||||
# 如果交集为空,使用第一种检索方式的结果
|
||||
if not intersection:
|
||||
|
||||
Reference in New Issue
Block a user