You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
text = "郭麒麟打卡,且听他分享防疫小知识https://www.zhihu.com/qution/319823639哈哈http//t.cn/a67ov8bt哈哈哈http://t.c"
cleantext.replace_urls(text, "XXX")
I came across this issue and found it really interesting, especially since it involves handling URLs within Chinese text.
I’m a high school student with some experience in Python and GitHub. Since I’m a native Chinese speaker, I’m very familiar with how URLs often appear in Chinese sentences (like appearing without spaces or with typos like “http//”).
I’d love to take a crack at fixing this! I’m also keen on helping improve the library’s Chinese support in the long run. If I eventually find that I cannot fix it, please also forgive me
Could you please assign this issue to me? I’m happy to follow any contributing guidelines you have.
While working on it, I realized that Chinese and CJK languages really need special handling because we don't use spaces between words. The fix I implemented extracts the CJK characters from mixed URLs and successfully supports all three CJK languages (Chinese, Japanese, and Korean).
Regarding the "http//" typo mentioned in the original issue, I decided not to write specific code to clean it. After reading through the project's files, I felt that fixing typos might be out of scope for the URL replacement logic. I'd love to hear if my thinking is correct here!
Activity
jfilter commentedon Aug 26, 2021
Hey @lemon234071, thanks for reporting. I'm not sure how to handle this. Right now, the URL has to be somehow separated from other tokes (e.g. by a preceding space). In your string, the URLs could be detected by using the ASCII characters in the string. Maybe this can be useful to add a special handling for Chinese texts? I would not adapt the current URL regex for English (etc.). https://github.com/jfilter/clean-text/blob/master/cleantext/constants.py#L62
stellarissss commentedon Jul 6, 2026
Hi @jfilter,
I came across this issue and found it really interesting, especially since it involves handling URLs within Chinese text.
I’m a high school student with some experience in Python and GitHub. Since I’m a native Chinese speaker, I’m very familiar with how URLs often appear in Chinese sentences (like appearing without spaces or with typos like “http//”).
I’d love to take a crack at fixing this! I’m also keen on helping improve the library’s Chinese support in the long run.
If I eventually find that I cannot fix it, please also forgive meCould you please assign this issue to me? I’m happy to follow any contributing guidelines you have.
Thanks!
jfilter commentedon Jul 6, 2026
@stellarissss do it thanks
stellarissss commentedon Jul 7, 2026
Hi @jfilter,
I just submitted a PR to address this issue!
While working on it, I realized that Chinese and CJK languages really need special handling because we don't use spaces between words. The fix I implemented extracts the CJK characters from mixed URLs and successfully supports all three CJK languages (Chinese, Japanese, and Korean).
Regarding the "http//" typo mentioned in the original issue, I decided not to write specific code to clean it. After reading through the project's files, I felt that fixing typos might be out of scope for the URL replacement logic. I'd love to hear if my thinking is correct here!
Thanks again for your time!