fBayes 0.7.0 → 0.8.0

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/.DS_Store ADDED
Binary file
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.0
1
+ 0.8.0
data/fBayes.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "fBayes"
8
- s.version = "0.7.0"
8
+ s.version = "0.8.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ivan Acosta-Rubio"]
12
- s.date = "2012-12-21"
12
+ s.date = "2013-03-05"
13
13
  s.description = "Naitve Bayes for Food Category classification"
14
14
  s.email = "ivan@bakedweb.net"
15
15
  s.extra_rdoc_files = [
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
17
17
  "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
+ ".DS_Store",
20
21
  ".document",
21
22
  ".rspec",
22
23
  "Gemfile",
@@ -17,7 +17,15 @@ class InternalTurnk
17
17
  end
18
18
 
19
19
  def c(word)
20
- @classifier.classify(word)
20
+ result = sorted_classification(word)
21
+ value_of_classification = result.last
22
+ category_of_classification = result.first
23
+
24
+ if value_of_classification <= value_of_missing_info
25
+ return "Unknown"
26
+ else
27
+ return category_of_classification
28
+ end
21
29
  end
22
30
 
23
31
  def d(word)
@@ -26,6 +34,14 @@ class InternalTurnk
26
34
 
27
35
  private
28
36
 
37
+ def value_of_missing_info
38
+ -6.41
39
+ end
40
+
41
+ def sorted_classification(word)
42
+ @classifier.classifications(word).sort_by { |_key, value| value }.reverse.first
43
+ end
44
+
29
45
  def categories_path
30
46
 
31
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fBayes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
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-12-21 00:00:00.000000000 Z
12
+ date: 2013-03-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: classifier
@@ -99,6 +99,7 @@ extra_rdoc_files:
99
99
  - LICENSE.txt
100
100
  - README.rdoc
101
101
  files:
102
+ - .DS_Store
102
103
  - .document
103
104
  - .rspec
104
105
  - Gemfile
@@ -198,7 +199,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
198
199
  version: '0'
199
200
  segments:
200
201
  - 0
201
- hash: 674919364589449407
202
+ hash: -1228854482676680342
202
203
  required_rubygems_version: !ruby/object:Gem::Requirement
203
204
  none: false
204
205
  requirements: