Skip to content

request: run blacklist and whitelist through transformers #109

Description

@eltoder

Description

Patterns in the blacklist and whitelist are normally written in their natural spelling, for example "hello". However, in the actual use, the input text is first passed through a chain of transformers. These transformers can prevent some patterns from matching. For example, collapseDuplicatesTransformer can transform "hello" into "helo", which will prevent the pattern "hello" from matching. This is highlighted in the documentation. To avoid the issue, the default English preset leaves several letters duplicated (up to 2 characters). But this causes another issue -- now it is possible to evade the filter for words that have these characters by duplicating them. The original issue is also not fully fixed -- if someone adds a pattern that has a duplicate of another character (not one of "beolsg"), their pattern will not match with the default preset.

Solution

The idea is to run the patterns through the transformers. This way duplicate characters in the patterns will also be collapsed and so they will match deduplicated text. Patterns contain more than literal text, so one has to be careful not to break metacharacters, but I think this is quite doable.

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions