classifier_atsukamoto 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
- data/lib/classifier/bayes.rb +5 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa3ac0b6e6de4f38df50922c6e69b7cc822b1ca2
|
4
|
+
data.tar.gz: 2c7157d3a7d85630a3b760e06582dcaa85e1ae31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f536b77fa94db3aea1fe36cf98d7a28dd15db57b524b3510203aee7bb878be5a56cf31d1f32c8c55b99f11ea518a86dcea3d2e1f38cd339db80a046882f1d9e
|
7
|
+
data.tar.gz: cd010d2aa6f7c8c0cc4341b8567d1040a22f9b2a9f06bf57fb94d6fb313ff23bd0505b7c9d378650b4a85d132b07d1bae8be1562c37bf9517151334a67506632
|
data/lib/classifier/bayes.rb
CHANGED
@@ -87,7 +87,11 @@ class Bayes
|
|
87
87
|
score[category.to_s] = 0
|
88
88
|
|
89
89
|
# total = category_words.values.inject(0) {|sum, element| sum+element}
|
90
|
-
|
90
|
+
begin
|
91
|
+
total = category_words.inject(0) { |sum, element| sum + element }
|
92
|
+
rescue
|
93
|
+
raise "Bayes needs to be trained before trying to classify"
|
94
|
+
end
|
91
95
|
|
92
96
|
text.word_hash(@stemmer).each do |word, count|
|
93
97
|
#s = category_words.has_key?(word) ? category_words[word] : 0.1
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: classifier_atsukamoto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lucas Carlson
|
@@ -69,3 +69,4 @@ signing_key:
|
|
69
69
|
specification_version: 4
|
70
70
|
summary: Classifier with Redis
|
71
71
|
test_files: []
|
72
|
+
has_rdoc:
|