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
importassertfrom'node:assert'import{englishDataset,englishRecommendedTransformers,RegExpMatcher,}from'obscenity'constmatcher=newRegExpMatcher({
...englishDataset.build(),
...englishRecommendedTransformers,})assert.equal(matcher.hasMatch('Kung-Fu'),false)assert.equal(matcher.hasMatch('Kung Fu'),false)assert.equal(matcher.hasMatch('Kung Fu Panda'),false)// This one actually worksassert.equal(matcher.hasMatch('KungFu'),false)
Steps to reproduce
Run the code above
It falls with assert exception
Additional context
No response
Node.js version
v20.15.0
Obscenity version
0.2.1
Priority
Low
Medium
High
Terms
I agree to follow the project's Code of Conduct.
I have searched existing issues for similar reports.
The text was updated successfully, but these errors were encountered:
The default dataset contains the pattern |fu|, which (correctly, but undesirably) matches on the -Fu in Kung-Fu. There are two potential ways we could fix this issue:
Remove the |fu| pattern entirely, or
Whitelist Kung-Fu and leave the |fu| pattern untouched.
I am leaning toward 2) at the moment: the |fu| pattern seems useful in general, and I cannot think of any other egregious false positives other than the instance you report. What do you think?
I think that whitelisting Kung-Fu is a good option here. Also, it is possible to handle any future false positives by adding them to the whitelist as they arise.
I released v0.3.1 with the fix (please ignore v0.2.2 and v0.3.0, both of which were problematic due to my botching some release automation—sorry for the noise!). Thanks again for the report.
Expected behavior
matcher.hasMatch('Kung-Fu') returns true
Actual behavior
matcher.hasMatch('Kung-Fu') returns false
Minimal reproducible example
Steps to reproduce
Additional context
No response
Node.js version
v20.15.0
Obscenity version
0.2.1
Priority
Terms
The text was updated successfully, but these errors were encountered: