Socket
Socket
Sign inDemoInstall

retext

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

retext

natural language processor powered by plugins part of the unified collective


Version published
Weekly downloads
355K
increased by7.13%
Maintainers
1
Weekly downloads
 
Created

What is retext?

Retext is a natural language processing (NLP) framework for analyzing and manipulating text. It provides a variety of plugins to perform tasks such as spell checking, sentiment analysis, and readability scoring.

What are retext's main functionalities?

Spell Checking

This feature allows you to check the spelling of text. The code sample demonstrates how to use the `retext-spell` plugin with an English dictionary to identify spelling errors in a given text.

const retext = require('retext');
const retextSpell = require('retext-spell');
const dictionary = require('dictionary-en');
const report = require('vfile-reporter');

retext()
  .use(retextSpell, dictionary)
  .process('speling errror', function (err, file) {
    console.error(report(err || file));
  });

Sentiment Analysis

This feature allows you to analyze the sentiment of text. The code sample demonstrates how to use the `retext-sentiment` plugin to determine the sentiment polarity and valence of a given text.

const retext = require('retext');
const retextSentiment = require('retext-sentiment');
const report = require('vfile-reporter');

retext()
  .use(retextSentiment)
  .process('I love programming!', function (err, file) {
    console.error(report(err || file));
    console.log(file.data); // { polarity: 3, valence: 1 }
  });

Readability Scoring

This feature allows you to score the readability of text. The code sample demonstrates how to use the `retext-readability` plugin to determine the readability age of a given text.

const retext = require('retext');
const retextReadability = require('retext-readability');
const report = require('vfile-reporter');

retext()
  .use(retextReadability, { age: 18 })
  .process('The cat sat on the mat.', function (err, file) {
    console.error(report(err || file));
    console.log(file.data); // { readability: { age: 6 } }
  });

Other packages similar to retext

Keywords

FAQs

Package last updated on 06 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc