• Stars
    star
    662
  • Rank 68,103 (Top 2 %)
  • Language
    Ruby
  • License
    Other
  • Created over 16 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A general classifier module to allow Bayesian and LSI classifications.

Welcome to Classifier

Classifier is a general module to allow Bayesian and other types of classifications.

Download

Dependencies

If you install Classifier from source, you'll need to install Roman Shterenzon's fast-stemmer gem with RubyGems as follows:

gem install fast-stemmer

If you would like to speed up LSI classification by at least 10x, please install the following libraries: GNU GSL:: http://www.gnu.org/software/gsl rb-gsl:: https://github.com/SciRuby/rb-gsl

Notice that LSI will work without these libraries, but as soon as they are installed, Classifier will make use of them. No configuration changes are needed, we like to keep things ridiculously easy for you.

Bayes

A Bayesian classifier by Lucas Carlson. Bayesian Classifiers are accurate, fast, and have modest memory requirements.

Usage

require 'classifier'
b = Classifier::Bayes.new 'Interesting', 'Uninteresting'
b.train_interesting "here are some good words. I hope you love them"
b.train_uninteresting "here are some bad words, I hate you"
b.classify "I hate bad words and you" # returns 'Uninteresting'

require 'madeleine'
m = SnapshotMadeleine.new("bayes_data") {
    Classifier::Bayes.new 'Interesting', 'Uninteresting'
}
m.system.train_interesting "here are some good words. I hope you love them"
m.system.train_uninteresting "here are some bad words, I hate you"
m.take_snapshot
m.system.classify "I love you" # returns 'Interesting'

Using Madeleine, your application can persist the learned data over time.

Bayesian Classification

LSI

A Latent Semantic Indexer by David Fayram. Latent Semantic Indexing engines are not as fast or as small as Bayesian classifiers, but are more flexible, providing fast search and clustering detection as well as semantic analysis of the text that theoretically simulates human learning.

Usage

require 'classifier'
lsi = Classifier::LSI.new
strings = [ ["This text deals with dogs. Dogs.", :dog],
          ["This text involves dogs too. Dogs! ", :dog],
          ["This text revolves around cats. Cats.", :cat],
          ["This text also involves cats. Cats!", :cat],
          ["This text involves birds. Birds.",:bird ]]
strings.each {|x| lsi.add_item x.first, x.last}

lsi.search("dog", 3)
# returns => ["This text deals with dogs. Dogs.", "This text involves dogs too. Dogs! ",
#             "This text also involves cats. Cats!"]

lsi.find_related(strings[2], 2)
# returns => ["This text revolves around cats. Cats.", "This text also involves cats. Cats!"]

lsi.classify "This text is also about dogs!"
# returns => :dog

Please see the Classifier::LSI documentation for more information. It is possible to index, search and classify with more than just simple strings.

Latent Semantic Indexing

Authors

This library is released under the terms of the GNU LGPL. See LICENSE for more details.

More Repositories

1

contacts

A universal interface to import email contacts from various providers including Yahoo, Gmail, Hotmail, AOL and Plaxo.
Ruby
612
star
2

simple-rss

A simple, flexible, extensible, and liberal RSS and Atom reader for Ruby. It is designed to be backwards compatible with the standard RSS parser, but will never do RSS generation.
Ruby
222
star
3

shipping

An easy to use shipping API for Ruby. Shipping is used to calculate shipping costs, track orders and other shipping based processes through major shipping companies such as, UPS and Fedex, etc.
Ruby
44
star
4

starfish

Starfish is a utility to make distributed programming ridiculously easy
Ruby
41
star
5

payment

An easy to use payment gateway for Ruby. Payment is used to process credit cards and electronic cash through merchant accounts like Authorize.Net.
Ruby
20
star
6

lucash

A highly dynamic programming language/shell environment with data structures
Scheme
8
star
7

github-contest

Woot!
Ruby
8
star
8

dm-works

Fork of DataMapper 0.3 with patches to fix major show-stopping bugs
Ruby
5
star
9

PyAMF

Python AMF
Python
5
star
10

dm-www

The DataMapper Website
Ruby
3
star
11

dm-more

Extras for DataMapper, including bridges to DataObjects::Migrations and Merb::DataMapper
Ruby
3
star
12

do

DataObjects
Ruby
3
star
13

dm-core

DataMapper - Core
Ruby
3
star
14

tesh

A highly dynamic shell/programming language environment with data structures written in Crystal
Crystal
3
star
15

standard_failure

A rails plugin for handling standard failures in an app
Ruby
2
star
16

copypaste

CopyPaste provides rcopy, rcut, rpaste unix tools that interact with a central queue server through the memcached protocol
Ruby
2
star
17

lucas-panamax-templates

1
star
18

kamalx

KamalX is a command-line tool that enhances the user experience of the kamal deploy tool from Basecamp by making it more user-friendly and easier to watch and understand.
Ruby
1
star