ImpUnit 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ImpUnit/version.rb +1 -1
  3. data/lib/ImpUnit.rb +251 -26
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: deeeeaa4b363cfe259a846c34cfec6a8bf6829147b0bbcd28eeab3a7fe7c9afd
4
- data.tar.gz: 07197fae2ad86bb46fdab92b54099d5b755dedb61309dde9bac53f11916b867c
3
+ metadata.gz: ab8b641cf21e85d33c9da3b065bc529c5063315351fce6bde74cf2305469f25d
4
+ data.tar.gz: 6bac22ca5c38b6697745ee79375f26d651d7c77c50e4d96b8aa7101d77c17839
5
5
  SHA512:
6
- metadata.gz: 39b8c09eaa84453083c5b1318256f102a677001dd26018666cb80cdf3f7241f49f12f5c70999911aa00dbb137f11d6ba60c6198c216f4c7474f7e040bf46b188
7
- data.tar.gz: 54996748d1ea6013a0130d35360137c2f1b6dc35f81d25742973013d41eeef280cc49a1b48c1433fa51faa485f50010ff4f5ec723ab4cf4f99276f66de2abbda
6
+ metadata.gz: 410f4c0df14789813d7cd16e850170985773d61b75ac1c7bcd05dbffc560fba5bd8339a1b3a6b57b368382453ac8b2ce203833d224c3f8054d32e42625fd7e0b
7
+ data.tar.gz: 48ba497efbafd5b323546133fbcebfb4b141373a53b89edd056734f93021fd4f27bef00974843443a33ea9a3adf07ac94f471e22cdf7527a75ae0f3ba7723dd9
@@ -1,3 +1,3 @@
1
1
  module ImpUnit
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
data/lib/ImpUnit.rb CHANGED
@@ -13,7 +13,7 @@ module ImpUnit
13
13
  # def self.manual
14
14
  # end
15
15
  # end
16
-
16
+
17
17
  class MainAI
18
18
  def self.seed
19
19
  number = 0
@@ -120,8 +120,233 @@ end"
120
120
  end
121
121
  end
122
122
 
