HeritageNoMetairo 0.1.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6fb12158a200e917a5d99035bdf31235e76aa340eafea2572ad6915bc870c8fe
4
+ data.tar.gz: 1cd137aa574507ddeb9d96065f4ad6827dd981b26f2310b6a46c92ee755b4d3e
5
+ SHA512:
6
+ metadata.gz: 2c98559324bff2be73a5bfe180e6d0128e53074510b25f451082e7acf705fee4be5c86745797a972b2d37002647c8431d5cc1fe8f15a212cbd0cd8dba6aed799
7
+ data.tar.gz: 61b08b5875436b87596aa8898dbf2102ae724bd5221600ab41a487a446119aab09b44563627fa9f7926fd3e1894afeebbadc455c2370622d5a5de49d45ec6911
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # HeritageNoMetairo
2
+
3
+ TODO: Delete this and the text below, and describe your gem
4
+
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/HeritageNoMetairo`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ ## Installation
8
+
9
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
+
11
+ Install the gem and add to the application's Gemfile by executing:
12
+
13
+ ```bash
14
+ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
15
+ ```
16
+
17
+ If bundler is not being used to manage dependencies, install the gem by executing:
18
+
19
+ ```bash
20
+ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/HeritageNoMetairo.
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ task default: %i[]
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HeritageNoMetairo
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,590 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "HeritageNoMetairo/version"
4
+
5
+ module HeritageNoMetairo
6
+ class Error < StandardError; end # HeritageNoMetairo
7
+
8
+ class Analyze
9
+ ###############################################################################################
10
+ # Colors In Context #
11
+ ###############################################################################################
12
+ # This enables the framework to generate new contexts for when a color might be referenced or #
13
+ # said in conversation, such as discovering an untranslated phrase about a color in an #
14
+ # ancient language. #
15
+ ###############################################################################################
16
+ def self.colors_in_context
17
+ ## Choosing an random Word Class
18
+ word_classes = [
19
+ [["Le", "Le"], ["Le", "La"], ["Le", "Les"]],
20
+ [["La", "Le"], ["La", "La"], ["La", "Les"]],
21
+ [["Les", "Le"], ["Les", "La"], ["Les", "Les"]],
22
+ ]
23
+
24
+ row_options = [0, 1, 2]
25
+ col_options = [0, 1, 2]
26
+ arr_options = [0, 1]
27
+
28
+ cur_row = row_options.sample
29
+ cur_col = col_options.sample
30
+ cur_arr = arr_options.sample
31
+
32
+ chosen_word_class = word_classes[cur_row][cur_col][cur_arr]
33
+
34
+ ## Choosing a random noun
35
+ nouns = [
36
+ [["chien", "chien"], ["chien", "chatte"], ["chien", "furet"]],
37
+ [["chatte", "chien"], ["chatte", "chatte"], ["chatte", "furet"]],
38
+ [["furet", "chien"], ["furet", "chatte"], ["furet", "furet"]],
39
+ ]
40
+
41
+ row_options = [0, 1, 2]
42
+ col_options = [0, 1, 2]
43
+ arr_options = [0, 1]
44
+
45
+ cur_row = row_options.sample
46
+ cur_col = col_options.sample
47
+ cur_arr = arr_options.sample
48
+
49
+ chosen_noun = nouns[cur_row][cur_col][cur_arr]
50
+
51
+ ## Choosing a random adjectives
52
+ r = "rouge"
53
+ o = "orange"
54
+ y = "jaune"
55
+ g = "vert"
56
+ b = "bleu"
57
+ p = "violet"
58
+
59
+ adjectives = [
60
+ [[r, r], [r, o], [r, y], [r, g], [r, b], [r, p]],
61
+ [[o, r], [o, o], [o, y], [o, g], [o, b], [o, p]],
62
+ [[y, r], [y, o], [y, y], [y, g], [y, b], [y, p]],
63
+ [[g, r], [g, o], [g, y], [g, g], [g, b], [g, p]],
64
+ [[b, r], [b, o], [b, y], [b, g], [b, b], [b, p]],
65
+ ]
66
+
67
+ row_options = [0, 1, 2, 3, 4]
68
+ col_options = [0, 1, 2, 3, 4]
69
+ arr_options = [0, 1]
70
+
71
+ cur_row = row_options.sample
72
+ cur_col = col_options.sample
73
+ cur_arr = arr_options.sample
74
+
75
+ chosen_adjective = adjectives[cur_row][cur_col][cur_arr]
76
+
77
+ ## Choosing a random subject
78
+ j = "Je"
79
+ t = "Tu"
80
+ v = "Vous"
81
+ n1 = "Nous"
82
+ i1 = "Il"
83
+ i2 = "Ils"
84
+ e1 = "Elle"
85
+ e2 = "Elles"
86
+ n2 = "Nousil"
87
+ n3 = "Nousils"
88
+ n4 = "Nouselle"
89
+ n5 = "Nouselles"
90
+ n6 = "Noustu"
91
+
92
+ subjects = [
93
+ [[j, j], [j, t], [j, v], [j, n1], [j, i1], [j, i2], [j, e1], [j, e2], [j, n2], [j, n3], [j, n4], [j, n5], [j, n6]],
94
+ [[t, j], [t, t], [t, v], [t, n1], [t, i1], [t, i2], [t, e1], [t, e2], [t, n2], [t, n3], [t, n4], [t, n5], [t, n6]],
95
+ [[v, j], [v, t], [v, v], [v, n1], [v, i1], [v, i2], [v, e1], [v, e2], [v, n2], [v, n3], [v, n4], [v, n5], [v, n6]],
96
+ [[n1, j], [n1, t], [n1, v], [n1, n1], [n1, i1], [n1, i2], [n1, e1], [n1, e2], [n1, n2], [n1, n3], [n1, n4], [n1, n5], [n1, n6]],
97
+ [[i1, j], [i1, t], [i1, v], [i1, n1], [i1, i1], [i1, i2], [i1, e1], [i1, e2], [i1, n2], [i1, n3], [i1, n4], [i1, n5], [i1, n6]],
98
+ [[i2, j], [i2, t], [i2, v], [i2, n1], [i2, i1], [i2, i2], [i2, e1], [i2, e2], [i2, n2], [i2, n3], [i2, n4], [i2, n5], [i2, n6]],
99
+ [[e1, j], [e1, t], [e1, v], [e1, n1], [e1, e1], [e1, e2], [e1, e1], [e1, e2], [e1, n2], [e1, n3], [e1, n4], [e1, n5], [e1, n6]],
100
+ [[e2, j], [e2, t], [e2, v], [e2, n1], [e2, e1], [e2, e2], [e2, e1], [e2, e2], [e2, n2], [e2, n3], [e2, n4], [e2, n5], [e2, n6]],
101
+ [[n1, j], [n1, t], [n1, v], [n1, n1], [n1, i1], [n1, i2], [n1, e1], [n1, e2], [n1, n2], [n1, n3], [n1, n4], [n1, n5], [n1, n6]],
102
+ [[n2, j], [n2, t], [n2, v], [n2, n1], [n2, i1], [n2, i2], [n2, e1], [n2, e2], [n2, n2], [n2, n3], [n2, n4], [n2, n5], [n2, n6]],
103
+ [[n3, j], [n3, t], [n3, v], [n3, n1], [n3, i1], [n3, i2], [n3, e1], [n3, e2], [n3, n2], [n3, n3], [n3, n4], [n3, n5], [n3, n6]],
104
+ [[n4, j], [n4, t], [n4, v], [n4, n1], [n4, i1], [n4, i2], [n4, e1], [n4, e2], [n4, n2], [n4, n3], [n4, n4], [n4, n5], [n4, n6]],
105
+ [[n5, j], [n5, t], [n5, v], [n5, n1], [n5, i1], [n5, i2], [n5, e1], [n5, e2], [n5, n2], [n5, n3], [n5, n5], [n5, n5], [n5, n6]],
106
+ ]
107
+
108
+ row_options = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
109
+ col_options = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
110
+ arr_options = [0, 1]
111
+
112
+ cur_row = row_options.sample
113
+ cur_col = col_options.sample
114
+ cur_arr = arr_options.sample
115
+
116
+ chosen_subject = subjects[cur_row][cur_col][cur_arr]
117
+
118
+ ## Choosing a random verb
119
+ p = "petto"
120
+ f = "fido"
121
+ w = "warutzu"
122
+
123
+ verbs = [
124
+ [[p, p], [p, f], [p, w]],
125
+ [[f, p], [f, f], [f, w]],
126
+ [[w, p], [w, f], [w, w]],
127
+ ]
128
+
129
+ row_options = [0, 1, 2]
130
+ col_options = [0, 1, 2]
131
+ arr_options = [0, 1]
132
+
133
+ cur_row = row_options.sample
134
+ cur_col = col_options.sample
135
+ cur_arr = arr_options.sample
136
+
137
+ chosen_verb = verbs[cur_row][cur_col][cur_arr]
138
+
139
+ ## Choosing a random adverb
140
+ q = "quicely"
141
+ s = "lentement"
142
+
143
+ adverbs = [
144
+ [[q, q], [q, s]],
145
+ [[s, q], [s, s]],
146
+ ]
147
+
148
+ row_options = [0, 1]
149
+ col_options = [0, 1]
150
+ arr_options = [0, 1]
151
+
152
+ cur_row = row_options.sample
153
+ cur_col = col_options.sample
154
+ cur_arr = arr_options.sample
155
+
156
+ chosen_adverb = adverbs[cur_row][cur_col][cur_arr]
157
+
158
+ created_phrase = "#{chosen_word_class} #{chosen_noun} #{chosen_adjective} #{chosen_subject} #{chosen_verb} #{chosen_adverb}."
159
+
160
+ print "#{created_phrase} : "
161
+
162
+ File.open("data/colors/new_colors.txt", "a") { |f|
163
+ f.puts created_phrase
164
+ }
165
+ end
166
+
167
+ ###############################################################################################
168
+ # Assign Color Data #
169
+ ###############################################################################################
170
+ # This allows the system to assign identifiers, English names, hex codes, and invented lang #
171
+ # names for colors into a format the naive bayes and decision tree algorithm for recommending #
172
+ # new information can use. #
173
+ ###############################################################################################
174
+ def self.color_data
175
+ color_ph = [
176
+ [:PH4DR1, "Salmon", "#FC746B", "Samon"], # 0
177
+ [:PH4DR2, "Copper", "#D27D48", "Cuivre"], # 1
178
+ [:PH4DR3, "Salmon Pink", "#F26E6E", "Samonrose"], # 2
179
+ [:PH5DR1, "Pale Salmon", "#EEA38F", "Samonblanc"], # 3
180
+ [:PH5DR2, "Khaki", "#B9B369", "Khaki"], # 4
181
+ [:PH5DR3, "Light Mauve", "#C7A2B1", "Mauveraito"], # 5
182
+ [:PH6DR1, "Maize", "#F9CF55", "Meizu"], # 6
183
+ [:PH6DR2, "Pale Lime", "#B1F468", "Remonblanc"], # 7
184
+ [:PH6DR3, "Bland", "#CBC4AA", "Burando"], # 8
185
+ [:PH7DR1, "Vibrant Green", "#0AD322", "Gurinvieil"], # 9
186
+ [:PH7DR2, "Medium Green", "#50CE6C", "Chadeuxgris"], # 10
187
+ [:PH7DR3, "Grey Blue", "#84A9CA", "Burugris"], # 11
188
+ [:PH8DR1, "Japanese Bistre", "#65482C", "Nihongobistre"], # 12
189
+ [:PH8DR2, "Kelly Green", "#0DA52B", "Kerivert"], # 13
190
+ [:PH8DR2, "Sapphire 1", "#0D36A3", "Saphirune"], # 14
191
+ [:PH9DR1, "Dull Purple", "#7D567A", "Gris De Violet"], # 15
192
+ [:PH9DR2, "Viridian", "#0B916B", "Viridian"], # 16
193
+ [:PH9DR3, "Sapphire 2", "#0A47B8", "Saphirdeux"], # 17
194
+ ]
195
+
196
+ ## Salmon
197
+ @salmon_ident = color_ph[0][0]
198
+ @salmon_name = color_ph[0][1]
199
+ @salmon_hex = color_ph[0][2]
200
+ @salmon_invent = color_ph[0][3]
201
+
202
+ ## Copper
203
+ @copper_ident = color_ph[1][0]
204
+ @copper_name = color_ph[1][1]
205
+ @copper_hex = color_ph[1][2]
206
+ @copper_invent = color_ph[1][3]
207
+
208
+ ## Salmon Pink
209
+ @salmonpink_ident = color_ph[2][0]
210
+ @salmonpink_name = color_ph[2][1]
211
+ @salmonink_hex = color_ph[2][2]
212
+ @salmonink_invent = color_ph[2][4]
213
+
214
+ ## Pale Salmon
215
+ @salmonpale_ident = color_ph[3][0]
216
+ @salmonpale_name = color_ph[3][1]
217
+ @salmonpale_hex = color_ph[3][2]
218
+ @salmonpale_invent = color_ph[3][3]
219
+
220
+ ## Maize
221
+ @maize_ident = color_ph[4][0]
222
+ @maize_name = color_ph[4][1]
223
+ @maize_hex = color_ph[4][2]
224
+ @maize_invent = color_ph[4][3]
225
+
226
+ ## Pale Lime
227
+ @plime_ident = color_ph[5][0]
228
+ @plime_name = color_ph[5][1]
229
+ @plime_hex = color_ph[5][2]
230
+ @plime_invent = color_ph[5][3]
231
+
232
+ ## Khaki
233
+ @khaki_ident = color_ph[6][0]
234
+ @khaki_name = color_ph[6][1]
235
+ @khaki_hex = color_ph[6][2]
236
+ @khaki_invent = color_ph[6][4]
237
+
238
+ ## Light Mauve
239
+ @lmauve_ident = color_ph[7][0]
240
+ @lmauve_name = color_ph[7][1]
241
+ @lmauve_hex = color_ph[7][2]
242
+ @lmauve_invent = color_ph[7][4]
243
+
244
+ ## Bland
245
+ @bland_ident = color_ph[8][0]
246
+ @bland_name = color_ph[8][1]
247
+ @bland_hex = color_ph[8][2]
248
+ @bland_invent = color_ph[8][4]
249
+
250
+ ## Vibrant Green
251
+ @vgreen_ident = color_ph[9][0]
252
+ @vgreen_name = color_ph[9][1]
253
+ @vgreen_hex = color_ph[9][2]
254
+ @vgreen_invent = color_ph[9][4]
255
+
256
+ ## Medium Green
257
+ @mgreen_ident = color_ph[10][0]
258
+ @mgreen_name = color_ph[10][1]
259
+ @mgreen_hex = color_ph[10][2]
260
+ @mgreen_invent = color_ph[10][4]
261
+
262
+ ## Grey Blue
263
+ @gblue_ident = color_ph[11][0]
264
+ @gblue_name = color_ph[11][1]
265
+ @gblue_hex = color_ph[11][2]
266
+ @gblue_invent = color_ph[11][4]
267
+
268
+ ## Japanese Bistre
269
+ @jbistre_ident = color_ph[12][0]
270
+ @jbistre_name = color_ph[12][1]
271
+ @jbistre_hex = color_ph[12][2]
272
+ @jbistre_invent = color_ph[12][4]
273
+
274
+ ## Kelly Green
275
+ @kgreen_ident = color_ph[13][0]
276
+ @kgreen_name = color_ph[13][1]
277
+ @kgreen_hex = color_ph[13][2]
278
+ @kgreen_invent = color_ph[13][4]
279
+
280
+ ## Sapphire 1
281
+ @saph1_ident = color_ph[14][0]
282
+ @saph1_name = color_ph[14][1]
283
+ @saph1_hex = color_ph[14][2]
284
+ @saph1_invent = color_ph[14][4]
285
+
286
+ ## Dull Purple
287
+ @dpurp_ident = color_ph[15][0]
288
+ @dpurp_name = color_ph[15][1]
289
+ @dpurp_hex = color_ph[15][2]
290
+ @dpurp_invent = color_ph[15][4]
291
+
292
+ ## Viridian
293
+ @viri_ident = color_ph[16][0]
294
+ @viri_name = color_ph[16][1]
295
+ @viri_hex = color_ph[16][2]
296
+ @viri_invent = color_ph[16][4]
297
+
298
+ ## Sapphire 2
299
+ @saph2_ident = color_ph[17][0]
300
+ @saph2_name = color_ph[17][1]
301
+ @saph2_hex = color_ph[17][2]
302
+ @saph2_invent = color_ph[17][4]
303
+ end
304
+
305
+ ###############################################################################################
306
+ # Predict Colors #
307
+ ###############################################################################################
308
+ # Predict new color probabilities based on the assigned information provided, and convert #
309
+ # that into a probability that the decision tree can use. #
310
+ ###############################################################################################
311
+ def self.predict_colors
312
+ require "naive_bayes"
313
+
314
+ color_science = NaiveBayes.new(:identifier, :name, :hex_code, :invented_language_name, :cryptographic_hash)
315
+
316
+ ## Identifiers
317
+ color_science.train(:identifier, @salmon_ident, "Salmon")
318
+ color_science.train(:identifier, @copper_ident, "Copper")
319
+ color_science.train(:identifier, @salmonpink_ident, "Salmon Pink")
320
+ color_science.train(:identifier, @salmonpale_ident, "Salmon Pale")
321
+ color_science.train(:identifier, @maize_ident, "Maize")
322
+ color_science.train(:identifier, @plime_ident, "Pale Lime")
323
+ color_science.train(:identifier, @khaki_ident, "Khaki")
324
+ color_science.train(:identifier, @lmauve_ident, "Light Mauve")
325
+ color_science.train(:identifier, @bland_ident, "Bland")
326
+ color_science.train(:identifier, @vgreen_ident, "Vibrant Green")
327
+ color_science.train(:identifier, @gblue_ident, "Grey Blue")
328
+ color_science.train(:identifier, @jbistre_ident, "Japanese Bistre")
329
+ color_science.train(:identifier, @kgreen_ident, "Kelly Green")
330
+ color_science.train(:identifier, @saph1_ident, "Sapphire 1")
331
+ color_science.train(:identifier, @dpurp_ident, "Dull Purple")
332
+ color_science.train(:identifier, @viri_ident, "Dull Purple")
333
+ color_science.train(:identifier, @saph2_ident, "Sapphire 2")
334
+
335
+ ## Name
336
+ color_science.train(:name, @salmon_name, "Salmon")
337
+ color_science.train(:name, @copper_name, "Copper")
338
+ color_science.train(:name, @salmonpink_name, "Salmon Pink")
339
+ color_science.train(:name, @salmonpale_name, "Salmon Pale")
340
+ color_science.train(:name, @maize_name, "Maize")
341
+ color_science.train(:name, @plime_name, "Pale Lime")
342
+ color_science.train(:name, @khaki_name, "Khaki")
343
+ color_science.train(:name, @lmauve_name, "Light Mauve")
344
+ color_science.train(:name, @bland_name, "Bland")
345
+ color_science.train(:name, @vgreen_name, "Vibrant Green")
346
+ color_science.train(:name, @gblue_name, "Grey Blue")
347
+ color_science.train(:name, @jbistre_name, "Japanese Bistre")
348
+ color_science.train(:name, @kgreen_name, "Kelly Green")
349
+ color_science.train(:name, @saph1_name, "Sapphire 1")
350
+ color_science.train(:name, @dpurp_name, "Dull Purple")
351
+ color_science.train(:name, @viri_name, "Dull Purple")
352
+ color_science.train(:name, @saph2_name, "Sapphire 2")
353
+
354
+ ## Hex Code
355
+ color_science.train(:hex_code, @salmon_hex, "Salmon")
356
+ color_science.train(:hex_code, @copper_hex, "Copper")
357
+ color_science.train(:hex_code, @salmonpink_hex, "Salmon Pink")
358
+ color_science.train(:hex_code, @salmonpale_hex, "Salmon Pale")
359
+ color_science.train(:hex_code, @maize_hex, "Maize")
360
+ color_science.train(:hex_code, @plime_hex, "Pale Lime")
361
+ color_science.train(:hex_code, @khaki_hex, "Khaki")
362
+ color_science.train(:hex_code, @lmauve_hex, "Light Mauve")
363
+ color_science.train(:hex_code, @bland_hex, "Bland")
364
+ color_science.train(:hex_code, @vgreen_hex, "Vibrant Green")
365
+ color_science.train(:hex_code, @gblue_hex, "Grey Blue")
366
+ color_science.train(:hex_code, @jbistre_hex, "Japanese Bistre")
367
+ color_science.train(:hex_code, @kgreen_hex, "Kelly Green")
368
+ color_science.train(:hex_code, @saph1_hex, "Sapphire 1")
369
+ color_science.train(:hex_code, @dpurp_hex, "Dull Purple")
370
+ color_science.train(:hex_code, @viri_hex, "Dull Purple")
371
+ color_science.train(:hex_code, @saph2_hex, "Sapphire 2")
372
+
373
+ ## invent Code
374
+ color_science.train(:invented_language_name, @salmon_invent, "Salmon")
375
+ color_science.train(:invented_language_name, @copper_invent, "Copper")
376
+ color_science.train(:invented_language_name, @salmonpink_invent, "Salmon Pink")
377
+ color_science.train(:invented_language_name, @salmonpale_invent, "Salmon Pale")
378
+ color_science.train(:invented_language_name, @maize_invent, "Maize")
379
+ color_science.train(:invented_language_name, @plime_invent, "Pale Lime")
380
+ color_science.train(:invented_language_name, @khaki_invent, "Khaki")
381
+ color_science.train(:invented_language_name, @lmauve_invent, "Light Mauve")
382
+ color_science.train(:invented_language_name, @bland_invent, "Bland")
383
+ color_science.train(:invented_language_name, @vgreen_invent, "Vibrant Green")
384
+ color_science.train(:invented_language_name, @gblue_invent, "Grey Blue")
385
+ color_science.train(:invented_language_name, @jbistre_invent, "Japanese Bistre")
386
+ color_science.train(:invented_language_name, @kgreen_invent, "Kelly Green")
387
+ color_science.train(:invented_language_name, @saph1_invent, "Sapphire 1")
388
+ color_science.train(:invented_language_name, @dpurp_invent, "Dull Purple")
389
+ color_science.train(:invented_language_name, @viri_invent, "Dull Purple")
390
+ color_science.train(:invented_language_name, @saph2_invent, "Sapphire 2")
391
+
392
+ ## Recognize Unusual Hashes
393
+ color_science.train(:cryptographic_hash, '18b07b3750e769ac646902d4ab9b8da4', "cryptographic hash")
394
+ color_science.train(:cryptographic_hash, '37c854f0133347f815ea4a694f2d04bd', "cryptographic hash")
395
+ color_science.train(:cryptographic_hash, '40b089a385a3862b118fd38a743e967c', "cryptographic hash")
396
+
397
+ new_colors = File.readlines("data/colors/new_colors.txt")
398
+ size_limit = new_colors.size.to_i
399
+ index = 0
400
+
401
+ size_limit.times do
402
+ ColorScience::Analyze.colors_in_context
403
+
404
+ classification = color_science.classify(*new_colors[index])
405
+
406
+ ## Classification Datapoints
407
+ @label = classification[0] # .tr " ", ""
408
+ @probability_no = classification[1]
409
+ @probability_yes = 1 - @probability_no
410
+
411
+ random_color_probability = [0.058823529, 0.470588236, 0.977941177].sample
412
+
413
+ @new_calculation = @probability_no + random_color_probability / 2
414
+
415
+ print "Is '#{new_colors[index].strip}' #{@label}? #{@probability_yes} / #{@probability_no} "
416
+
417
+ ColorScience::Analyze.suggest_next_color
418
+
419
+ #@new_calculation = @new_calculation + @probability_no
420
+ end
421
+ end
422
+
423
+ ###############################################################################################
424
+ # Suggest New Color #
425
+ ###############################################################################################
426
+ # Suggest a new color to the player that can go into their color palette, rather than #
427
+ # chasing a random color name or hex code at random. #
428
+ ###############################################################################################
429
+ def self.suggest_next_color
430
+ require "decisiontree"
431
+ require "digest"
432
+
433
+ attributes = ["Identifier"],
434
+ ["Name"],
435
+ ["Hex Code"],
436
+ ["Invented Name"]
437
+
438
+ training = [
439
+ [0.058823529, "PH4DR1"], [0.088235296, "PH4DR2"], [0.147058825, "PH4DR3"],
440
+ [0.205882354, "PH5DR1"], [0.264705883, "PH5DR2"], [0.323529412, "PH5DR3"],
441
+ [0.397058824, "PH6DR1"], [0.470588236, "PH6DR2"], [0.529411765, "PH6DR3"],
442
+ [0.764705883, "PH7DR1"], [0.794117648, "PH7DR2"], [0.823529412, "PH7DR3"],
443
+ [0.852941177, "PH8DR1"], [0.882352941, "PH8DR2"], [0.897058824, "PH8DR2"],
444
+ [0.911764706, "PH9DR1"], [0.955882353, "PH9DR2"], [0.977941177, "PH9DR3"],
445
+ ], [
446
+ [0.058823529, "Salmon"], [0.088235296, "Copper"], [0.147058825, "Salmon Pink"],
447
+ [0.205882354, "Pale Salmon"], [0.264705883, "Khaki"], [0.323529412, "Light Mauve"],
448
+ [0.397058824, "Maize"], [0.470588236, "Pale Lime"], [0.529411765, "Bland"],
449
+ [0.764705883, "Vibrant Green"], [0.794117648, "Medium Green"], [0.823529412, "Grey Blue"],
450
+ [0.852941177, "Japanese Bistre"], [0.882352941, "Kelly Green"], [0.897058824, "Sapphire 1"],
451
+ [0.911764706, "Dull Purple"], [0.955882353, "Viidian"], [0.977941177, "Sapphire 2"],
452
+ ], [
453
+ [0.058823529, "#FC746B"], [0.088235296, "#D27D48"], [0.147058825, "#F26E6E"],
454
+ [0.205882354, "#EEA38F"], [0.264705883, "#B9B369"], [0.323529412, "#C7A2B1"],
455
+ [0.397058824, "#F9CF55"], [0.470588236, "#B1F468"], [0.529411765, "#CBC4AA"],
456
+ [0.764705883, "#0AD322"], [0.794117648, "#50CE6C"], [0.823529412, "#84A9CA"],
457
+ [0.852941177, "#65482C"], [0.882352941, "#0DA52B"], [0.897058824, "#0D36A3"],
458
+ [0.911764706, "#7D567A"], [0.955882353, "#0B916B"], [0.977941177, "#0A47B8"],
459
+ ], [
460
+ [0.058823529, "Samon"], [0.088235296, "Cuivre"], [0.147058825, "Samonrose"],
461
+ [0.205882354, "Samonblanc"], [0.264705883, "Khaki"], [0.323529412, "Mauveraito"],
462
+ [0.397058824, "Meizu"], [0.470588236, "Remonblanc"], [0.529411765, "Burando"],
463
+ [0.764705883, "Gurinviell"], [0.794117648, "Chadeuxgris"], [0.823529412, "Burugris"],
464
+ [0.852941177, "Nihongobistre"], [0.882352941, "Kerivert"], [0.897058824, "Saphirune"],
465
+ [0.911764706, "Gris De Violet"], [0.955882353, "Viridian"], [0.977941177, "Saphirdeux"],
466
+ ]
467
+
468
+ dec_tree = DecisionTree::ID3Tree.new(attributes[0], training[0], 1, :continuous),
469
+ DecisionTree::ID3Tree.new(attributes[1], training[1], 1, :continuous),
470
+ DecisionTree::ID3Tree.new(attributes[2], training[2], 1, :continuous),
471
+ DecisionTree::ID3Tree.new(attributes[3], training[3], 1, :continuous),
472
+ DecisionTree::ID3Tree.new(attributes[4], training[4], 1, :continuous)
473
+
474
+ current_dectree1 = dec_tree[0]
475
+ current_dectree1.train
476
+
477
+ current_dectree2 = dec_tree[1]
478
+ current_dectree2.train
479
+
480
+ current_dectree3 = dec_tree[2]
481
+ current_dectree3.train
482
+
483
+ current_dectree4 = dec_tree[3]
484
+ current_dectree4.train
485
+
486
+ identifier = [@new_calculation, "PH6DR2"]
487
+ name = [@new_calculation, "Pale Lime"]
488
+ hex_code = [@new_calculation, "#B1F468"]
489
+ invent_name = [@new_calculation, "Remonblanc"]
490
+
491
+ decision1 = current_dectree1.predict(identifier)
492
+ decision2 = current_dectree2.predict(name)
493
+ decision3 = current_dectree3.predict(hex_code)
494
+ decision4 = current_dectree4.predict(invent_name)
495
+
496
+
497
+ md5 = Digest::MD5.new
498
+ new_mixture = md5.update "['#{decision1}', '#{decision2}', '#{decision3}', '#{decision4}']"
499
+
500
+ puts " > ['#{decision1}', '#{decision2}', '#{decision3}', '#{decision4}']"
501
+
502
+ File.open("data/colors/suggestions/suggest_colors.txt", "a") { |f|
503
+ f.puts "[:#{decision1}, '#{decision2}', '#{decision3}', '#{decision4}'] #{new_mixture}"
504
+ }
505
+
506
+ File.open("data/atomspace/colors.metta", "a") { |f|
507
+ f.puts "!((#{decision1}) (#{decision2}) (#{decision3}) (#{decision4}));"
508
+ }
509
+ end
510
+
511
+ # def self.authenticate_datapoints
512
+ # require "digest"
513
+ #
514
+ # authentication_pairs = [
515
+ # ["[:PH4DR1, 'Salmon', '#FC746B', 'Samon']", "37c854f0133347f815ea4a694f2d04bd"]],
516
+ # ["[:PH5DR2, 'Khaki', '#B9B369', 'Khaki']", "40b089a385a3862b118fd38a743e967c"]],
517
+ # ["[:PH6DR2, 'Pale Lime', '#B1F468', 'Remonblanc']", "18b07b3750e769ac646902d4ab9b8da4"]],
518
+ # ]
519
+ #
520
+ # ## Genuine tables
521
+ # salmon_list = authentication_pairs[0][0]
522
+ # khaki_list = authentication_pairs[1][0]
523
+ # pale_lime_list = authentication_pairs[2][0]
524
+ #
525
+ # ## Hashed Tables
526
+ # md5 = Digest::MD5.new
527
+ #
528
+ # salmon_new_hash = md5.update salmon_list
529
+ # khaki_new_hash = md5.update khaki_list
530
+ # pale_lime_new_hash = md5.update pale_list_list
531
+ #
532
+ # ## Comparative Hashes
533
+ # salmon_hash = authentication_pairs[0][1]
534
+ # khaki_hash = authentication_pairs[1][1]
535
+ # pale_lime_hash = authentication_pairs[2][1]
536
+ #
537
+ # if salmon_new_hash == salmon_hash
538
+ # puts "This is a valid Salmon datapoint."
539
+ # else
540
+ # puts "This is a invalid Salmon datapoint."
541
+ # end
542
+ #
543
+ # if khaki_new_hash == khaki_hash
544
+ # puts "This is a valid Khaki datapoint."
545
+ # else
546
+ # puts "This is a invalid Khaki datapoint."
547
+ # end
548
+ #
549
+ # if pale_lime_new_hash == pale_lime_hash
550
+ # puts "This is a valid Pale Lime datapoint."
551
+ # else
552
+ # puts "This is a invalid Pale Lime datapoint."
553
+ # end
554
+ # end
555
+
556
+ def self.atomspace
557
+ system("metta-py data/atomspace/colors.metta")
558
+ end
559
+
560
+ def self.gabble_colors
561
+ require "gabbler"
562
+
563
+ gabbler = Gabbler.new
564
+ color_set = File.read("data/colors/suggestions/suggest_colors.txt")
565
+ color_set_size = File.readlines("data/colors/suggestions/suggest_colors.txt").size.to_i
566
+
567
+ gabbler.learn(color_set) # Make Gabbler learn about Color Set
568
+
569
+ #color_set_size.times do
570
+ puts gabbler.sentence
571
+ #end
572
+
573
+ #gabbler.unlearn!
574
+
575
+ #gabbler.learn(story.reverse) # Teach Gabbler about semloH kcolrehS.
576
+
577
+ #puts gabbler.sentence
578
+ end
579
+
580
+ ###############################################################################################
581
+ # Chat With Color Scientist #
582
+ ###############################################################################################
583
+ # Using AIML to chat with the color scientist by making color requests in natural language, #
584
+ # by having them translate documents in the invented language. #
585
+ ###############################################################################################
586
+ def self.chat_color_science
587
+ require "programr"
588
+ end
589
+ end
590
+ end
@@ -0,0 +1,4 @@
1
+ module HeritageNoMetairo
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: HeritageNoMetairo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - LWFlouisa
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2025-08-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: naive_bayes
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.0.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.0.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: decisiontree
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.5.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.5.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: programr
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.0.2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.0.2
55
+ description: This incorporates the use of Metta language rather than Gabbler in order
56
+ to more properly represent learned data.
57
+ email:
58
+ - lwflouisa@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - README.md
64
+ - Rakefile
65
+ - lib/HeritageNoMetairo.rb
66
+ - lib/HeritageNoMetairo/version.rb
67
+ - sig/HeritageNoMetairo.rbs
68
+ homepage: https://bequestdecendresstudios.github.io/BequestDeCendresWiki/
69
+ licenses: []
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: 3.0.0
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubygems_version: 3.3.5
87
+ signing_key:
88
+ specification_version: 4
89
+ summary: Takes color identification, standard names, hex codes, and invented language
90
+ names, and takes them further.
91
+ test_files: []