이것은 유용한 모더레이션 도구이지만, 영어 외 문자에 대한 지원이 부족하며, 영어 외 문자의 존재는 영어와 숫자의 감지에도 영향을 미칠 수 있습니다. 여기서는 간체 중국어 단어 “测试”(테스트)를 예로 들어, 감시 단어 목록에는 “测试”, “Test”, "123"의 세 가지 요소가 포함되어 있습니다. 아래 테스트에서 세 가지 예시 중 어느 것도 감시 단어를 트리거하지 않았습니다.
사이트 내에서 검색한 결과, 검열 단어와 관련된 유사한 문제를 발견했습니다: Censored words do not respect word boundaries in non-latin alphabet . 이것은 전체 감시 단어 매칭 시스템 전반에 걸친 일반적인 문제인 것 같습니다.
2개의 좋아요
리포트 감사합니다. 다음을 통해 수정될 예정입니다.
main ← fix/watched-words-cjk-boundaries
merged 05:04PM - 16 Feb 26 UTC
Watched words failed to match in CJK (Chinese, Japanese, Korean) and other space… less scripts because word boundary detection relied on whitespace or non-word characters. Languages like Chinese don't use spaces between words, so "测试" inside "这是一个测试文本" was never matched.
Introduce a SPACELESS_SCRIPTS constant covering Han, Hiragana, Katakana, Hangul, Thai, Lao, Myanmar, Khmer, and Tibetan Unicode ranges. Update `match_word_regexp` for both Ruby and JS engines so that characters from these scripts are treated as word boundaries. This allows a CJK watched word to match when surrounded by other CJK characters, and a Latin watched word to match when adjacent to CJK text (e.g., "Test" in "我的Test很好"), while still preventing partial Latin matches (e.g., "Testing" does not match "Test").
Also fix the admin watched word testing modal to use `RegExp.exec()` with capture group extraction instead of `String.match()`, since the new boundary patterns include a leading consuming group.
Remove the outdated "non-chrome browsers do not support lookbehind" comment — all major browsers have supported lookbehind since 2023.
https://meta.discourse.org/t/71288
https://meta.discourse.org/t/396109
2개의 좋아요