123
+ # Naive Baysian model on Fraponic.
124
+ class LanguageFraponic
125
+ def self.grammar_feed
126
+ input = File.read("data/language/input.txt").downcase.split(" ")
127
+
128
+ number = 0
129
+
130
+ size_limit = input.size.to_i
131
+
132
+ require "naive_bayes"
133
+
134
+ size_limit.times do
135
+ require "naive_bayes"
136
+
137
+ grammar = NaiveBayes.new(:word_gender,
138
+ :personal_pronouns,
139
+ :nouns,
140
+ :adjectives,
141
+ :conjucation_prepositions,
142
+ :verbs,
143
+ :adverbs,
144
+ )
145
+
146
+ # Train on word genders.
147
+ grammar.train(:word_gender, "u", "word")
148
+ grammar.train(:word_gender, "a", "word")
149
+ grammar.train(:word_gender, "os", "word")
150
+
151
+ # Train on personal pronouns
152
+ grammar.train(:personal_pronouns, "ne", "word")
153
+ grammar.train(:personal_pronouns, "miyo", "word")
154
+ grammar.train(:personal_pronouns, "viyo", "word")
155
+ grammar.train(:personal_pronouns, "tiyo", "word")
156
+ grammar.train(:personal_pronouns, "niyo", "word")
157
+ grammar.train(:personal_pronouns, "iye", "word")
158
+ grammar.train(:personal_pronouns, "iyesu", "word")
159
+ grammar.train(:personal_pronouns, "eye", "word")
160
+ grammar.train(:personal_pronouns, "eyesa", "word")
161
+
162
+ # Train on personal pronouns
163
+ grammar.train(:personal_pronouns, "iyeniyo", "word")
164
+ grammar.train(:personal_pronouns, "eyeniyo", "word")
165
+ grammar.train(:personal_pronouns, "iyesuniyo", "word")
166
+ grammar.train(:personal_pronouns, "eyesaniyo", "word")
167
+
168
+ # Train on family members.
169
+ grammar.train(:nouns, "pede", "word")
170
+ grammar.train(:nouns, "mede", "word")
171
+ grammar.train(:nouns, "sferede", "word")
172
+ grammar.train(:nouns, "sfude", "word")
173
+ grammar.train(:nouns, "cusfijere", "word")
174
+ grammar.train(:nouns, "cusfijera", "word")
175
+ grammar.train(:nouns, "cusfijeres", "word")
176
+ grammar.train(:nouns, "tanite", "word")
177
+ grammar.train(:nouns, "oji", "word")
178
+
179
+ # Train on secondary nouns
180
+ grammar.train(:nouns, "cuto", "word")
181
+ grammar.train(:nouns, "cere", "word")
182
+ grammar.train(:nouns, "xase", "word")
183
+ grammar.train(:nouns, "tankobon", "word")
184
+ grammar.train(:nouns, "michite", "word")
185
+ grammar.train(:nouns, "gahe", "word")
186
+ grammar.train(:nouns, "gahene", "word")
187
+ grammar.train(:nouns, "koroyo", "word")
188
+ grammar.train(:nouns, "toko", "word")
189
+ grammar.train(:nouns, "hadajo", "word")
190
+ grammar.train(:nouns, "makadama", "word")
191
+ grammar.train(:nouns, "ishiniko", "word")
192
+ grammar.train(:nouns, "tasfijo", "word")
193
+ grammar.train(:nouns, "musilijero", "word")
194
+ grammar.train(:nouns, "itami", "word")
195
+ grammar.train(:nouns, "kiho", "word")
196
+ grammar.train(:nouns, "enekurofire", "word")
197
+ grammar.train(:nouns, "ehamatoragune", "word")
198
+ grammar.train(:nouns, "robosekusurite", "word")
199
+ grammar.train(:nouns, "sekusurite", "word")
200
+ grammar.train(:nouns, "apetite", "word")
201
+ grammar.train(:nouns, "hakusu", "word")
202
+ grammar.train(:nouns, "basukete", "word")
203
+ grammar.train(:nouns, "gerope", "word")
204
+ grammar.train(:nouns, "banidoru", "word")
205
+ grammar.train(:nouns, "sfavare", "word")
206
+ grammar.train(:nouns, "sfabine", "word")
207
+ grammar.train(:nouns, "atimosipilere", "word")
208
+ grammar.train(:nouns, "funiki", "word")
209
+ grammar.train(:nouns, "boruto", "word")
210
+ grammar.train(:nouns, "verohe", "word")
211
+ grammar.train(:nouns, "xehene", "word")
212
+ grammar.train(:nouns, "kytapira", "word")
213
+
214
+ # Train on adjectives
215
+ grammar.train(:adjectives, "ebax", "word")
216
+ grammar.train(:adjectives, "beloyan", "word")
217
+ grammar.train(:adjectives, "uchay", "word")
218
+ grammar.train(:adjectives, "berane", "word")
219
+ grammar.train(:adjectives, "pahe", "word")
220
+ grammar.train(:adjectives, "enere", "word")
221
+ grammar.train(:adjectives, "visarize", "word")
222
+ grammar.train(:adjectives, "venituse", "word")
223
+ grammar.train(:adjectives, "kiwotsukero", "word")
224
+ grammar.train(:adjectives, "kebuka", "word")
225
+ grammar.train(:adjectives, "sula", "word")
226
+ grammar.train(:adjectives, "kosatasu", "word")
227
+ grammar.train(:adjectives, "hatadake", "word")
228
+ grammar.train(:adjectives, "ateroce", "word")
229
+ grammar.train(:adjectives, "aboradaberu", "word")
230
+ grammar.train(:adjectives, "regarabehe", "word")
231
+ grammar.train(:adjectives, "arutesiqe", "word")
232
+ grammar.train(:adjectives, "etimire", "word")
233
+ grammar.train(:adjectives, "eseru", "word")
234
+ grammar.train(:adjectives, "hitori", "word")
235
+
236
+ # Train on conjucations and prepositions
237
+ grammar.train(:conjucation_prepositions, "di", "word")
238
+ grammar.train(:conjucation_prepositions, "ni", "word")
239
+ grammar.train(:conjucation_prepositions, "si", "word")
240
+ grammar.train(:conjucation_prepositions, "isi", "word")
241
+ grammar.train(:conjucation_prepositions, "ow", "word")
242
+ grammar.train(:conjucation_prepositions, "axo", "word")
243
+ grammar.train(:conjucation_prepositions, "swa", "word")
244
+ grammar.train(:conjucation_prepositions, "esoma", "word")
245
+ grammar.train(:conjucation_prepositions, "peru", "word")
246
+ grammar.train(:conjucation_prepositions, "somene", "word")
247
+ grammar.train(:conjucation_prepositions, "uu", "word")
248
+ grammar.train(:conjucation_prepositions, "qi", "word")
249
+ grammar.train(:conjucation_prepositions, "qo", "word")
250
+ grammar.train(:conjucation_prepositions, "qe", "word")
251
+ grammar.train(:conjucation_prepositions, "qunida", "word")
252
+ grammar.train(:conjucation_prepositions, "cero", "word")
253
+ grammar.train(:conjucation_prepositions, "aves", "word")
254
+ grammar.train(:conjucation_prepositions, "dez", "word")
255
+ grammar.train(:conjucation_prepositions, "sonite", "word")
256
+ grammar.train(:conjucation_prepositions, "etere", "word")
257
+ grammar.train(:conjucation_prepositions, "oqe", "word")
258
+
259
+ # Train on verbs.
260
+ grammar.train(:verbs, "eru", "word")
261
+ grammar.train(:verbs, "cupo", "word")
262
+ grammar.train(:verbs, "uvere", "word")
263
+ grammar.train(:verbs, "asochi", "word")
264
+ grammar.train(:verbs, "lisoje", "word")
265
+ grammar.train(:verbs, "decite", "word")
266
+ grammar.train(:verbs, "sufere", "word")
267
+ grammar.train(:verbs, "exipoze", "word")
268
+ grammar.train(:verbs, "kimeru", "word")
269
+ grammar.train(:verbs, "hoko", "word")
270
+ grammar.train(:verbs, "uzuke", "word")
271
+ grammar.train(:verbs, "xosfe", "word")
272
+ grammar.train(:verbs, "yubiwa", "word")
273
+ grammar.train(:verbs, "atachi", "word")
274
+ grammar.train(:verbs, "furuma", "word")
275
+ grammar.train(:verbs, "zokusuru", "word")
276
+ grammar.train(:verbs, "cerine", "word")
277
+ grammar.train(:verbs, "konitoru", "word")
278
+ grammar.train(:verbs, "erokute", "word")
279
+ grammar.train(:verbs, "vohonite", "word")
280
+ grammar.train(:verbs, "exusfe", "word")
281
+ grammar.train(:verbs, "salaza", "word")
282
+ grammar.train(:verbs, "eperi", "word")
283
+ grammar.train(:verbs, "mageru", "word")
284
+ grammar.train(:verbs, "eroge", "word")
285
+ grammar.train(:verbs, "sekimen", "word")
286
+ grammar.train(:verbs, "emiperunite", "word")
287
+ grammar.train(:verbs, "karite", "word")
288
+
289
+ # Train on adverbs.
290
+ grammar.train(:verbs, "vite", "word")
291
+ grammar.train(:verbs, "hente", "word")
292
+ grammar.train(:verbs, "mute", "word")
293
+ grammar.train(:verbs, "dolemente", "word")
294
+ grammar.train(:verbs, "pedecise", "word")
295
+ grammar.train(:verbs, "mopedecise", "word")
296
+ grammar.train(:verbs, "vivemeje", "word")
297
+ grammar.train(:verbs, "ketasuzejo", "word")
298
+ grammar.train(:verbs, "dusa", "word")
299
+ grammar.train(:verbs, "terebereme", "word")
300
+
301
+ b = input[number]
302
+
303
+ result = "#{grammar.classify(*b)}"
304
+
305
+ # Generate description and XML timeline.
306
+ description = "#{result}"
307
+
308
+ open("documents/#{date_title}.txt", "w") { |f|
309
+ f.puts description
310
+ }
311
+
312
+ new_output = "
313
+ <item>
314
+ <title>#{date}</title>
315
+ <link>http://localhost:8000/documents/#{date_title}.txt</link>
316
+ <description><![CDATA[<p>#{description}</p>]]></description>
317
+ </item>"
318
+
319
+ open("feed/old_feed.txt", "w") { |f|
320
+ f.puts new_output
321
+ }
322
+
323
+ generate_xml = "<?xml version='1.0' encoding='UTF-8' ?>
324
+ <rss version='2.0'>
325
+
326
+ <channel>
327
+ <title>Grammar Feed</title>
328
+ <link>http://localhost:8000/feed.xml</link>
329
+ <description>Local Feed for naive bayes output.</description>
330
+
331
+ #{new_output}
332
+ #{old_output}
333
+ </channel>
334
+
335
+ </rss>"
336
+
337
+ open("feed/feed.xml", "w") { |f|
338
+ f.puts generate_xml
339
+ }
340
+
341
+ sleep(1)
342
+
343
+ number = number + 1
344
+ end
345
+ end
346
+ end
347
+
123
348
  # Bleeding edge
124
- class ObjectColor
349
+ class Object
125
350
  def self.what_object
126
351
  input = File.read("data/object/object_chart.txt").split(" ")
127
352
 
@@ -507,7 +732,7 @@ end"
507
732
  <rss version='2.0'>
508
733
 
509
734
  <channel>
510
- <title>Personal Blog</title>
735
+ <title>Request Feed</title>
511
736
  <link>http://localhost:8000/feed.xml</link>
512
737
  <description>Local Feed for ImpUnit output.</description>
513
738
 
@@ -607,7 +832,7 @@ end"
607
832
 
608
833
  def self.cumin
609
834
  spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
610
- "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
835
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
611
836
  "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
612
837
 
613
838
  spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
@@ -619,7 +844,7 @@ end"
619
844
 
620
845
  def self.cayenne
621
846
  spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
622
- "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
847
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
623
848
  "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
624
849
 
625
850
  spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
@@ -631,7 +856,7 @@ end"
631
856
 
632
857
  def self.chilly_powder
633
858
  spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
634
- "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
859
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
635
860
  "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
636
861
 
637
862
  spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
@@ -643,7 +868,7 @@ end"
643
868
 
644
869
  def self.crushed_peppers
645
870
  spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
646
- "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
871
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
647
872
  "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
648
873
 
649
874
  spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
@@ -655,7 +880,7 @@ end"
655
880
 
656
881
  def self.garlic_powder
657
882
  spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
658
- "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
883
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
659
884
  "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
660
885
 
661
886
  spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
@@ -667,7 +892,7 @@ end"
667
892
 
668
893
  def self.onion_powder
669
894
  spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
670
- "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
895
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
671
896
  "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
672
897
 
673
898
  spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
@@ -679,7 +904,7 @@ end"
679
904
 
680
905
  def self.cocao_powder
681
906
  spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
682
- "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
907
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
683
908
  "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
684
909
 
685
910
  spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
@@ -691,7 +916,7 @@ end"
691
916
 
692
917
  def self.cinnamon
693
918
  spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
694
- "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
919
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
695
920
  "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
696
921
 
697
922
  spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
@@ -746,56 +971,56 @@ end
746
971
  #def positive_perimeters
747
972
  # Base radius of static objects.
748
973
  #base_radius = 2500
749
-
974
+
750
975
  # Specfic multipliers for Earth index based objects.
751
- #base_two = 2
976
+ #base_two = 2
752
977
  #base_fro = 4
753
978
  #base_six = 6
754
979
  #base_eit = 8
755
-
980
+
756
981
  # Size of specific objects.
757
982
  #size_of_planets = base_radius ** base_fro
758
983
  #size_of_moons = base_radius ** base_two
759
984
  #size_of_stars = base_radius ** base_six
760
985
  #size_of_blackholes = base_radius ** base_eit
761
-
986
+
762
987
  # Total output sizes of specific objects.
763
988
  #puts "The size of the planets is #{size_of_planets} radius."; sleep(3)
764
989
  #puts "The size of the moons is #{size_of_moons} radius."; sleep(3)
765
990
  #puts "The size of the stars is #{size_of_stars} radius."; sleep(3)
766
991
  #puts "The size of a blackhole is #{size_of_blackholes} radius."; sleep(3)
767
992
  #end
768
-
993
+
769
994
  # Space between the objects.
770
995
  #def negative_perimeters
771
996
  # Base distance between objects.
772
997
  #base_distance = 1_000_000_000
773
-
998
+
774
999
  # Estimated divider between specific objects to base distance.
775
1000
  #space_between_planets = 43.8
776
1001
  #space_between_moons = 14.6
777
1002
  #space_between_stars = 876
778
1003
  #space_between_blackholes = 2628
779
-
1004
+
780
1005
  # Minimum distance between objects.
781
1006
  #planet_distance = base_distance / space_between_planets
782
1007
  #moon_distance = base_distance / space_between_moons
783
1008
  #star_distance = base_distance / space_between_stars
784
1009
  #blackhole_distance = base_distance / space_between_blackholes
785
-
1010
+
786
1011
  # Actual distance between objects
787
1012
  #actual_planets = planet_distance * 10
788
1013
  #actual_moons = moon_distance * 10
789
1014
  #actual_stars = star_distance * 10
790
1015
  #actual_blackholes = blackhole_distance * 10
791
-
1016
+
792
1017
  # The output results of distance between objects.
793
1018
  #puts "The distance between planets is #{actual_planets} miles."; sleep(3)
794
1019
  #puts "The distance between moons is #{actual_moons} miles."; sleep(3)
795
1020
  #puts "The distance between stars is #{actual_stars} miles."; sleep(3)
796
1021
  #puts "The distance between blackholes is #{actual_blackholes} miles."; sleep(3)
797
1022
  #end
798
-
1023
+
799
1024
  #end
800
1025
 
801
1026
  # Changing perimeters
@@ -806,26 +1031,26 @@ end
806
1031
  #spaceship = File.read("data/dynamic/positive_perimenters/spaceship_size.txt").strip.to_i
807
1032
  #space_station = spaceship * 200
808
1033
  #satalite = space_station / 10
809
-
1034
+
810
1035
  #puts "The total size of the space shuttle is #{spaceship} feet."; sleep(3)
811
1036
  #puts "The total size of the space station is #{space_station} feet."; sleep(3)
812
1037
  #puts "The total size of the satalite is #{satalite} feet."; sleep(3)
813
1038
  #end
814
-
1039
+
815
1040
  # Space between the objects.
816
1041
  #def negative_perimeters
817
1042
  #base_multiplier = 10
818
-
1043
+
819
1044
  # Minimum space between objects.
820
1045
  #space_between_spaceships = File.read("data/dynamic/negative_perimeters/space_between_spaceships.txt").strip.to_i
821
1046
  #space_between_station = File.read("data/dynamic/negative_perimeters/space_between_station.txt").strip.to_i
822
1047
  #space_between_satalite = File.read("data/dynamic/negative_perimeters/space_between_satalite.txt").strip.to_i
823
-
1048
+
824
1049
  # Actual space between objects
825
1050
  #actual_spaceship_distance = space_between_spaceships * base_multiplier
826
1051
  #actual_station_distance = space_between_station * base_multiplier
827
1052
  #actual_satalite_distance = space_between_satalite * base_multiplier
828
-
1053
+
829
1054
  #puts "The minimum space between shuttles is #{actual_spaceship_distance} feet."; sleep(3)
830
1055
  #puts "The minimum space between stations is #{actual_station_distance} feet."; sleep(3)
831
1056
  #puts "The minimum space between satalites is #{actual_satalite_distance} feet."; sleep(3)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ImpUnit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - LWFlouisa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-15 00:00:00.000000000 Z
11
+ date: 2021-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler