From 2b80d523c0dd3245cbfb18de0a696a392f29bd92 Mon Sep 17 00:00:00 2001 From: dahlinomine <132731075+dahlinomine@users.noreply.github.com> Date: Fri, 27 Mar 2026 05:23:18 +0000 Subject: [PATCH] docs: add Contributing section to README --- README.md | 104 +++++------------------------------------------------- 1 file changed, 8 insertions(+), 96 deletions(-) diff --git a/README.md b/README.md index b783fdf..491170c 100644 --- a/README.md +++ b/README.md @@ -99,104 +99,16 @@ classifier.classify("Cheap pills!") # => "Spam" ```ruby classifier = Classifier::LogisticRegression.new(:positive, :negative) classifier.train(positive: "love amazing great wonderful") -classifier.train(negative: "hate terrible awful bad") -classifier.classify("I love it!") # => "Positive" -``` -[Logistic Regression Guide →](https://rubyclassifier.com/docs/guides/logisticregression/basics) - -### LSI (Latent Semantic Indexing) - -```ruby -lsi = Classifier::LSI.new -lsi.add(dog: "dog puppy canine bark fetch", cat: "cat kitten feline meow purr") -lsi.classify("My puppy barks") # => "dog" -``` -[LSI Guide →](https://rubyclassifier.com/docs/guides/lsi/basics) - -### k-Nearest Neighbors - -```ruby -knn = Classifier::KNN.new(k: 3) -%w[laptop coding software developer programming].each { |w| knn.add(tech: w) } -%w[football basketball soccer goal team].each { |w| knn.add(sports: w) } -knn.classify("programming code") # => "tech" -``` -[k-Nearest Neighbors Guide →](https://rubyclassifier.com/docs/guides/knn/basics) - -### TF-IDF - -```ruby -tfidf = Classifier::TFIDF.new -tfidf.fit(["Ruby is great", "Python is great", "Ruby on Rails"]) -tfidf.transform("Ruby programming") # => {:rubi => 1.0} -``` -[TF-IDF Guide →](https://rubyclassifier.com/docs/guides/tfidf/basics) - -## Key Features - -### Incremental LSI - -Add documents without rebuilding the entire index—400x faster for streaming data: - -```ruby -lsi = Classifier::LSI.new(incremental: true) -lsi.add(tech: ["Ruby is elegant", "Python is popular"]) -lsi.build_index - -# These use Brand's algorithm—no full rebuild -lsi.add(tech: "Go is fast") -lsi.add(tech: "Rust is safe") -``` - -[Learn more →](https://rubyclassifier.com/docs/guides/lsi/basics) - -### Persistence - -```ruby -classifier.storage = Classifier::Storage::File.new(path: "model.json") -classifier.save - -loaded = Classifier::Bayes.load(storage: classifier.storage) -``` - -[Learn more →](https://rubyclassifier.com/docs/guides/persistence/basics) - -### Streaming Training - -```ruby -classifier.train_from_stream(:spam, File.open("spam_corpus.txt")) -``` - -[Learn more →](https://rubyclassifier.com/docs/tutorials/streaming-training) - -## Performance - -Native C extension provides 5-50x speedup for LSI operations: - -| Documents | Speedup | -|-----------|---------| -| 10 | 25x | -| 20 | 50x | - -```bash -rake benchmark:compare # Run your own comparison -``` - -## Development - -```bash -bundle install -rake compile # Build native extension -rake test # Run tests -``` +classifier.train(negative: "hate terrible -## Authors +## Contributing -- **Lucas Carlson** - lucas@rufy.com -- **David Fayram II** - dfayram@gmail.com -- **Cameron McBride** - cameron.mcbride@gmail.com -- **Ivan Acosta-Rubio** - ivan@softwarecriollo.com +We welcome contributions! To get started: +1. Fork the repository and create your feature branch. +2. Run `bundle install` to install dependencies. +3. Ensure all tests pass by running `rake test`. +4. Submit a Pull Request with a clear description of your changes. ## License -[LGPL 2.1](LICENSE) +This library is released under the [LGPL-2.1 License](https://opensource.org/licenses/LGPL-2.1). \ No newline at end of file