From f63c6bcbacff4e6878b79de0cb26aa004626566c Mon Sep 17 00:00:00 2001 From: Lucas Carlson Date: Thu, 1 Jan 2026 10:38:21 -0800 Subject: [PATCH] fix: force UTF-8 encoding on HTTP response body Also adds prominent CLI documentation to README with examples of using pre-trained remote models. Bump version to 2.3.2 --- Gemfile.lock | 2 +- README.md | 41 +++++++++++++++++++++++++++++++++++++++ lib/classifier/cli.rb | 2 +- lib/classifier/version.rb | 2 +- 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index fd9689a..8d4fa65 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - classifier (2.3.1) + classifier (2.3.2) fast-stemmer (~> 1.0) matrix mutex_m (~> 0.2) diff --git a/README.md b/README.md index 0c32733..8d3d4de 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,47 @@ Text classification in Ruby. Five algorithms, native performance, streaming supp gem 'classifier' ``` +Or install via Homebrew for CLI-only usage: + +```bash +brew install classifier +``` + +## Command Line + +Classify text instantly with pre-trained models—no coding required: + +```bash +# Detect spam +classifier classify "You won a free iPhone!" -r sms-spam-filter +# => spam + +# Analyze sentiment +classifier classify "This movie was absolutely amazing!" -r imdb-sentiment +# => positive + +# Detect emotions +classifier classify "I'm so happy today!" -r emotion-detection +# => joy + +# List all available models +classifier models +``` + +Train your own model: + +```bash +# Train from files +classifier train positive reviews/good/*.txt +classifier train negative reviews/bad/*.txt + +# Classify new text +classifier classify "Great product, highly recommend" +# => positive +``` + +[CLI Guide →](https://rubyclassifier.com/docs/guides/cli/basics) + ## Quick Start ### Bayesian diff --git a/lib/classifier/cli.rb b/lib/classifier/cli.rb index 33d792c..6c67394 100644 --- a/lib/classifier/cli.rb +++ b/lib/classifier/cli.rb @@ -874,7 +874,7 @@ def fetch_github_file(registry, file_path) return '' end - response.body + response.body.force_encoding(Encoding::UTF_8) end end end diff --git a/lib/classifier/version.rb b/lib/classifier/version.rb index f52573d..8f022dc 100644 --- a/lib/classifier/version.rb +++ b/lib/classifier/version.rb @@ -1,3 +1,3 @@ module Classifier - VERSION = '2.3.1'.freeze + VERSION = '2.3.2'.freeze end