simple_naive_bayes 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7d656f37e20a851ca3011fd417a53c66c8c0804
4
- data.tar.gz: 9d62b66d9634bdde996456a734addffdf1bcc417
3
+ metadata.gz: 2fb9d56e4001ff6ebff3b86a05bf0b77d21180f7
4
+ data.tar.gz: cf92585d78df2861eff5625e32e4f646d8f1c501
5
5
  SHA512:
6
- metadata.gz: 8d8c8f8940bc942bc0811d2b790776a656ecd42f5fc060189642f36123c79c8d14df2e6566601a82313de1245e0b39b542339d812bcacc7c0fbfcc49fc1f1713
7
- data.tar.gz: 73c7c940206a57020ca1e34e1d843596345102e8d72663bb42e2d3175ef236b9a6047fce43c1de906ae9618a1a5136ab07ad944c2eedb3e5d81fb6fcbd4b7970
6
+ metadata.gz: 09ba13da3fccea105957f657bc652c63884127485296f83f75d5ada050d9e85ed4333c81d141c0ab7c834a509a9600bbb570a15969ac9e84d7948d70969015e7
7
+ data.tar.gz: 2c4051dfbed05e50f5160516f739b0257aa1ccee7da27079bd0c5d634e462678630542d3a7af992d1f8e4b4b7dc6124abd187776c73d89ae6b1baa47bafc2890
data/example/example.rb CHANGED
@@ -16,4 +16,15 @@ end
16
16
  test = ["Chinese", "Chinese", "Chinese", "Tokyo", "Japan"]
17
17
 
18
18
  p cl.classify(test)
19
- p cl.classify_with_all_result(test)
19
+ p cl.classify_with_all_result(test)
20
+
21
+
22
+
23
+ cl = SimpleNaiveBayes::NaiveBayes.new(1)
24
+
25
+ data.each do |cat, doc|
26
+ cl.training(cat, doc)
27
+ end
28
+
29
+ p cl.classify(test)
30
+ p cl.classify_with_all_result(test)
@@ -1,3 +1,3 @@
1
1
  module SimpleNaiveBayes
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -34,7 +34,7 @@ module SimpleNaiveBayes
34
34
  http://aidiary.hatenablog.com/entry/20100613/1276389337
35
35
  =end
36
36
 
37
- def initialize()
37
+ def initialize(additive = 0.5)
38
38
  @all_category_num = 0
39
39
  @all_word_set = Set.new
40
40
  @categories_count = Hash.new(0)
@@ -42,7 +42,7 @@ module SimpleNaiveBayes
42
42
  @categories_word = Hash.new
43
43
  @categories_all_word_count = Hash.new(0)
44
44
  @laplace_categories_all_word_count = Hash.new(0)
45
- @additive = 0.5
45
+ @additive = additive
46
46
  end
47
47
 
48
48
  """
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_naive_bayes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - y42sora