Duplicate false negatives and profanities break censoring #31

Closed
opened 2022-05-01 16:47:13 -04:00 by TwiN · 0 comments
TwiN commented 2022-05-01 16:47:13 -04:00 (Migrated from github.com)

Describe the bug

When a string has two false negatives and two profanities, the string is not censored properly.

What do you see?

println(goaway.Censor("document fuck document fuck"))

outputs

document **** ****ment fuck

For verbosity, note that by default, document is a false positive (meaning it should not be censored) and fuck is a profanity.

What do you expect to see?

The output should be:

document **** document ****

List the steps that must be taken to reproduce this issue

  1. Uncomment the test case that can be found at TwiN/go-away@3bf4c7a7e9/goaway_test.go (L148-L152)
  2. Run the tests
  3. Note how the new test case is failing

Version

v1.6.3

Additional information

I found this out while investigating #30

### Describe the bug When a string has two false negatives and two profanities, the string is not censored properly. ### What do you see? ```go println(goaway.Censor("document fuck document fuck")) ``` outputs ``` document **** ****ment fuck ``` For verbosity, note that by default, `document` is a false positive (meaning it should not be censored) and `fuck` is a profanity. ### What do you expect to see? The output should be: ``` document **** document **** ``` ### List the steps that must be taken to reproduce this issue 1. Uncomment the test case that can be found at https://github.com/TwiN/go-away/blob/3bf4c7a7e93678e0190ee33dc588d7e87eae609a/goaway_test.go#L148-L152 2. Run the tests 3. Note how the new test case is failing ### Version v1.6.3 ### Additional information I found this out while investigating #30
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
TwiN/go-away#31
No description provided.