A lightweight JavaScript library for natural language processing that transforms text into structured data with a modest, pragmatic approach.
Compromise is a lightweight natural language processing library for JavaScript that transforms text into structured data. It provides tools for tokenization, part-of-speech tagging, pattern matching, and text manipulation, solving the problem of parsing and using text in a practical, browser-friendly way.
JavaScript developers building applications that need text analysis, such as chatbots, content editors, data extraction tools, or educational software, without the overhead of heavy NLP frameworks.
Developers choose Compromise for its small bundle size (~250kb), fast performance suitable for real-time use, and pragmatic approach that balances accuracy with simplicity, making it ideal for client-side and moderate-scale NLP tasks.
modest natural-language processing
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
At ~250kb minified, it processes text quickly enough for real-time use in browsers, as shown in performance graphs where it can handle keypress events.
Offers partial builds like compromise/one for tokenization, compromise/two for tagging, and compromise/three for phrase tooling, allowing developers to include only what they need.
Includes built-in methods for transformations like changing verb tenses, pluralizing nouns, and adjusting numbers, demonstrated in examples such as converting 'she sells' to 'she sold'.
Supports custom plugins for adding words, tags, and methods, enabling easy customization and integration with libraries like compromise-dates or compromise-stats.
The library explicitly states it makes 'limited and sensible decisions' and is 'not as smart as you'd think,' which can lead to errors in complex or nuanced text analysis.
While there are work-in-progress forks for other languages, core support is optimized for English, making it less suitable for multilingual projects without additional effort.
Admits limitations such as poor slash-support (e.g., 'eats/shoots/leaves' not parsed as a unit) and no inter-sentence matching without plugins, which can hinder certain use cases.