ImpUnit 0.1.5 → 0.2.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 +477 -48
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a1c0e4881c73c36388db72d99437326e5ba8d12d2adcbe1771561cc4931c400
4
- data.tar.gz: 3f786a383d4bbe2ef06751f87fe6e0af0b98fa5f26e4a89a0841d3093b4baf87
3
+ metadata.gz: 5d4e8ba8da2cbc2619f7fe61a895397ff4a0bd3194a596a7687aad037ff951fa
4
+ data.tar.gz: 158e5d38f2e7936e9894670b5a9593a09248e49096819a58874855a586d8b7d8
5
5
  SHA512:
6
- metadata.gz: 7b67df9ca69ca7d54e853d59a37a1911ede2fa35efeec3a4150288dd3b126a29dd3624d7bba4c03de8193b30e32eeff5db08ce6739df76410ed1957405b3c259
7
- data.tar.gz: be7e4dbd48073877dc4528e123397bc71505b78caef39dca8d967d24534eecfaaa5c8d6f3bc4466a8089b722ccb61c66d3feaa887194e4dd5ed7678fc8e476c1
6
+ metadata.gz: 37106f9e337b138e8df1b594bc2102e2dbd9abf0506cbbcda84d8089110e7e0b061a60afdb30cf1e5196db3f2cc9ffd29c548003c49754299da82fd498898e6b
7
+ data.tar.gz: 04c1fb99ae707076115e6eecb22e82b94bf49d8212ec02ad2e3ed97658d81343d8d8bd24a235086664e5ae2e8bab13207f667d02e28a74ee05e1af7aedb94c5d
@@ -1,3 +1,3 @@
1
1
  module ImpUnit
2
- VERSION = "0.1.5"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/ImpUnit.rb CHANGED
@@ -2,6 +2,17 @@ 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
+ # require "decisiontree"
9
+
10
+
11
+ # end
12
+
13
+ # def self.manual
14
+ # end
15
+ # end
5
16
 
6
17
  class MainAI
7
18
  def self.seed
@@ -42,19 +53,160 @@ module ImpUnit
42
53
  end
43
54
  end
44
55
 
45
- # Caution: Highly Experimental. This treats naive similarly to a dynamic website.
46
- class Language
56
+ # Fraponic language model of Naive Bayes. See: https://lwflouisa.github.io/FraponicConlang
57
+ class ActiveBayes
47
58
  def self.fraponic_standard
48
- end
59
+ # Create an archive of the data.
60
+ data_archive = File.read("data/memory/data_archive.txt").strip.to_s
61
+
62
+ # Create a label for the model.
63
+ print "Label >> "; label = gets.chomp
64
+
65
+ # Choose a word for that label.
66
+ print "Word >> "; word = gets.chomp
67
+
68
+ # Create a training example from label and word.
69
+ new_model = "a.train(:#{label}, '#{word}', 'word')"
70
+
71
+ # Assign new baysian model with data archive and new model.
72
+ baysian_model = "number = 0
73
+
74
+ print "<< "; input = gets.chomp
75
+
76
+ size_limit = input.size.to_i
77
+
78
+ size_limit.times do
79
+ require 'naive_bayes'
80
+
81
+ a = NaiveBayes.new(:honorific,
82
+ :greeting,
83
+ :personal_pronoun,
84
+ :offensive_pronoun,
85
+ :word_gender,
86
+ :noun,
87
+ :adjective,
88
+ :conjunction,
89
+ :verb,
90
+ :adverb,
91
+ :punctuation,
92
+ )
93
+
94
+ a.db_filepath = 'data/memory/archive.nb'
95
+
96
+ #{data_archive}
97
+ #{new_model}
98
+
99
+ print '<< '
100
+ b = input[number]
101
+
102
+ puts a.classify(*b)
103
+
104
+ number = number + 1
105
+ end"
106
+
107
+ # Create active archive of data.
108
+ open("data/memory/data_archive.txt", "w") { |f|
109
+ f.puts "#{data_archive}"
110
+ f.puts "#{new_model}"
111
+ }
49
112
 
50
- def self.fraponic_request
113
+ open("loader.rb", "w") { |f|
114
+ f.puts baysian_model
115
+ }
51
116
  end
52
117
 
53
118
  def self.loader
119
+ system("ruby loader.rb")
120
+ end
121
+ end
122
+
123
+ # Bleeding edge
124
+ class ObjectColor
125
+ def self.what_object
126
+ input = File.read("data/object/object_chart.txt").split(" ")
127
+
128
+ number = 0
129
+
130
+ size_limit = input.size.to_i
131
+
132
+ # Estimate each word in a sentence from a label.
133
+ size_limit.times do
134
+ require 'naive_bayes'
135
+
136
+ object = NaiveBayes.new(:person, :place, :thing)
137
+
138
+ # Trains on apple colors.
139
+ object.train(:person, "person", "word")
140
+ object.train(:place, "place", "word")
141
+ object.train(:thing, "thing", "word")
142
+
143
+ b = input[number]
144
+
145
+ puts "Results >> #{object.classify(*b)}"
146
+
147
+ sleep(1)
148
+
149
+ number = number + 1
150
+ end
151
+ end
152
+
153
+ def self.what_color
154
+ input = File.read("data/colors/color_chart.txt").split(" ")
155
+
156
+ number = 0
157
+
158
+ size_limit = input.size.to_i
159
+
160
+ # Estimate each word in a sentence from a label.
161
+ size_limit.times do
162
+ require 'naive_bayes'
163
+
164
+ color = NaiveBayes.new(:red, :green, :yellow)
165
+
166
+ # Trains on apple colors.
167
+ color.train(:red, "red", "word")
168
+ color.train(:green, "green", "word")
169
+ color.train(:yellow, "yellow", "word")
170
+
171
+ b = input[number]
172
+
173
+ puts "Results >> #{color.classify(*b)}"
174
+
175
+ sleep(1)
176
+
177
+ number = number + 1
178
+ end
179
+ end
180
+
181
+ def self.what_action
182
+ input = File.read("data/actions/action_chart.txt").split(" ")
183
+
184
+ number = 0
185
+
186
+ size_limit = input.size.to_i
187
+
188
+ # Estimate each word in a sentence from a label.
189
+ size_limit.times do
190
+ require 'naive_bayes'
191
+
192
+ action = NaiveBayes.new(:eat, :toss)
193
+
194
+ # Trains on apple colors.
195
+ action.train(:eat, "eat", "word")
196
+ action.train(:toss, "toss", "word")
197
+
198
+ b = input[number]
199
+
200
+ puts "Results >> #{action.classify(*b)}"
201
+
202
+ sleep(1)
203
+
204
+ number = number + 1
205
+ end
54
206
  end
55
207
  end
56
208
 
57
- # Points to specific subroutines.
209
+ # Points to specific SimpleSearch.
58
210
  class SimpleSearch
59
211
 
60
212
  # ImpUnit::SimpleSearch.standard
@@ -303,68 +455,345 @@ module ImpUnit
303
455
 
304
456
  <?xml-stylesheet type="text/css" href="styles/stylesheet.css"?>'
305
457
 
458
+ # Topic tags
306
459
  topic_header = "<topic>"
307
460
  topic_bottom = "</topic>"
308
461
 
309
- def salut
310
- " <salut>Hello</salut>"
311
- end
462
+ # Read in from files.
463
+ agent_name = File.read("data/usr_identity/name.txt").strip.to_s
464
+ request_type = File.read("data/rikusuto/request.txt").strip.to_s
465
+ item = File.read("data/atemu/items.txt").strip.to_s
466
+ user_name = File.read("data/yuza/yuza.txt").strip.to_s
467
+ local_name = File.read("data/usr_identity/local_name.txt").strip.to_s
468
+
469
+ # Create XML tags
470
+ salut = "Hello"
471
+ ejento = " #{agent_name}"
472
+ rikusuto = " #{request_type}"
473
+ atemu = " #{item}"
474
+ nitote = " for"
475
+ kara = " from"
476
+ yuza = " #{user_name}"
477
+ lieu = " #{local_name}?"
312
478
 
