Skip to content

Commit 14c5d85

Browse files
authored
fix: force UTF-8 encoding on HTTP response body (#131)
Also adds prominent CLI documentation to README with examples of using pre-trained remote models. Bump version to 2.3.2
1 parent 76d3969 commit 14c5d85

File tree

4 files changed

+44
-3
lines changed

4 files changed

+44
-3
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
classifier (2.3.1)
4+
classifier (2.3.2)
55
fast-stemmer (~> 1.0)
66
matrix
77
mutex_m (~> 0.2)

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,47 @@ Text classification in Ruby. Five algorithms, native performance, streaming supp
2424
gem 'classifier'
2525
```
2626

27+
Or install via Homebrew for CLI-only usage:
28+
29+
```bash
30+
brew install classifier
31+
```
32+
33+
## Command Line
34+
35+
Classify text instantly with pre-trained models—no coding required:
36+
37+
```bash
38+
# Detect spam
39+
classifier classify "You won a free iPhone!" -r sms-spam-filter
40+
# => spam
41+
42+
# Analyze sentiment
43+
classifier classify "This movie was absolutely amazing!" -r imdb-sentiment
44+
# => positive
45+
46+
# Detect emotions
47+
classifier classify "I'm so happy today!" -r emotion-detection
48+
# => joy
49+
50+
# List all available models
51+
classifier models
52+
```
53+
54+
Train your own model:
55+
56+
```bash
57+
# Train from files
58+
classifier train positive reviews/good/*.txt
59+
classifier train negative reviews/bad/*.txt
60+
61+
# Classify new text
62+
classifier classify "Great product, highly recommend"
63+
# => positive
64+
```
65+
66+
[CLI Guide →](https://rubyclassifier.com/docs/guides/cli/basics)
67+
2768
## Quick Start
2869

2970
### Bayesian

lib/classifier/cli.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ def fetch_github_file(registry, file_path)
874874
return ''
875875
end
876876

877-
response.body
877+
response.body.force_encoding(Encoding::UTF_8)
878878
end
879879
end
880880
end

lib/classifier/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Classifier
2-
VERSION = '2.3.1'.freeze
2+
VERSION = '2.3.2'.freeze
33
end

0 commit comments

Comments
 (0)