Skip to content

Update filter.js to clean matching whole word#14

Open
sriram-Ghub wants to merge 1 commit intojwils0n:masterfrom
sriram-Ghub:patch-1
Open

Update filter.js to clean matching whole word#14
sriram-Ghub wants to merge 1 commit intojwils0n:masterfrom
sriram-Ghub:patch-1

Conversation

@sriram-Ghub
Copy link

created new method "cleanWholeWord" to always replace whole matching profanity word in a sentence against the profanity dictionary.

created new method "cleanWholeWord" to always replace whole matching profanity word in a sentence against the profanity dictionary.
@sriram-Ghub
Copy link
Author

sriram-Ghub commented Mar 27, 2024

Going by the filter.js what i see after installing the node package, the module performs matching for profanity words in a case-sensitive manner. However, I've noticed that this approach may overlook instances where profanity words are not in the expected case.

Additionally, the module replaces profanity words regardless of whether they appear as whole words or as part of a larger word. This behaviour may lead to unintended replacements in cases where a profanity word is part of another word.

To address these concerns, I propose two enhancements with my new method cleanWholeWord()

Case-Insensitive Matching: Adding case-insensitive matching to the profanity filter would ensure that the filter captures all variations of the profanity words, regardless of their case.

Whole Word Matching: Limiting replacements to instances where profanity words appear as whole words would prevent unintended replacements when profanity words are part of larger words.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant