Fix special chars problem for Postgres

This commit is contained in:
yangdx
2025-04-17 22:58:36 +08:00
parent 14b4bc96ce
commit a3ca134e97
3 changed files with 10 additions and 5 deletions

View File

@@ -1385,7 +1385,12 @@ def normalize_extracted_info(name: str, is_entity=False) -> str:
name = re.sub(r"(?<=[a-zA-Z0-9])\s+(?=[\u4e00-\u9fa5])", "", name)
# Remove English quotation marks from the beginning and end
name = name.strip('"').strip("'")
if (
len(name) >= 2
and name.startswith('"')
and name.endswith('"')
):
name = name[1:-1]
if is_entity:
# remove Chinese quotes