fBayes 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/.DS_Store +0 -0
  2. data/README.rdoc +6 -3
  3. data/VERSION +1 -1
  4. data/fBayes.gemspec +17 -2
  5. data/lib/.DS_Store +0 -0
  6. data/lib/data/.DS_Store +0 -0
  7. data/lib/data/internalTurnk/.DS_Store +0 -0
  8. data/lib/data/internalTurnk/classifier.rb +55 -0
  9. data/lib/data/internalTurnk/csv_to_data.rb +10 -0
  10. data/lib/data/internalTurnk/data/Beverages +366 -0
  11. data/lib/data/internalTurnk/data/Cereal +46 -0
  12. data/lib/data/internalTurnk/data/Dairy +69 -0
  13. data/lib/data/internalTurnk/data/Fast-foods +29 -0
  14. data/lib/data/internalTurnk/data/Fat, +53 -0
  15. data/lib/data/internalTurnk/data/Fruits +47 -0
  16. data/lib/data/internalTurnk/data/Grains +85 -0
  17. data/lib/data/internalTurnk/data/Meat +132 -0
  18. data/lib/data/internalTurnk/data/Unknown +127 -0
  19. data/lib/data/internalTurnk/data/Vegetables +310 -0
  20. data/lib/data/internalTurnk/results.csv +1703 -0
  21. data/lib/data/sr24/.DS_Store +0 -0
  22. data/lib/data/sr24/classifier.rb +35 -15
  23. data/lib/data/sr24/csv_to_muchidata.rb +8 -0
  24. data/lib/data/sr24/data/baby-foods +192 -192
  25. data/lib/data/sr24/data/baked-products +350 -350
  26. data/lib/data/sr24/data/beef-products +137 -131
  27. data/lib/data/sr24/data/beverages +182 -177
  28. data/lib/data/sr24/data/breakfast-cereals +304 -304
  29. data/lib/data/sr24/data/cereal-grains-and-pasta +101 -101
  30. data/lib/data/sr24/data/dairy-and-egg-products +178 -178
  31. data/lib/data/sr24/data/ethnic-foods +97 -97
  32. data/lib/data/sr24/data/fast-foods +208 -190
  33. data/lib/data/sr24/data/fats-and-oils +146 -146
  34. data/lib/data/sr24/data/finfish-and-shellfish-products +123 -123
  35. data/lib/data/sr24/data/fruits-and-fruit-juices +198 -198
  36. data/lib/data/sr24/data/lamb +73 -73
  37. data/lib/data/sr24/data/legumes-and-legume-products +231 -231
  38. data/lib/data/sr24/data/meals +48 -48
  39. data/lib/data/sr24/data/nut-and-seed-products +104 -104
  40. data/lib/data/sr24/data/pork-products +37 -37
  41. data/lib/data/sr24/data/poultry-products +134 -134
  42. data/lib/data/sr24/data/restaurant-foods +45 -45
  43. data/lib/data/sr24/data/sausages-and-luncheon-meats +140 -140
  44. data/lib/data/sr24/data/snacks +108 -108
  45. data/lib/data/sr24/data/soups +420 -420
  46. data/lib/data/sr24/data/spices-and-herbs +29 -29
  47. data/lib/data/sr24/data/sweets +225 -225
  48. data/lib/data/sr24/data/vegetables-and-vegetable-products +331 -321
  49. data/lib/fBayes.rb +6 -2
  50. data/lib/global_classifier.rb +2 -0
  51. data/spec/accuracy_spec.rb +141 -0
  52. metadata +18 -3
data/lib/fBayes.rb CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  module FBayesDir
4
4
  def self.root
5
- Gem::Specification.find_by_name("fBayes").gem_dir + "/lib/data/"
5
+ #Gem::Specification.find_by_name("fBayes").gem_dir + "/lib/data/"
6
+ Dir.pwd + "/lib/data/"
6
7
  end
7
8
 
8
9
  def self.cdc_data
@@ -10,9 +11,12 @@ module FBayesDir
10
11
  end
11
12
 
12
13
  def self.sr24_data
13
-
14
14
  self.root + "/sr24/data/"
15
15
  end