313
- def ejento
314
- agent_name = File.read("data/usr_identity/name.txt").strip.to_s
479
+ conjucate = [nitote, kara]
480
+ consign = conjucate.sample
315
481
 
316
- " <ejento>#{agent_name}</ejento>"
317
- end
482
+ user_location = [yuza, lieu]
483
+ usign = user_location[0]
318
484
 
319
- def rikusuto
320
- request_type = File.read("data/rikusuto/request.txt").strip.to_s
485
+ system("date +'%Y-%d-%m' > date.txt")
321
486
 
322
- " <rikusuto>#{request_type}</rikusuto>"
323
- end
487
+ date = File.read("date.txt").strip.to_s
324
488
 
325
- def atemu
326
- item = File.read("data/atemu/items.txt").strip.to_s
489
+ open("#{date}-update.md", "w") { |f|
490
+ f.puts "---"
491
+ f.puts "title: '#{date} Update'"
492
+ f.puts "layout: post"
493
+ f.puts "---"
494
+ f.puts "#{salut} #{ejento} #{rikusuto} #{atemu} #{consign} #{usign}"
495
+ }
496
+ end
497
+ end
327
498
 
328
- " <atemu>#{item}</atemu>"
329
- end
499
+ class BotWings
500
+ def self.reset_evo
501
+ reset_usr_input = 0
330
502
 
331
- def nitote
332
- " <nitote>for</nitote>"
333
- end
503
+ open("data/number/input.txt", "w") { |f|
504
+ f.puts reset_usr_input
505
+ }
506
+ end
334
507
 
335
- def kara
336
- " <kara>from</kara>"
337
- end
508
+ def self.use_form
509
+ system("tts 'Form status: Suitable...', 'en'")
338
510
 
339
- def yuza
340
- user_name = File.read("data/yuza/yuza.txt").strip.to_s
511
+ sleep(3)
341
512
 
342
- " <yuza>#{user_name}</yuza>"
343
- end
513
+ # Detect bot form
514
+ # bot_choice = File.read("data/bot_input/input.txt").strip.to_i
515
+ # bot_wings = File.readlines("data/bot_shape/wings.txt")
516
+
517
+ # Form conditional
518
+ # if bot form is decision tree
519
+ # elsif bot form is naive bayes
520
+ # elsif bot form is biometrics
521
+ # elsif bot form is "infinite learning algorithm"
522
+
523
+ abort
524
+ end
525
+
526
+ def self.reshape
527
+ system("clear")
528
+
529
+ model_type = File.read("data/model/model_type.txt").strip
530
+
531
+ bot_choice = File.read("data/bot_input/input.txt").strip.to_i
532
+ number = File.read("data/number/input.txt").strip.to_i
533
+
534
+ usr_wings = File.readlines("data/usr_shape/wings.txt")
535
+ bot_wings = File.readlines("data/bot_shape/wings.txt")
536
+
537
+ current_wingset = usr_wings[number]
538
+ current_botwings = bot_wings[bot_choice]
539
+
540
+ system("tts 'The user #{model_type} model has: #{current_wingset}', 'en'")
541
+ system("tts 'The bot #{model_type} model has: #{current_botwings}', 'en'")
542
+
543
+ if current_wingset == current_botwings
544
+ ImpUnit::BotWings.use_form
545
+
546
+ sleep(3)
547
+
548
+ about
549
+ # ImpUnit::BotWings.reset_evo
550
+ else
551
+ system("tts 'Form status: Changing form...', 'en'")
552
+
553
+ sleep(3)
344
554
 
345
- def lieu
346
- local_name = File.read("data/usr_identity/local_name.txt").strip.to_s
555
+ new_value = number + 1
347
556
 
348
- " <lieu>#{local_name}</lieu>"
557
+ open("data/number/input.txt", "w") { |f|
558
+ f.puts new_value
559
+ }
349
560
  end
350
561
 
351
- conjucate = [nitote, kara]
352
- consign = conjucate.sample
562
+ ImpUnit::BotWings.reshape
563
+ end
564
+ end
353
565
 
354
- user_location = [yuza, lieu]
355
- usign = user_location[0]
566
+ class Spices
356
567
 
357
- open("index.xml", "w") { |f|
358
- f.puts xml_header
359
- f.puts topic_header
360
- f.puts salut
361
- f.puts ejento
362
- f.puts rikusuto
363
- f.puts atemu
364
- f.puts consign
365
- f.puts usign
366
- f.puts topic_bottom
367
- }
568
+ def self.tumeric
569
+ spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
570
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
571
+ "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
572
+
573
+ spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
574
+
575
+ print spoon_size.sample
576
+ print spoon_type.sample
577
+ puts " turmeric"
578
+ end
579
+
580
+ def self.cumin
581
+ spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
582
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
583
+ "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
584
+
585
+ spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
586
+
587
+ print spoon_size.sample
588
+ print spoon_type.sample
589
+ puts " cumin"
590
+ end
591
+
592
+ def self.cayenne
593
+ spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
594
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
595
+ "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
596
+
597
+ spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
598
+
599
+ print spoon_size.sample
600
+ print spoon_type.sample
601
+ puts " cayenne"
602
+ end
603
+
604
+ def self.chilly_powder
605
+ spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
606
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
607
+ "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
608
+
609
+ spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
610
+
611
+ print spoon_size.sample
612
+ print spoon_type.sample
613
+ puts " chilly powder"
614
+ end
615
+
616
+ def self.crushed_peppers
617
+ spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
618
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
619
+ "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
620
+
621
+ spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
622
+
623
+ print spoon_size.sample
624
+ print spoon_type.sample
625
+ puts " crushed peppers"
626
+ end
627
+
628
+ def self.garlic_powder
629
+ spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
630
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
631
+ "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
632
+
633
+ spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
634
+
635
+ print spoon_size.sample
636
+ print spoon_type.sample
637
+ puts " garlic powder"
638
+ end
639
+
640
+ def self.onion_powder
641
+ spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
642
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
643
+ "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
644
+
645
+ spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
646
+
647
+ print spoon_size.sample
648
+ print spoon_type.sample
649
+ puts " onion powder"
650
+ end
651
+
652
+ def self.cocao_powder
653
+ spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
654
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
655
+ "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
656
+
657
+ spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
658
+
659
+ print spoon_size.sample
660
+ print spoon_type.sample
661
+ puts " cocao powder"
662
+ end
663
+
664
+ def self.cinnamon
665
+ spoon_size = [ "1/8 ", "1/4 ", "1/2 ", "1 ",
666
+ "1 1/8 ", "1 1/4th ", "1 1/2 ", "2 ",
667
+ "2 1/8 ", "2 1/4th ", "2 1/2 ", "3 "]
668
+
669
+ spoon_type = ["teaspoon ", "tablespoon ", "cup ", "shotglass "]
670
+
671
+ print spoon_size.sample
672
+ print spoon_type.sample
673
+ puts " cinnamon"
368
674
  end
369
675
  end
370
676
  end
