ImpUnit 0.1.7 → 0.2.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ImpUnit/version.rb +1 -1
  3. data/lib/ImpUnit.rb +425 -5
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15f9a24aa3778e95113a0dee3389b28c7e8472e5e5535acf9f6ad373ba724585
4
- data.tar.gz: ebdfdb651abb969824f7492d44e8dcb87284926c825e26903ee5c06d2d27d63c
3
+ metadata.gz: 2fb73dd84cd98982678f14e7739c897362c2948fc0005c4383b02c0d671eb6ae
4
+ data.tar.gz: 9e356b01c4dd236ba8975076a31925ae93bf167373fd16cace8ce5c8761edc21
5
5
  SHA512:
6
- metadata.gz: 9711fdb0ae0f998bc529c95802ad2f9fe2c264371cf6b015c46b05594d206966b228f7f7bc5141c719dfc18bc2ebc1e41f2509b88c336e8fa53d00423a6380db
7
- data.tar.gz: c49be03629cf84cf466f35c8feecac9f14a709d8b962fb85bc3218dc4e5b1905bf026c6b126115365af6cef7fc9e7aaf0b957b18c2ed541f6a1f1566ae902e2e
6
+ metadata.gz: 0ef7a5913109fa04f213bf5f0f1074e73c4741c17f357d72efae240f9ba115a502698c083c69b2f6b467e0052438725297af37d51140fe51eb7c24e163f94127
7
+ data.tar.gz: a0ae436903b6577d43c81ff5eb7fd6d0a1367f0b58acff42d15aecb48f0e07d88673365a6acd2c5db818c1c3f6b37cd2398966cabc6f93da6998fc1f6ba64c58
@@ -1,3 +1,3 @@
1
1
  module ImpUnit
2
- VERSION = "0.1.7"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/ImpUnit.rb CHANGED
@@ -2,6 +2,14 @@ require "ImpUnit/version"
2
2
 
3
3
  module ImpUnit
4
4
  class Error < StandardError; end
5
+
6
+ # class options
7
+ # def self.imp_choose
8
+ # end
9
+
10
+ # def self.manual
11
+ # end
12
+ # end
5
13
 
6
14
  class MainAI
7
15
  def self.seed
@@ -42,19 +50,160 @@ module ImpUnit
42
50
  end
43
51
  end
44
52
 
45
- # Caution: Highly Experimental. This treats naive similarly to a dynamic website.
46
- class Language
53
+ # Fraponic language model of Naive Bayes. See: https://lwflouisa.github.io/FraponicConlang
54
+ class ActiveBayes
47
55
  def self.fraponic_standard
48
- end
56
+ # Create an archive of the data.
57
+ data_archive = File.read("data/memory/data_archive.txt").strip.to_s
58
+
59
+ # Create a label for the model.
60
+ print "Label >> "; label = gets.chomp
61
+
62
+ # Choose a word for that label.
63
+ print "Word >> "; word = gets.chomp
64
+
65
+ # Create a training example from label and word.
66
+ new_model = "a.train(:#{label}, '#{word}', 'word')"
67
+
68
+ # Assign new baysian model with data archive and new model.
69
+ baysian_model = "number = 0
70
+
71
+ print "<< "; input = gets.chomp
72
+
73
+ size_limit = input.size.to_i
74
+
75
+ size_limit.times do
76
+ require 'naive_bayes'
77
+
78
+ a = NaiveBayes.new(:honorific,
79
+ :greeting,
80
+ :personal_pronoun,
81
+ :offensive_pronoun,
82
+ :word_gender,
83
+ :noun,
84
+ :adjective,
85
+ :conjunction,
86
+ :verb,
87
+ :adverb,
88
+ :punctuation,
89
+ )
90
+
91
+ a.db_filepath = 'data/memory/archive.nb'
92
+
93
+ #{data_archive}
94
+ #{new_model}
95
+
96
+ print '<< '
97
+ b = input[number]
98
+
99
+ puts a.classify(*b)
100
+
101
+ number = number + 1
102
+ end"
103
+
104
+ # Create active archive of data.
105
+ open("data/memory/data_archive.txt", "w") { |f|
106
+ f.puts "#{data_archive}"
107
+ f.puts "#{new_model}"
108
+ }
49
109
 