16
+
17
+ def self.internal_turnk_data
18
+ self.root + "/internalTurnk/data/"
19
+ end
16
20
  end
17
21
 
18
22
 
@@ -2,12 +2,14 @@
2
2
 
3
3
  require_relative './data/cdc/classifier'
4
4
  require_relative './data/sr24/classifier'
5
+ require_relative './data/internalTurnk/classifier'
5
6
 
6
7
 
7
8
  puts "*" * 100
8
9
 
9
10
  puts "Clasifier Object: @sr24_classifier"
10
11
  puts "Classifier Object: @cdc_classifier"
12
+ puts "Classifier Object: @it_classifier"
11
13
 
12
14
 
13
15
 
@@ -0,0 +1,141 @@
1
+ @@true_table = {
2
+ "mushroom" => "vegetables-and-vegetable-products",
3
+ "soup" => "soups",
4
+ "potato" => "vegetables-and-vegetable-products",
5
+ "picana" => "beef-products",
6
+ "beer" => "beverages",
7
+ "bread" => "baked-products",
8
+ "lentils" => "vegetables-and-vegetable-products",
9
+ "hamburgers" => "fast-foods",
10
+ "French fries" => "fast-foods",
11
+ "bacio" => "beef-products",
12
+ "coffee" => "beverages",
13
+ "sirloin" => "beef-products",
14
+ "tacos" => "beef-products",
15
+ "red wine" => "beverages",
16
+ "protein shake" => "special",
17
+ "salad" => "vegetables-and-vegetables-products",
18
+ "bacon" => "beef-products",
19
+ "ground beef" => "beef-products",
20
+ "onions" => "vegetables-and-vegetable-products",
21
+ "spinach" => "vegetable-and-vegetable-products",
22
+ "with" => "remove",
23
+ "and" => "remove",
24
+ "chorizo" => "beef-products",
25
+ "romain" => "vegetable-and-vegetable-products",
26
+ "lettuce" => "vegetable-and-vegetable-products",
27
+ "carrot" => "vegetable-and-vegetable-products",
28
+ "juice" => "beverages",
29
+ "french" => "fast-foods",
30
+ "toast" => "baked-products",
31
+ "orange" => "fruits-and-fruit-juices",
32
+ "cafe" => "beverages",
33
+ "one" => "remove",
34
+ "tea" => "beverages",
35
+ "spoon" => "remove",
36
+ "of" => "remove",
37
+ "sugar" => "sweets",
38
+ "Protein" => "special",
39
+ "Shake" => "beverages",
40
+ "Coffee" => "beverages",
41
+ "water" => "beverages",
42
+ "Parisienne" => "meals",
43
+ "meet" => "beef-products",
44
+ "basmati" => "cereal-grains-and-pasta",
45
+ "rice" => "cereal-grains-and-pasta",
46
+ "al" => "remove",
47
+ "pastor" => "beef-products",
48
+ "michelada" => "beverages",
49
+ "sol" => "beverages",
50
+ "cerveza" => "beverages",
51
+ "Minerva" => "beverages",
52
+ "omelet" => "dairy-and-egg-products",
53
+ "strawberry" => "fruits-and-fruit-products",
54
+ "jell" => "special",
55
+ "pizza" => "cereal-grains-and-pasta",
56
+ "corn" => "vegetables-and-vegetables-products",
57
+ "lentil" => "cereal-grains-and-pasta",
58
+ "tiramisu" => "sweets"
59
+ }
60
+
61
+
62
+
63
+ @@internal_turnk = {
64
+ "mushroom" => "Vegetables",
65
+ "soup" => "Unknown",
66
+ "potato" => "Vegetables",
67
+ "picana" => "Meat",
68
+ "beer" => "Beverages",
69
+ "bread" => "grains",
70
+ "lentils" => "Vegetables",
71
+ "hamburgers" => "meat",
72
+ "French fries" => "Fast-Foods",
73
+ "bacio" => "meat",
74
+ "coffee" => "Beverages",
75
+ "sirloin" => "Meat",
76
+ "tacos" => "Meat",
77
+ "red wine" => "beverages",
78
+ "protein shake" => "Unknown",
79
+ "salad" => "vegetables",
80
+ "bacon" => "Meat",
81
+ "ground Meat" => "Meat",
82
+ "onions" => "vegetables",
83
+ "spinach" => "vegetables",
84
+ "with" => "Unknown",
85
+ "and" => "Unknown",
86
+ "chorizo" => "Meat",
87
+ "romain" => "vegetables",
88
+ "lettuce" => "vegetables",
89
+ "carrot" => "vegetables",
90
+ "juice" => "beverages",
91
+ "french" => "fast-foods",
92
+ "toast" => "Grains",
93
+ "orange" => "fruits",
94
+ "cafe" => "beverages",
95
+ "one" => "Unknown",
96
+ "tea" => "beverages",
97
+ "spoon" => "Unknown",
98
+ "of" => "Unknown",
99
+ "sugar" => "Fat",
100
+ "Protein" => "Unknown",
101
+ "Shake" => "beverages",
102
+ "Coffee" => "beverages",
103
+ "water" => "beverages",
104
+ "Parisienne" => "meat",
105
+ "meet" => "meat",
106
+ "basmati" => "grains",
107
+ "rice" => "grains",
108
+ "al" => "Unknown",
109
+ "pastor" => "Meat",
110
+ "michelada" => "beverages",
111
+ "sol" => "beverages",
112
+ "cerveza" => "beverages",
113
+ "Minerva" => "beverages",
114
+ "omelet" => "dairy",
115
+ "strawberry" => "fruits",
116
+ "jell" => "Unknown",
117
+ "pizza" => "fast-foods",
118
+ "corn" => "vegetables",
119
+ "lentil" => "grains",
120
+ "tiramisu" => "Unknown"
121
+ }
122
+
123
+
124
+
125
+
126
+ require_relative './../lib/fBayes'
127
+
128
+ describe "Acurracy" do
129
+
130
+ before(:all) do
131
+ @usda = InternalTurnk.new
132
+ end
133
+
134
+ @@internal_turnk.each_pair do |word, category|
135
+ it "maches the word #{word} with the category #{category}" do
136
+ @usda.c(word).downcase.should == category.downcase
137
+ end
138
+ end
139
+
140
+ end
141
+
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.2.2
4
+ version: 0.3.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-09-10 00:00:00.000000000 Z
12
+ date: 2012-11-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: classifier
@@ -127,6 +127,20 @@ files:
127
127
  - lib/data/cdc/data/protein_foods
