Industrial-strength NLP library for Python and Cython, offering tokenization, pretrained pipelines and trained models for tagging, parsing and entity recognition.
cardmagic/classifier
A Ruby text classification gem offering Naive Bayes, LSI, k-Nearest Neighbors, Logistic Regression and TF-IDF, with CLI tools.
- Stars
- 741
- Forks
- 124
- Open issues
- 9
- Last commit
- 7 days ago
What is it?
Classifier is a Ruby gem for text classification. It bundles five approaches: Naive Bayes, Latent Semantic Indexing (LSI), k-Nearest Neighbors, Logistic Regression, and TF-IDF vectorization, so you can pick a method that fits your data and task.
The gem includes a native C extension for LSI operations, with a pure Ruby fallback when the extension is unavailable. LSI supports incremental document addition using Brand's algorithm, avoiding a full index rebuild on each new document. Training can stream from large files, and trained models can be persisted to files, Redis, S3, SQL databases, or custom storage.
It also installs two command line tools. The `classifier` command runs pre-trained models such as spam or sentiment detection, or trains and applies your own models. The `keywords` command fits a TF-IDF vocabulary and scores term importance in text.
Key features
- 01Five classifiers: Naive Bayes, LSI, k-Nearest Neighbors, Logistic Regression, and TF-IDF.
- 02Incremental LSI that adds documents without a full index rebuild.
- 03Native C extension for LSI with a pure Ruby fallback.
- 04Streaming training for large datasets.
- 05Pluggable persistence to file, Redis, S3, SQL, or custom storage.
- 06Command line tools `classifier` and `keywords`, including pre-trained models.
Use cases
- Filtering spam or classifying support messages inside a Ruby application.
- Running sentiment or emotion detection from the command line with pre-trained models.
- Finding similar documents with LSI for simple search or recommendation.
- Extracting distinctive keywords from articles or corpora with TF-IDF.
Quick start
- 1
Add the gem to your Gemfile
gem 'classifier' - 2
Or install the CLI via Homebrew
brew install classifier - 3
Classify text with a pre-trained model
classifier -r sms-spam-filter "You won a free iPhone"
Things to know
- The native C extension speeds up LSI, and the gem falls back to pure Ruby when it is unavailable.
In collections
Topics
FAQ
- What is classifier?
- A Ruby text classification gem offering Naive Bayes, LSI, k-Nearest Neighbors, Logistic Regression and TF-IDF, with CLI tools. Classifier is a Ruby gem for text classification. It bundles five approaches: Naive Bayes, Latent Semantic Indexing (LSI), k-Nearest Neighbors, Logistic Regression, and TF-IDF vectorization, so you can pick a method that fits your data and task.
- Is classifier free to use? What license does it have?
- classifier is open source under the Other license. Check the license terms before using it in commercial products.
- Is classifier still maintained?
- Actively maintained. The last commit to classifier was on Oct 31, 2026.
- What can I use classifier for?
- Filtering spam or classifying support messages inside a Ruby application. Running sentiment or emotion detection from the command line with pre-trained models. Finding similar documents with LSI for simple search or recommendation. Extracting distinctive keywords from articles or corpora with TF-IDF.
- How do I install classifier?
- Add the gem to your Gemfile: gem 'classifier' Or install the CLI via Homebrew: brew install classifier Classify text with a pre-trained model: classifier -r sms-spam-filter "You won a free iPhone"
- Where can I get classifier?
- The source code and installation instructions are on GitHub: https://github.com/cardmagic/classifier
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A non-autoregressive Python SDK that answers predefined classification and scoring questions over text or JSON, returning labels, scores and probabilities instead of free-form text.
A spaCy extension that plugs large language models into structured NLP pipelines for tasks like NER and text classification without training data.
Python library for text classification that learns new examples and new classes at runtime, with calibrated confidence and out-of-distribution detection.
A config-driven CLI for running and comparing LLM fine-tuning experiments across prompts, open-source models, and LoRA settings, with built-in output tests.
A 12-week, 26-lesson beginner curriculum on classic machine learning using Scikit-learn, with Python and R lessons and quizzes.