Registry / serialization / parse-english

parse-english

JSON →
library7.0.0jsnpmunverified

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-english
INSTALL
IMPORT
SIG · PARSE-ENGLISH
P
parse-english
serializationjavascriptv7.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ParseEnglish
import { ParseEnglish } from 'parse-english'
const ParseEnglish = require('parse-english')
Package is ESM-only since v5.0.0. CommonJS `require` will fail. `ParseEnglish` is a named export, not a default export.
ParseEnglish as Parser
import { ParseEnglish as Parser } from 'parse-english'
The primary export is a class named `ParseEnglish`. Aliasing is often used for clarity or to avoid naming conflicts.
RootNode (Type)
import type { RootNode } from 'nlcst'
While `parse-english` produces NLCST, the core NLCST types (like `RootNode`) are typically imported directly from the `nlcst` package or `@types/nlcst` rather than re-exported from `parse-english`.

Demonstrates how to instantiate `ParseEnglish` and parse a string into an NLCST tree, then inspect its structure.

import { ParseEnglish } from 'parse-english'; import { inspect } from 'unist-util-inspect'; // Create a new parser instance const parser = new ParseEnglish(); // The text to parse const textToParse = 'Hello Mr. Smith. This is a sentence about the City of London and its worker\'s rights.'; // Parse the text into an NLCST syntax tree const tree = parser.parse(textToParse); // Log the inspected tree to see its structure console.log(inspect(tree)); // You can also access the root node directly for further processing // For example, to get the type of the root node: // console.log(tree.type); // To get the children of the root node: // console.log(tree.children);
Debug
Known issues
breakingVersion 7.0.0 requires Node.js 16 or later. Previous versions supported older Node.js runtimes.
fix
Ensure your project's Node.js version is 16 or higher. Update your `engines` field in `package.json` if necessary: `"engines": { "node": ">=16" }`.
affects: >=7.0.0
breakingSince v5.0.0, `parse-english` is an ESM-only package. CommonJS `require()` statements will result in errors.
fix
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');`.
affects: >=5.0.0
breakingVersion 7.0.0 changed to use `exports` field in `package.json`, which affects how imports might resolve, particularly for internal or non-standard paths.
fix
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.
affects: >=7.0.0
breakingVersion 6.0.0 introduced types (TypeScript) and updated its dependency `parse-latin` to 6.0.0, which also contained breaking changes related to its parsing behavior or API.
fix
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.
affects: >=6.0.0
gotchaThe package `parse-english` extends `ParseLatin`. If you're encountering unexpected parsing behavior or need to customize parsing logic, you might need to consult the `parse-latin` documentation for its API and algorithms.
fix
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`.
affects: All
Errors
Common errors & fixes
SyntaxError: Cannot use import statement outside a module
Attempting to use `import` syntax in a CommonJS (`.js` without `"type": "module"` or `.cjs`) file.
fix
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');`.
TypeError: ParseEnglish is not a constructor
Attempting to call `ParseEnglish()` without `new`, or incorrectly importing it.
fix
Ensure `ParseEnglish` is imported as a named export: `import { ParseEnglish } from 'parse-english';`. Then, instantiate it using the `new` keyword: `const parser = new ParseEnglish();`.
ERR_PACKAGE_PATH_NOT_EXPORTED
Attempting to import a non-public API path (e.g., `parse-english/lib/some-internal-module`) due to the `exports` field in `package.json`.
fix
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.
Upgrade
Version history
7.0.0latest on npm
Audit
Dependencies
parse-latinrequiredparse-english extends and builds upon the parsing logic of parse-latin for Latin-script languages.
@types/nlcstrequiredUsed for TypeScript type definitions for NLCST nodes.
unist-util-inspectoptionalUsed in examples for inspecting the generated AST.
Agent activity
2 hits · last 30 days
node
2
Resources
parse-english — npm install parse-english · libregistry