Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

parse-english

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-english

English (natural language) parser build on TextOM

  • 0.0.24
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

parse-english Build Status Coverage Status

browser support

See Browser Support for more information (a.k.a. don’t worry about those grey icons above).


parse-english is an English language parser in JavaScript. Build on top of TextOM. NodeJS, and the browser. Lots of tests (330+), including 630+ assertions. 100% coverage.

Note: This project is not an object model for natural languages, or an extensible system for analysing and manipulating natural language, its an algorithm that transforms plain-text natural language into an object model. If you need the above-mentioned functionalities, use the following projects.

  • For a pluggable system for analysing and manipulating natural language, see retext.
  • For the object model used in parse-english, see TextOM;

Installation

NPM:

$ npm install parse-english

Component.js:

$ component install wooorm/parse-english

Usage

var parse = require('parse-english')(),
    rootNode;

// Simple sentence:
rootNode = parse('A simple, english sentence.');

// Unicode filled sentence:
rootNode = parse('The \xC5 symbol invented by A. J. A\u030Angstro\u0308m (1814, Lo\u0308gdo\u0308, \u2013 1874) denotes the length 10\u207B\xB9\u2070 m.');

// A (plain-text) file:
rootNode = parse(require('fs').readFileSync('./document.txt', 'utf-8'));

Note that the exported object is a function, which in turn returns brand-new parser and TextOM objects. There’s whole slew of issues that can arise from extending prototypes like (DOM) Node, NodeList, or Array—this feature however allows for multiple sandboxed environments (i.e., prototypes) without those disadvantages.

API

ParseEnglish(source?)

var parse = require('parse-english')(),
    rootNode = parse('A simple sentence.');

rootNode; // RootNode
rootNode.head; // ParagraphNode
rootNode.head.head; // SentenceNode
rootNode.head.head.head; // WordNode
rootNode.head.head.head.toString(); // "A"
rootNode.head.head.tail; // PunctuationNode
rootNode.head.head.tail.toString(); // "."

Parses a given (english) string into an object model.

  • source (null, undefined, or String): The english source to parse.

Browser Support

Pretty much every browser (available through browserstack) runs all parse-english unit tests.

License

MIT

Keywords

FAQs

Package last updated on 29 Jun 2014

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