Censor words should support sentence level censoring for Chinese

(Erick Guan) #1

CJKV doesn’t have word boundaries. It’s more reliable to use the feature with a sentence level. In a word, support this feature without word boundaries.

Suggested: (Chinese) 推荐主题、 危禁词要是支持中文就好了 - 支持 - Discourse中文论坛

(Stephen Chung) #2

There is a discussion here:

(Stephen Chung) #4

If you can do a custom build of discourse, it is a simple matter to change that one line of code to remove the wrapping \b's.

In the long term, I suggest removing them as default, or at least add a site setting for those of us running non-English forums.

(Jay Pfaffman) #5

You could create a plugin to do that and/or submit a PR.

(Stephen Chung) #6

Unfortunately a plugin requires quite a bit of Ruby knowledge. I can debug, but probably not even close to writing plugins.

A PR would require that I fork the entire repo, which is ok except I have no way to test it. It is bad form to submit a PR without testing…

(Evgeny) #7

There’s really not enough to remove one line. It is necessary to completely rewrite the logic file. I gave there a working version of the file (using loops).

(Stephen Chung) #8

Well, not to remove the line, but to remove the \b's in the line.

Regexp will never work for all languages with word breaks. The best you can do is to allow the user to decide which words require word breaks and which do not.

With the \b wrapper hard-coded in right now, there is no choice.

(Stephen Chung) #9

This issue is now solved by:

To match Chinese patterns, turn on Settings > Posting > watched words regular expressions.

Beware, your Watched Words will now be raw regular expressions, so if your list includes English words, you’ll need to put in your own word break \b where necessary.

(Joshua Rosenfeld) #10

This topic was automatically closed after 40 hours. New replies are no longer allowed.