50
- def self.fraponic_request
110
+ open("loader.rb", "w") { |f|
111
+ f.puts baysian_model
112
+ }
51
113
  end
52
114
 
53
115
  def self.loader
116
+ system("ruby loader.rb")
117
+ end
118
+ end
119
+
120
+ # Bleeding edge
121
+ class ObjectColor
122
+ def self.what_object
123
+ input = File.read("data/object/object_chart.txt").split(" ")
124
+
125
+ number = 0
126
+
127
+ size_limit = input.size.to_i
128
+
129
+ # Estimate each word in a sentence from a label.
130
+ size_limit.times do
131
+ require 'naive_bayes'
132
+
133
+ object = NaiveBayes.new(:person, :place, :thing)
134
+
135
+ # Trains on apple colors.
136
+ object.train(:person, "person", "word")
137
+ object.train(:place, "place", "word")
138
+ object.train(:thing, "thing", "word")
139
+
140
+ b = input[number]
141
+
142
+ puts "Results >> #{object.classify(*b)}"
143
+
144
+ sleep(1)
145
+
146
+ number = number + 1
147
+ end
148
+ end
149
+
150
+ def self.what_color
151
+ input = File.read("data/colors/color_chart.txt").split(" ")
152
+
153
+ number = 0
154
+
155
+ size_limit = input.size.to_i
156
+
157
+ # Estimate each word in a sentence from a label.
158
+ size_limit.times do
159
+ require 'naive_bayes'
160
+
161
+ color = NaiveBayes.new(:red, :green, :yellow)
162
+
163
+ # Trains on apple colors.
164
+ color.train(:red, "red", "word")
165
+ color.train(:green, "green", "word")
166
+ color.train(:yellow, "yellow", "word")
167
+
168
+ b = input[number]
169
+
170
+ puts "Results >> #{color.classify(*b)}"
171
+
172
+ sleep(1)
173
+
174
+ number = number + 1
175
+ end
176
+ end
177
+
178
+ def self.what_action
179
+ input = File.read("data/actions/action_chart.txt").split(" ")
180
+
181
+ number = 0
182
+
183
+ size_limit = input.size.to_i
184
+
185
+ # Estimate each word in a sentence from a label.
186
+ size_limit.times do
187
+ require 'naive_bayes'
188
+
189
+ action = NaiveBayes.new(:eat, :toss)
190
+
191
+ # Trains on apple colors.
192
+ action.train(:eat, "eat", "word")
193
+ action.train(:toss, "toss", "word")
194
+
195
+ b = input[number]
196
+
197
+ puts "Results >> #{action.classify(*b)}"
198
+
199
+ sleep(1)
200
+
201
+ number = number + 1
202
+ end
54
203
  end
55
204
  end
56
205
 
57
- # Points to specific subroutines.
206
+ # Points to specific SimpleSearch.
58
207
  class SimpleSearch
59
208
 
60
209
  # ImpUnit::SimpleSearch.standard
@@ -343,4 +492,275 @@ module ImpUnit
343
492
  }
344
493
  end
345
494
  end
