bayesball 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +9 -2
- data/Rakefile +2 -1
- data/lib/bayesball/classifier.rb +1 -1
- data/lib/bayesball/version.rb +1 -1
- data/spec/bayesball/classifier_spec.rb +5 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Bayesball
|
2
2
|
|
3
|
-
|
3
|
+
Bayesball is a naive Bayes classifier with support for in memory and mongo
|
4
|
+
persistence.
|
4
5
|
|
5
6
|
## Installation
|
6
7
|
|
@@ -18,7 +19,13 @@ Or install it yourself as:
|
|
18
19
|
|
19
20
|
## Usage
|
20
21
|
|
21
|
-
|
22
|
+
```ruby
|
23
|
+
classifier = Bayesball::Classifier.new
|
24
|
+
|
25
|
+
classifier.train 'basketball', 'dunk the ball'
|
26
|
+
|
27
|
+
classifier.classify 'Slam Dunk!' #=> "basketball"
|
28
|
+
```
|
22
29
|
|
23
30
|
## Contributing
|
24
31
|
|
data/Rakefile
CHANGED
data/lib/bayesball/classifier.rb
CHANGED
data/lib/bayesball/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Bayesball::Classifier do
|
4
|
-
let(:subject) { Bayesball::Classifier.new
|
4
|
+
let(:subject) { Bayesball::Classifier.new }
|
5
5
|
|
6
6
|
it 'should do word counts' do
|
7
7
|
result = subject.word_counts('Hello, friend. Hello!')
|
@@ -47,4 +47,8 @@ describe Bayesball::Classifier do
|
|
47
47
|
subject.classify('Hitting a ball made of rubber').must_equal 'racquetball'
|
48
48
|
subject.classify('The winning team is kicking butt. They always make the ball go in the hoop every time').must_equal 'basketball'
|
49
49
|
end
|
50
|
+
|
51
|
+
it 'should return nil if cannot classify' do
|
52
|
+
subject.classify('there are no topics').must_be_nil
|
53
|
+
end
|
50
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bayesball
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-13 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A bayes classifier
|
15
15
|
email:
|
@@ -48,7 +48,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
48
48
|
version: '0'
|
49
49
|
segments:
|
50
50
|
- 0
|
51
|
-
hash: -
|
51
|
+
hash: -4130593485830818059
|
52
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
53
|
none: false
|
54
54
|
requirements:
|
@@ -57,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
57
|
version: '0'
|
58
58
|
segments:
|
59
59
|
- 0
|
60
|
-
hash: -
|
60
|
+
hash: -4130593485830818059
|
61
61
|
requirements: []
|
62
62
|
rubyforge_project:
|
63
63
|
rubygems_version: 1.8.18
|