Sha256: ad63ea7c5492fb82b72e1e6799ca6ec8fb0740263095cb7e80c72b3f78f88ebe
Contents?: true
Size: 1.46 KB
Versions: 4
Compression:
Stored size: 1.46 KB
Contents
module OmniCat module Classifiers class Base < ::OmniCat::Base # Allows adding multiple classification categories # # ==== Parameters # # * +names+ - Array of categories # # ==== Examples # # # Add multiple categories for classification # bayes.add_categories(["positive", "negative", "neutral"]) def add_categories(names) names.each { |name| add_category(name) } end # Train the desired category with multiple documents # # ==== Parameters # # * +category+ - Name of the category from added categories list # * +docs+ - Array of documents # # ==== Examples # # # Add multiple docs for training the category # bayes.train("positive", ["clear documentation", "good, very well"]) # bayes.train("negative", ["bad interface", "damn"]) def train_batch(category, docs) docs.each { |doc| train(category, doc) } end # Classify the multiple documents at a time # # ==== Parameters # # * +docs+ - Array of documents # # ==== Returns # # * +result_set+ - Array of OmniCat::Result objects # # ==== Examples # # # Classify multiple documents # bayes.classify_batch(["good documentation", "damn workin again"]) # => def classify_batch(docs) docs.collect { |doc| classify(doc) } end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
omnicat-0.1.3 | lib/omnicat/classifiers/base.rb |
omnicat-0.1.2 | lib/omnicat/classifiers/base.rb |
omnicat-0.1.1 | lib/omnicat/classifiers/base.rb |
omnicat-0.1.0 | lib/omnicat/classifiers/base.rb |