677
+
678
+ #module Bianca
679
+ #class SmallTalk
680
+ #def self.name
681
+ #end
682
+
683
+ #def self.pets
684
+ #end
685
+
686
+ #def self.hobbies
687
+ #end
688
+
689
+ #def self.jobs
690
+ #end
691
+
692
+ #def self.skills
693
+ #end
694
+
695
+ #def self.weather
696
+ #end
697
+
698
+ #def self.operate
699
+ #end
700
+ #end
701
+ #end
702
+
703
+ ## Measuring the distance between objects and size of objects in space.
704
+ #module SpatialRelationships
705
+ #class Error < StandardError; end
706
+
707
+ #class Static_Perimeters
708
+
709
+ # The objects within the space.
710
+ #def positive_perimeters
711
+ # Base radius of static objects.
712
+ #base_radius = 2500
713
+
714
+ # Specfic multipliers for Earth index based objects.
715
+ #base_two = 2
716
+ #base_fro = 4
717
+ #base_six = 6
718
+ #base_eit = 8
719
+
720
+ # Size of specific objects.
721
+ #size_of_planets = base_radius ** base_fro
722
+ #size_of_moons = base_radius ** base_two
723
+ #size_of_stars = base_radius ** base_six
724
+ #size_of_blackholes = base_radius ** base_eit
725
+
726
+ # Total output sizes of specific objects.
727
+ #puts "The size of the planets is #{size_of_planets} radius."; sleep(3)
728
+ #puts "The size of the moons is #{size_of_moons} radius."; sleep(3)
729
+ #puts "The size of the stars is #{size_of_stars} radius."; sleep(3)
730
+ #puts "The size of a blackhole is #{size_of_blackholes} radius."; sleep(3)
731
+ #end
732
+
733
+ # Space between the objects.
734
+ #def negative_perimeters
735
+ # Base distance between objects.
736
+ #base_distance = 1_000_000_000
737
+
738
+ # Estimated divider between specific objects to base distance.
739
+ #space_between_planets = 43.8
740
+ #space_between_moons = 14.6
741
+ #space_between_stars = 876
742
+ #space_between_blackholes = 2628
743
+
744
+ # Minimum distance between objects.
745
+ #planet_distance = base_distance / space_between_planets
746
+ #moon_distance = base_distance / space_between_moons
747
+ #star_distance = base_distance / space_between_stars
748
+ #blackhole_distance = base_distance / space_between_blackholes
749
+
750
+ # Actual distance between objects
751
+ #actual_planets = planet_distance * 10
752
+ #actual_moons = moon_distance * 10
753
+ #actual_stars = star_distance * 10
754
+ #actual_blackholes = blackhole_distance * 10
755
+
756
+ # The output results of distance between objects.
757
+ #puts "The distance between planets is #{actual_planets} miles."; sleep(3)
758
+ #puts "The distance between moons is #{actual_moons} miles."; sleep(3)
759
+ #puts "The distance between stars is #{actual_stars} miles."; sleep(3)
760
+ #puts "The distance between blackholes is #{actual_blackholes} miles."; sleep(3)
761
+ #end
762
+
763
+ #end
764
+
765
+ # Changing perimeters
766
+ #class Dynamic_Perimeters
767
+
768
+ # The objects within the space.
769
+ #def positive_perimeters
770
+ #spaceship = File.read("data/dynamic/positive_perimenters/spaceship_size.txt").strip.to_i
771
+ #space_station = spaceship * 200
772
+ #satalite = space_station / 10
773
+
774
+ #puts "The total size of the space shuttle is #{spaceship} feet."; sleep(3)
775
+ #puts "The total size of the space station is #{space_station} feet."; sleep(3)
776
+ #puts "The total size of the satalite is #{satalite} feet."; sleep(3)
777
+ #end
778
+
779
+ # Space between the objects.
780
+ #def negative_perimeters
781
+ #base_multiplier = 10
782
+
783
+ # Minimum space between objects.
784
+ #space_between_spaceships = File.read("data/dynamic/negative_perimeters/space_between_spaceships.txt").strip.to_i
785
+ #space_between_station = File.read("data/dynamic/negative_perimeters/space_between_station.txt").strip.to_i
786
+ #space_between_satalite = File.read("data/dynamic/negative_perimeters/space_between_satalite.txt").strip.to_i
787
+
788
+ # Actual space between objects
789
+ #actual_spaceship_distance = space_between_spaceships * base_multiplier
790
+ #actual_station_distance = space_between_station * base_multiplier
791
+ #actual_satalite_distance = space_between_satalite * base_multiplier
792
+
793
+ #puts "The minimum space between shuttles is #{actual_spaceship_distance} feet."; sleep(3)
794
+ #puts "The minimum space between stations is #{actual_station_distance} feet."; sleep(3)
795
+ #puts "The minimum space between satalites is #{actual_satalite_distance} feet."; sleep(3)
796
+ #end
797
+
798
+ #end
799
+ #end
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.1.5
4
+ version: 0.2.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-14 00:00:00.000000000 Z
11
+ date: 2021-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler