Skip to content

Commit ad51d19

Browse files
committed
docs(readme): fix examples reliant on non-alphabetic stripping
See #46.
1 parent 3c58e14 commit ad51d19

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
## Why Obscenity?
1212

1313
- **Accurate:** Though Obscenity is far from perfect (as with all profanity filters), it makes reducing false positives as simple as possible: adding whitelisted phrases is as easy as adding a new string to an array, and using word boundaries is equally simple.
14-
- **Robust:** Obscenity's transformer-based design allows it to match on variants of phrases other libraries are typically unable to, e.g. `f...u c k`, `fuuuuuuuckkk`, `ʃṳ𝒸𝗄`, `wordsbeforefuckandafter` and so on. There's no need to manually write out all the variants either: just adding the pattern `fuck` will match all of the cases above by default.
14+
- **Robust:** Obscenity's transformer-based design allows it to match on variants of phrases other libraries are typically unable to, e.g. `fuuuuuuuckkk`, `ʃṳ𝒸𝗄`, `wordsbeforefuckandafter` and so on. There's no need to manually write out all the variants either: just adding the pattern `fuck` will match all of the cases above by default.
1515
- **Extensible:** With Obscenity, you aren't locked into anything - removing phrases that you don't agree with from the default set of words is trivial, as is disabling any transformations you don't like (perhaps you feel that leet-speak decoding is too error-prone for you).
1616

1717
## Installation
@@ -60,7 +60,7 @@ Now, we can use our matcher to search for profanities in the text. Here's two ex
6060
**Check if there are any matches in some text:**
6161

6262
```javascript
63-
if (matcher.hasMatch('f.uck you')) {
63+
if (matcher.hasMatch('fuck you')) {
6464
console.log('The input text contains profanities.');
6565
}
6666
// The input text contains profanities.
@@ -70,7 +70,7 @@ if (matcher.hasMatch('f.uck you')) {
7070

7171
```javascript
7272
// Pass "true" as the "sorted" parameter so the matches are sorted by their position.
73-
const matches = matcher.getAllMatches('ʃ𝐟ʃὗƈk ỹоứ 𝔟!!!ⁱẗ𝙘ɦ', true);
73+
const matches = matcher.getAllMatches('ʃ𝐟ʃὗƈk ỹоứ 𝔟ⁱẗ𝙘ɦ', true);
7474
for (const match of matches) {
7575
const { phraseMetadata, startIndex, endIndex } =
7676
englishDataset.getPayloadWithPhraseMetadata(match);
@@ -79,7 +79,7 @@ for (const match of matches) {
7979
);
8080
}
8181
// Match for word fuck found between 0 and 6.
82-
// Match for word bitch found between 12 and 21.
82+
// Match for word bitch found between 12 and 18.
8383
```
8484

8585
**Censoring matched text:**

0 commit comments

Comments
 (0)