We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using obscenity to censor a string containing an emoji, like this one: 🤣bummer, and a dataset that contains the word bummer.
obscenity
🤣bummer
bummer
Using this strategy,
const CENSOR_STRATEGY = (censorContext) => ''.repeat(censorContext.matchLength);
for removing the profanities,
The expected output would be 🤣.
🤣
Instead, the output is this: 🤣b. It matches the word bummer correctly, BUT when the matcher tries to find the matches, there's an error in the index.
🤣b
const { englishDataset, parseRawPattern, DataSet, RegExpMatcher, } = require('obscenity'); const data = new DataSet() .addAll(englishDataset) .addPhrase(phrase => phrase .setMetadata({ originalWord: 'bummer' }) .addPattern(parseRawPattern('bummer')) ).build(); const matcher = new RegExpMatcher({ ...profanityDataset, // no transformers }); const stringBummer = '🤣bummer'; if (matcher.hasMatch(stringBummer)) { const matches = matcher.getAllMatches(stringBummer, true); return textCensor.applyTo(stringBummer, matches); } return stringBummer;
No response
18.17.1
0.3.1
The text was updated successfully, but these errors were encountered:
Thanks for the short repro. I think I know what the issue is and will take a stab at fixing it today.
Sorry, something went wrong.
3a49579
Fix released in v0.4.0.
No branches or pull requests
Expected behavior
Using
obscenity
to censor a string containing an emoji, like this one:🤣bummer
, and a dataset that contains the wordbummer
.Using this strategy,
for removing the profanities,
The expected output would be
🤣
.Actual behavior
Instead, the output is this:
🤣b
. It matches the wordbummer
correctly, BUT when the matcher tries to find the matches, there's an error in the index.Minimal reproducible example
Steps to reproduce
No response
Additional context
No response
Node.js version
18.17.1
Obscenity version
0.3.1
Priority
Terms
The text was updated successfully, but these errors were encountered: