You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
retext is a tool that transforms natural language with plugins.
These plugins can inspect and change the natural language.
You can use retext on the server, the client, deno, etc.
Intro
retext is an ecosystem of plugins that work with natural language as structured
data, specifically CSTs (concrete syntax trees).
Syntax trees make it easy for programs to deal with prose.
We call those programs plugins.
Plugins inspect and change trees.
You can use the many existing plugins or you can make your own.
Some example use cases are to check spelling,
fix typography, or
make sure text is readable.
constfile=awaitunified() .use(retextEnglish) .use(retextRedundantAcronyms) .use(retextStringify) .process('Where can I find an ATM machine?')
console.log(reporter(file))
...and you can make your own plugins.
You can use retext for many different things.
unified is the core project that transforms content with ASTs.
retext adds support for natural language to unified.
nlcst is the natural language AST that retext uses.
This GitHub repository is a monorepo that contains the following packages:
retext-dutch
-- parse Dutch prose to a syntax tree
retext
-- programmatic interface with both retext-latin and retext-stringify
When should I use this?
It is recommended to use unified with retext-english (or retext-dutch)
and retext-stringify if your content is in English (or Dutch).
Otherwise, if your content is in another Latin-script language, use retext.
Plugins
retext plugins deal with natural language.
You can choose from the many plugins that already exist.
Here are three good ways to find plugins:
awesome-retext
-- selection of the most awesome projects
Some plugins are maintained by us here in the @retextjs organization while
others are maintained by folks elsewhere.
Anyone can make retext plugins, so as always when choosing whether to include
dependencies in your project, make sure to carefully assess the quality of
retext plugins too.
Types
The retext organization and the unified collective as a whole is fully typed
with TypeScript.
Types for nlcst are available in @types/nlcst.
For TypeScript to work, it is important to type your plugins.
For example:
Projects maintained by the unified collective are compatible with maintained
versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line compatible with Node.js 16.