Natural language processing from the command line, using native macOS APIs. Language detection, sentiment analysis, part-of-speech tagging, named entity recognition, structured entity extraction (phone numbers, emails, addresses, dates, flight numbers), spelling and grammar checking, and tokenization. All on-device, no API keys, no network calls.
$ echo "Bonjour le monde" | lingua detect
fr [0.98]
$ echo "The food was absolutely incredible" | lingua sentiment
1.0000
$ echo "Call 800-555-1212 or email [email protected] on March 3rd" | lingua entities
phone: 800-555-1212
email: [email protected]
date: March 3rd
$ echo "He go to the store yesterday." | lingua grammar
grammar: The word ‘go’ may not agree with the rest of the sentence. [3,2]
grammar and spell use the same engine behind TextEdit's squiggles and
behave like linters: exit 0 when clean, exit 1 when they find something, so
they drop straight into git hooks and CI.
Reads from stdin, writes to stdout. Pipes with curl, tezcatl,
or anything else:
# Extract phone numbers from a webpage
curl -s https://example.com | lingua entities --type=phone
# Detect language of a rendered JS page
tezcatl https://example.com | lingua detect
# Score sentiment per sentence
echo "I love this. I hate that." | lingua sentiment --per-sentence
1.0000 I love this.
-0.6000 I hate that.
All commands support --json for scripting.
Wraps Apple's NaturalLanguage framework, NSSpellChecker, and NSDataDetector via Objective-C runtime bindings --- no Swift, no Objective-C source files.
brew install georgemandis/tap/lingua