← all repositories
spencermountain/compromise

NLP that admits it's not very smart

It turns text into structured data by making limited, sensible decisions rather than chasing perfect accuracy.

12.1k stars JavaScript Language Models
compromise
Not currently ranked — collecting fresh signals.
star history

What it does

Compromise is a JavaScript library that parses, tags, and mutates natural language. It can shift verbs to past tense, pluralize nouns, expand contractions like “gonna” into “going to,” match grammatical patterns such as #Adjective #Noun, and even add or subtract written numbers. The library splits into three tiers—compromise/one for tokenization, compromise/two for part-of-speech tagging, and the full package—so you pay only for the weight you need.

The interesting bit

It works mainly by conjugating forms from a ~14,000-word lexicon, keeping the bundle around 250 kb and fast enough to run on every keypress. The README itself warns that it is “not as smart as you’d think,” which is refreshingly honest for a tool that still implicitly matches “gonna” to “going to” and treats written numbers as arithmetic values.

Key highlights

  • Text mutates in place: verbs change tense, nouns change number, contractions expand, and written numbers support actual math.
  • Pattern matching uses part-of-speech tags like #Possessive #Noun to extract phrases without manual regex.
  • The tokenizer tier processes roughly a megabyte of text per second; the full library is small enough for client-side work.
  • Plugins such as compromise-speech add syllables and other metadata without bloating the core.
  • French, German, Italian, and Spanish variants live under the nlp-compromise organization.

Caveats

  • The library is deliberately modest: the README warns it is “not as smart as you’d think” and makes “limited and sensible decisions.”
  • Coverage is bounded by a ~14,000-word lexicon, so rare vocabulary and edge-case grammar may slip through.
  • It is explicitly pragmatic: the README describes it as “modest” and emphasizes speed and size over exhaustive linguistic coverage.

Verdict

Use this if you need to manipulate or query text in the browser without a heavyweight dependency. Skip it if you need exhaustive linguistic coverage or perfect parsing; the README is explicit that modesty is a feature, not a bug.

Frequently asked

What is spencermountain/compromise?
It turns text into structured data by making limited, sensible decisions rather than chasing perfect accuracy.
Is compromise open source?
Yes — spencermountain/compromise is open source, released under the MIT license.
What language is compromise written in?
spencermountain/compromise is primarily written in JavaScript.
How popular is compromise?
spencermountain/compromise has 12.1k stars on GitHub.
Where can I find compromise?
spencermountain/compromise is on GitHub at https://github.com/spencermountain/compromise.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.