retext plugin to check for profane and vulgar
wording.
Uses cuss
for sureness.
npm:
npm install retext-profanities
Say we have the following file, example.txt
:
He’s pretty set on beating your butt for sheriff.
…and our script, example.js
, looks like this:
var vfile = require('to-vfile')
var report = require('vfile-reporter')
var unified = require('unified')
var english = require('retext-english')
var stringify = require('retext-stringify')
var profanities = require('retext-profanities')
unified()
.use(english)
.use(profanities)
.use(stringify)
.process(vfile.readSync('example.txt'), function(err, file) {
console.error(report(err || file))
})
Now, running node example
yields:
example.txt
1:33-1:37 warning Be careful with “butt”, it’s profane in some cases butt retext-profanities
⚠ 1 warning
check for profane and vulgar wording.
Uses cuss
for sureness.
Phrases not to warn about (Array.<string>
, default: []
).
Minimum sureness to warn about, see cuss
(number
, default: 0
).
See rules.md
for a list of rules.
Note that Latin-script Arabic (retext-profanities/ar-latn
), French
(retext-profanities/fr
), Spanish (retext-profanities/es
), Italian
(retext-profanities/it
), and Brazilian Portuguese (retext-profanities/pt-br
)
are also supported.
See rules.md
for a list of rules and how rules work.
Each message is emitted as a VFileMessage
on file
, with the
following fields:
Name of this plugin ('retext-profanities'
).
See id
in rules.md
.
Cuss sureness (number
).
Profane phrase (string
).
Empty array to signal that actual
should be removed or changed ([]
).
retext-equality
— Check possible insensitive, inconsiderate languageretext-passive
— Check passive voiceretext-simplify
— Check phrases for simpler alternatives
See contributing.md
in retextjs/.github
for ways
to get started.
See support.md
for ways to get help.
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.