mirror of
https://github.com/langgenius/dify.git
synced 2025-12-18 05:32:21 +00:00
chore: update remove_leading_symbols pattern, keep 【 (#29419)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
b4afc7e435
commit
d152d63e7d
@ -13,5 +13,5 @@ def remove_leading_symbols(text: str) -> str:
|
|||||||
"""
|
"""
|
||||||
# Match Unicode ranges for punctuation and symbols
|
# Match Unicode ranges for punctuation and symbols
|
||||||
# FIXME this pattern is confused quick fix for #11868 maybe refactor it later
|
# FIXME this pattern is confused quick fix for #11868 maybe refactor it later
|
||||||
pattern = r"^[\u2000-\u206F\u2E00-\u2E7F\u3000-\u303F\"#$%&'()*+,./:;<=>?@^_`~]+"
|
pattern = r'^[\[\]\u2000-\u2025\u2027-\u206F\u2E00-\u2E7F\u3000-\u300F\u3011-\u303F"#$%&\'()*+,./:;<=>?@^_`~]+'
|
||||||
return re.sub(pattern, "", text)
|
return re.sub(pattern, "", text)
|
||||||
|
|||||||
@ -14,6 +14,7 @@ from core.tools.utils.text_processing_utils import remove_leading_symbols
|
|||||||
("Hello, World!", "Hello, World!"),
|
("Hello, World!", "Hello, World!"),
|
||||||
("", ""),
|
("", ""),
|
||||||
(" ", " "),
|
(" ", " "),
|
||||||
|
("【测试】", "【测试】"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_remove_leading_symbols(input_text, expected_output):
|
def test_remove_leading_symbols(input_text, expected_output):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user