128
128
  - lib/data/cdc/data/water
129
129
  - lib/data/cdc/ruby_parser.rb
130
+ - lib/data/internalTurnk/.DS_Store
131
+ - lib/data/internalTurnk/classifier.rb
132
+ - lib/data/internalTurnk/csv_to_data.rb
133
+ - lib/data/internalTurnk/data/Beverages
134
+ - lib/data/internalTurnk/data/Cereal
135
+ - lib/data/internalTurnk/data/Dairy
136
+ - lib/data/internalTurnk/data/Fast-foods
137
+ - lib/data/internalTurnk/data/Fat,
138
+ - lib/data/internalTurnk/data/Fruits
139
+ - lib/data/internalTurnk/data/Grains
140
+ - lib/data/internalTurnk/data/Meat
141
+ - lib/data/internalTurnk/data/Unknown
142
+ - lib/data/internalTurnk/data/Vegetables
143
+ - lib/data/internalTurnk/results.csv
130
144
  - lib/data/sr24/.DS_Store
131
145
  - lib/data/sr24/FD_GROUP.csv
132
146
  - lib/data/sr24/FD_GROUP.txt
@@ -166,6 +180,7 @@ files:
166
180
  - lib/data/sr24/rawData/sr24_doc.pdf
167
181
  - lib/fBayes.rb
168
182
  - lib/global_classifier.rb
183
+ - spec/accuracy_spec.rb
169
184
  - spec/clasificador_spec.rb
170
185
  - spec/fBayes_spec.rb
171
186
  - spec/spec_helper.rb
@@ -184,7 +199,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
199
  version: '0'
185
200
  segments:
186
201
  - 0
187
- hash: 778778263631434492
202
+ hash: 435159813483436129
188
203
  required_rubygems_version: !ruby/object:Gem::Requirement
189
204
  none: false
190
205
  requirements: