parse-english is a specialized parser that converts English natural language text into a Natural Language Concrete Syntax Tree (NLCST). It builds upon `parse-latin` by adding specific support for English language features like unit abbreviations. The current stable version is 7.0.0. This package is part of the unifiedjs ecosystem, which tends to have a moderate release cadence, with major versions often introducing breaking changes related to Node.js version support, ESM migration, or underlying NLCST structure updates. It's designed for developers who need fine-grained control over text processing at the syntax tree level, offering a programmatic interface to analyze text structure before further processing, such as with `retext-english` which wraps this project for a higher-level abstraction. Its key differentiator is its focus on low-level NLCST generation specifically for English, integrating with the broader unified ecosystem.
npm install parse-englishVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to instantiate `ParseEnglish` and parse a string into an NLCST tree, then inspect its structure.
Ensure your project's Node.js version is 16 or higher. Update your `engines` field in `package.json` if necessary: `"engines": { "node": ">=16" }`.Convert your project to use ECMAScript Modules (ESM) syntax (`import ... from '...'`) or dynamically import the package if still using CommonJS in parts of your application: `const { ParseEnglish } = await import('parse-english');`.Always use the standard import path `import { ParseEnglish } from 'parse-english'`. Avoid using any private or deep import paths that are not explicitly documented as public APIs, as they may no longer be accessible.When upgrading to `parse-english@6.x.x`, review the changelog for `parse-latin@6.0.0` for any specific migration steps if you were relying on its internal behavior or types. If using TypeScript, ensure `@types/nlcst` is updated and review any type inference issues.
Refer to the `parse-latin` documentation for a deeper understanding of the core parsing logic, as `parse-english` builds directly on top of it. This includes understanding the `parse` method and potential options inherited from `ParseLatin`.
Ensure your Node.js project or file is configured for ESM. This typically means using `.mjs` file extension, or setting `"type": "module"` in your `package.json` and using `.js` files. Alternatively, dynamically import with `const { ParseEnglish } = await import('parse-english');`.Ensure `ParseEnglish` is imported as a named export: `import { ParseEnglish } from 'parse-english';`. Then, instantiate it using the `new` keyword: `const parser = new ParseEnglish();`.Only import from the main entry point: `import { ParseEnglish } from 'parse-english'`. Avoid deep imports into the package's internal structure, as they are not guaranteed to be stable or accessible.