排除单字的搜索,单字搜索的错误率较高

This commit is contained in:
2024-08-16 16:29:30 +08:00
parent 478f98abfd
commit aadd46f3a9
2 changed files with 3 additions and 2 deletions

View File

@@ -78,7 +78,8 @@ HOSPITAL_ALIAS = {
""" """
搜索过滤配置 搜索过滤配置
""" """
HOSPITAL_FILTER = ["医院", "", "", "", "", "", "人民", "第一", "第二", "第三", "大学", "附属"] # 默认会过滤单字
HOSPITAL_FILTER = ["医院", "人民", "第一", "第二", "第三", "大学", "附属"]
""" """
分词配置 分词配置

View File

@@ -193,7 +193,7 @@ def save_or_update_ie(table, pk_phhd, data):
def search_hospital(hospital): def search_hospital(hospital):
def _filter_search_keywords(keywords): def _filter_search_keywords(keywords):
keywords = [x for x in keywords if x not in HOSPITAL_FILTER] keywords = [x for x in keywords if x not in HOSPITAL_FILTER and len(x) > 1]
result1 = "" result1 = ""
result2 = "" result2 = ""
for keyword in keywords: for keyword in keywords: