• Stars
    star
    156
  • Rank 239,589 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 9 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

plugin to check for possible insensitive, inconsiderate language

retext-equality

Build Coverage Downloads Size Sponsors Backers Chat

retext plugin to check for possible insensitive, inconsiderate language.

Contents

What is this?

This package is a unified (retext) plugin to check for certain words that could be considered insensitive, or otherwise inconsiderate, in certain contexts.

When should I use this?

You can opt-into this plugin when you’re dealing with your own text and want to check for potential mistakes.

Install

This package is ESM only. In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with npm:

npm install retext-equality

In Deno with esm.sh:

import retextEquality from 'https://esm.sh/retext-equality@6'

In browsers with esm.sh:

<script type="module">
  import retextEquality from 'https://esm.sh/retext-equality@6?bundle'
</script>

Use

Say our document example.txt contains:

He’s pretty set on beating your butt for sheriff.

…and our module example.js looks as follows:

import {read} from 'to-vfile'
import {reporter} from 'vfile-reporter'
import {unified} from 'unified'
import retextEnglish from 'retext-english'
import retextEquality from 'retext-equality'
import retextStringify from 'retext-stringify'

const file = await unified()
  .use(retextEnglish)
  .use(retextEquality)
  .use(retextStringify)
  .process(await read('example.txt'))

console.error(reporter(file))

…now running node example.js yields:

example.txt
  1:1-1:5  warning  `He’s` may be insensitive, use `They`, `It` instead  he-she  retext-equality

âš  1 warning

API

This package exports no identifiers. The default export is retextEquality.

unified().use(retextEquality[, options])

Check for possible insensitive, inconsiderate language.

options

Configuration (optional).

options.ignore

List of phrases not to warn about (Array<string>).

options.noBinary

Do not allow binary references (boolean, default: false). By default he is warned about unless it’s followed by something like or she or and she. When noBinary is true, both cases will be warned about.

Messages

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:

message.source

Name of this plugin ('retext-equality').

message.ruleId

See id in rules.md.

message.actual

Current not ok phrase (string).

message.expected

Suggest ok phrase (Array<string>).

message.note

Extra info, when available (string?).

Types

This package is fully typed with TypeScript. It exports the additional type Options.

Compatibility

Projects maintained by the unified collective are compatible with all maintained versions of Node.js. As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+. Our projects sometimes work with older versions, but this is not guaranteed.

Related

Contributing

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.

To create new patterns, add them in the YAML files in the data/ directory, and run npm install and then npm test to build everything. Please see the current patterns for inspiration. New English rules will automatically be added to rules.md.

When you are happy with the new rule, add a test for it in test.js, and open a pull request.

License

MIT © Titus Wormer

More Repositories

1

retext

natural language processor powered by plugins part of the @unifiedjs collective
JavaScript
2,334
star
2

retext-keywords

plugin to extract keywords and key-phrases
JavaScript
322
star
3

awesome-retext

Curated list of awesome retext resources
108
star
4

retext-sentiment

plugin to detect sentiment
JavaScript
97
star
5

retext-simplify

plugin to check phrases for simpler alternatives
JavaScript
91
star
6

retext-readability

plugin to check readability
JavaScript
89
star
7

retext-spell

plugin to check spelling
JavaScript
68
star
8

retext-smartypants

plugin to implement SmartyPants
JavaScript
55
star
9

retext-profanities

plugin to check for profane and vulgar wording
JavaScript
44
star
10

retext-emoji

plugin to support emoji, gemoji, and emoticons
JavaScript
34
star
11

retext-pos

plugin to add part-of-speech (POS) tags
JavaScript
21
star
12

retext-indefinite-article

plugin to check if indefinite articles (a and an) are used correctly
JavaScript
20
star
13

retext-intensify

plugin to check for weak and mitigating wording
JavaScript
17
star
14

retext-passive

plugin to check for passive voice
JavaScript
15
star
15

retext-repeated-words

plugin to check for for repeated words
JavaScript
13
star
16

retext-syntax-mentions

plugin to classify @mentions as syntax, not natural language
JavaScript
10
star
17

retext-sentence-spacing

plugin to check spacing between sentences
JavaScript
10
star
18

retext-quotes

plugin to check quotes and apostrophes
JavaScript
10
star
19

retext-syntax-urls

plugin to classify url-like values as syntax, not natural language
JavaScript
9
star
20

retext-contractions

plugin to check apostrophes in elided contractions
JavaScript
8
star
21

retext-diacritics

plugin to check for proper use of diacritics
JavaScript
6
star
22

retext-redundant-acronyms

plugin to check for redundant acronyms (such as ATM machine to ATM)
JavaScript
5
star
23

ideas

Share ideas for new utilities and tools built with @retextjs
3
star
24

.github

Community health files for retext
2
star