495
+
496
+ #class BotWings
497
+ #def self.reset_evo
498
+ #reset_usr_input = 0
499
+
500
+ #open("data/number/input.txt", "w") { |f|
501
+ #f.puts reset_usr_input
502
+ #}
503
+ #end
504
+
505
+ #def self.use_form
506
+ #system("tts 'Form status: Suitable...', 'en'")
507
+
508
+ #sleep(3)
509
+
510
+ ## Detect bot form
511
+ ## bot_choice = File.read("data/bot_input/input.txt").strip.to_i
512
+ ## bot_wings = File.readlines("data/bot_shape/wings.txt")
513
+
514
+ ## Form conditional
515
+ ## if bot form is decision tree
516
+ ## elsif bot form is naive bayes
517
+ ## elsif bot form is biometrics
518
+ ## elsif bot form is "infinite learning algorithm"
519
+
520
+ #abort
521
+ #end
522
+
523
+ #def self.reshape
524
+ #system("clear")
525
+
526
+ #model_type = File.read("data/model/model_type.txt").strip
527
+
528
+ #bot_choice = File.read("data/bot_input/input.txt").strip.to_i
529
+ #number = File.read("data/number/input.txt").strip.to_i
530
+
531
+ #usr_wings = File.readlines("data/usr_shape/wings.txt")
532
+ #bot_wings = File.readlines("data/bot_shape/wings.txt")
533
+
534
+ #current_wingset = usr_wings[number]
535
+ #current_botwings = bot_wings[bot_choice]
536
+
537
+ #system("tts 'The user #{model_type} model is: #{current_wingset}', 'en'")
538
+ #system("tts 'The bot #{model_type} model is: #{current_botwings}', 'en'")
539
+
540
+ #if current_wingset == current_botwings
541
+ #use_form
542
+ #else
543
+ #system("tts 'Form status: Changing form...', 'en'")
544
+
545
+ #sleep(3)
546
+
547
+ #new_value = number + 1
548
+
549
+ #open("data/number/input.txt", "w") { |f|
550
+ #f.puts new_value
551
+ #}
552
+ #end
553
+
554
+ #Botwings::BotWings.reshape
555
+ #end
556
+ #end
557
+
558
+ class Spices
559
+
560
+ def self.tumeric
561
+ spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
562
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
563
+ "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
564
+
565
+ spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
566
+
567
+ print spoon_size.sample
568
+ print spoon_type.sample
569
+ puts " turmeric"
570
+ end
571
+
572
+ def self.cumin
573
+ spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
574
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
575
+ "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
576
+
577
+ spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
578
+
579
+ print spoon_size.sample
580
+ print spoon_type.sample
581
+ puts " cumin"
582
+ end
583
+
584
+ def self.cayenne
585
+ spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
586
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
587
+ "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
588
+
589
+ spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
590
+
591
+ print spoon_size.sample
592
+ print spoon_type.sample
593
+ puts " cayenne"
594
+ end
595
+
596
+ def self.chilly_powder
597
+ spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
598
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
599
+ "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
600
+
601
+ spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
602
+
603
+ print spoon_size.sample
604
+ print spoon_type.sample
605
+ puts " chilly powder"
606
+ end
607
+
608
+ def self.crushed_peppers
609
+ spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
610
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
611
+ "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
612
+
613
+ spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
614
+
615
+ print spoon_size.sample
616
+ print spoon_type.sample
617
+ puts " crushed peppers"
618
+ end
619
+
620
+ def self.garlic_powder
621
+ spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
622
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
623
+ "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
624
+
625
+ spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
626
+
627
+ print spoon_size.sample
628
+ print spoon_type.sample
629
+ puts " garlic powder"
630
+ end
631
+
632
+ def self.onion_powder
633
+ spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
634
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
635
+ "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
636
+
637
+ spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
638
+
639
+ print spoon_size.sample
640
+ print spoon_type.sample
641
+ puts " onion powder"
642
+ end
643
+
644
+ def self.cocao_powder
645
+ spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
646
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
647
+ "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
648
+
649
+ spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
650
+
651
+ print spoon_size.sample
652
+ print spoon_type.sample
653
+ puts " cocao powder"
654
+ end
655
+
656
+ def self.cinnamon
657
+ spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
658
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
659
+ "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
660
+
661
+ spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
662
+
663
+ print spoon_size.sample
664
+ print spoon_type.sample
665
+ puts " cinnamon"
666
+ end
667
+ end
668
+ end
669
+
670
+ ## Measuring the distance between objects and size of objects in space.
671
+ module SpatialRelationships
672
+ class Error < StandardError; end
673
+
674
+ class Static_Perimeters
675
+
676
+ # The objects within the space.
677
+ def positive_perimeters
678
+ # Base radius of static objects.
679
+ base_radius = 2500
680
+
681
+ # Specfic multipliers for Earth index based objects.
682
+ base_two = 2
683
+ base_fro = 4
684
+ base_six = 6
685
+ base_eit = 8
686
+
687
+ # Size of specific objects.
688
+ size_of_planets = base_radius ** base_fro
689
+ size_of_moons = base_radius ** base_two
690
+ size_of_stars = base_radius ** base_six
691
+ size_of_blackholes = base_radius ** base_eit
692
+
693
+ # Total output sizes of specific objects.
694
+ puts "The size of the planets is #{size_of_planets} radius."; sleep(3)
695
+ puts "The size of the moons is #{size_of_moons} radius."; sleep(3)
696
+ puts "The size of the stars is #{size_of_stars} radius."; sleep(3)
697
+ puts "The size of a blackhole is #{size_of_blackholes} radius."; sleep(3)
698
+ end
699
+
700
+ # Space between the objects.
701
+ def negative_perimeters
702
+ # Base distance between objects.
703
+ base_distance = 1_000_000_000
704
+
705
+ # Estimated divider between specific objects to base distance.
706
+ space_between_planets = 43.8
707
+ space_between_moons = 14.6
708
+ space_between_stars = 876
709
+ space_between_blackholes = 2628
710
+
711
+ # Minimum distance between objects.
712
+ planet_distance = base_distance / space_between_planets
713
+ moon_distance = base_distance / space_between_moons
714
+ star_distance = base_distance / space_between_stars
715
+ blackhole_distance = base_distance / space_between_blackholes
716
+
717
+ # Actual distance between objects
718
+ actual_planets = planet_distance * 10
719
+ actual_moons = moon_distance * 10
720
+ actual_stars = star_distance * 10
721
+ actual_blackholes = blackhole_distance * 10
722
+
723
+ # The output results of distance between objects.
724
+ puts "The distance between planets is #{actual_planets} miles."; sleep(3)
725
+ puts "The distance between moons is #{actual_moons} miles."; sleep(3)
726
+ puts "The distance between stars is #{actual_stars} miles."; sleep(3)
727
+ puts "The distance between blackholes is #{actual_blackholes} miles."; sleep(3)
728
+ end
729
+
730
+ end
731
+
732
+ # Changing perimeters
733
+ class Dynamic_Perimeters
734
+
735
+ # The objects within the space.
736
+ def positive_perimeters
737
+ spaceship = File.read("data/dynamic/positive_perimenters/spaceship_size.txt").strip.to_i
738
+ space_station = spaceship * 200
739
+ satalite = space_station / 10
740
+
741
+ puts "The total size of the space shuttle is #{spaceship} feet."; sleep(3)
742
+ puts "The total size of the space station is #{space_station} feet."; sleep(3)
743
+ puts "The total size of the satalite is #{satalite} feet."; sleep(3)
744
+ end
745
+
746
+ # Space between the objects.
747
+ def negative_perimeters
748
+ base_multiplier = 10
749
+
750
+ # Minimum space between objects.
751
+ space_between_spaceships = File.read("data/dynamic/negative_perimeters/space_between_spaceships.txt").strip.to_i
752
+ space_between_station = File.read("data/dynamic/negative_perimeters/space_between_station.txt").strip.to_i
753
+ space_between_satalite = File.read("data/dynamic/negative_perimeters/space_between_satalite.txt").strip.to_i
754
+
755
+ # Actual space between objects
756
+ actual_spaceship_distance = space_between_spaceships * base_multiplier
757
+ actual_station_distance = space_between_station * base_multiplier
758
+ actual_satalite_distance = space_between_satalite * base_multiplier
759
+
760
+ puts "The minimum space between shuttles is #{actual_spaceship_distance} feet."; sleep(3)
761
+ puts "The minimum space between stations is #{actual_station_distance} feet."; sleep(3)
762
+ puts "The minimum space between satalites is #{actual_satalite_distance} feet."; sleep(3)
763
+ end
764
+
765
+ end
346
766
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ImpUnit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - LWFlouisa