ColorPHMetric 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: 6301fb3bab1f1b7cff9c6543083ba9cf02626eac3cbecd16cd4111461de46cb8
4
+ data.tar.gz: 1cabf03cbfddd3469fdfcd4cb92ffddb2627ef2ca134643716fb8b2150afb0e5
5
+ SHA512:
6
+ metadata.gz: 3420c9a9183c4b55bda39ddbb48456244287b1aba3ec6727d5ef41d98fc59194c7cb7513b77a38a89c0cc7a016cdd354b3ffeeacf10123ef5800f9df7ad4f3a6
7
+ data.tar.gz: fd3284b2872f05771f6688899ead43dcde714ea7e4a79bbe9b673ac6bc74767d9f029f19ed4e518821cb82c707c1a4aeb954283cdf5aaa07288612a2b162e76b
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2025-08-11
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at TODO: Write your email address. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/ColorPHMetric/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "ColorPHMetric"
7
+ spec.version = ColorPHMetric::VERSION
8
+ spec.authors = ["LWFlouisa"]
9
+ spec.email = ["lwflouisa@gmail.com"]
10
+
11
+ spec.summary = "This is for evaluating colors based on their identifiers."
12
+ spec.description = "Completely redoes the color science algorithm in order to remove data deserialization."
13
+ spec.homepage = "https://lwflouisa.itch.io/"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 3.2.5"
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(__dir__) do
20
+ `git ls-files -z`.split("\x0").reject do |f|
21
+ (File.expand_path(f) == __FILE__) ||
22
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
23
+ end
24
+ end
25
+
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ # Uncomment to register a new dependency of your gem
31
+ spec.add_dependency 'SelfModifiedDecisionTree', '~> 0.1.0'
32
+ spec.add_dependency 'gabbler', '~> 0.1.0'
33
+
34
+ # For more information and examples about making a new gem, check out our
35
+ # guide at: https://bundler.io/guides/creating_gem.html
36
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 TODO: Write your name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # ColorPHMetric
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/ColorPHMetric`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ ## Installation
8
+
9
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_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
+ $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
14
+
15
+ If bundler is not being used to manage dependencies, install the gem by executing:
16
+
17
+ $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Development
24
+
25
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
26
+
27
+ 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).
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ColorPHMetric. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/ColorPHMetric/blob/master/CODE_OF_CONDUCT.md).
32
+
33
+ ## License
34
+
35
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
36
+
37
+ ## Code of Conduct
38
+
39
+ Everyone interacting in the ColorPHMetric project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/ColorPHMetric/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/test_*.rb"]
10
+ end
11
+
12
+ require "rubocop/rake_task"
13
+
14
+ RuboCop::RakeTask.new
15
+
16
+ task default: %i[test rubocop]
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ColorPHMetric
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,400 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "ColorPHMetric/version"
4
+
5
+ module ColorPHMetric
6
+ class Error < StandardError; end
7
+
8
+ class MicroModel
9
+ ##############################################################################################################
10
+ # Language Model #
11
+ ##############################################################################################################
12
+ def self.word_classes
13
+ a = "Le"
14
+ b = "La"
15
+ c = "Les"
16
+
17
+ word_classes = [
18
+ [[a, a], [a, b], [a, c]],
19
+ [[b, a], [b, b], [b, c]],
20
+ [[c, a], [c, b], [c, c]],
21
+ ]
22
+
23
+ row_options = [0, 1, 2]
24
+ col_options = [0, 1, 2]
25
+ arr_options = [0, 1]
26
+
27
+ cur_row = row_options.sample
28
+ cur_col = col_options.sample
29
+ cur_arr = arr_options.sample
30
+
31
+ @current_wordclass = word_classes[cur_row][cur_col][cur_arr]
32
+ end
33
+
34
+ def self.nouns
35
+ a = "chat"
36
+ b = "chien"
37
+ c = "souris"
38
+ d = "oiseau"
39
+
40
+ nouns = [
41
+ [[a, a], [a, b], [a, c], [a, d]],
42
+ [[b, a], [b, b], [b, c], [b, d]],
43
+ [[c, a], [c, b], [c, c], [c, d]],
44
+ [[d, a], [d, b], [d, c], [d, d]],
45
+ ]
46
+
47
+ row_options = [0, 1, 2, 3]
48
+ col_options = [0, 1, 2, 3]
49
+ arr_options = [0, 1]
50
+
51
+ cur_row = row_options.sample
52
+ cur_col = col_options.sample
53
+ cur_arr = arr_options.sample
54
+
55
+ @current_nouns = nouns[cur_row][cur_col][cur_arr]
56
+ end
57
+
58
+ ## This variations uses the French color system with some Japanese colors.
59
+ def self.adjectives
60
+ a = "rouge cerise"
61
+ b = "orange sombres"
62
+ c = "oranges droles"
63
+ d = "dore"
64
+ e = "citron sombres"
65
+ f = "turquoise sombres"
66
+ g = "bleu de francais"
67
+ h = "murasaki no kutsu"
68
+
69
+ adjectives = [
70
+ [[a, a], [a, b], [a, c], [a, d], [a, e], [a, f], [a, g], [a, h]],
71
+ [[b, a], [b, b], [b, c], [b, d], [b, e], [b, f], [b, g], [b, h]],
72
+ [[c, a], [c, b], [c, c], [c, d], [c, e], [c, f], [c, g], [c, h]],
73
+ [[d, a], [d, b], [d, c], [d, d], [d, e], [d, f], [d, g], [d, h]],
74
+ [[e, a], [e, b], [e, c], [e, d], [e, e], [e, f], [e, g], [e, h]],
75
+ [[f, a], [f, b], [f, c], [f, d], [f, e], [f, f], [f, g], [f, h]],
76
+ [[g, a], [g, b], [g, c], [g, d], [g, e], [g, f], [g, g], [g, h]],
77
+ [[h, a], [h, b], [h, c], [h, d], [h, e], [h, f], [h, g], [h, h]],
78
+ ]
79
+
80
+ row_options = [0, 1, 2, 3, 4, 5, 6, 7]
81
+ col_options = [0, 1, 2, 3, 4, 5, 6, 7]
82
+ arr_options = [0, 1]
83
+
84
+ cur_row = row_options.sample
85
+ cur_col = col_options.sample
86
+ cur_arr = arr_options.sample
87
+
88
+ @current_adjectives = adjectives[cur_row][cur_col][cur_arr]
89
+ end
90
+
91
+ def self.subjects
92
+ a = "Je"
93
+ b = "Je Ne"
94
+ c = "Vous"
95
+ d = "Vous ne"
96
+ e = "Toi"
97
+ f = "Toi ne"
98
+
99
+ subjects = [
100
+ [[a, a], [a, b], [a, c], [a, d], [a, e], [a, f]],
101
+ [[b, a], [b, b], [b, c], [b, d], [b, e], [b, f]],
102
+ [[c, a], [c, b], [c, c], [c, d], [c, e], [c, f]],
103
+ [[d, a], [d, b], [d, c], [d, d], [d, e], [d, f]],
104
+ [[e, a], [e, b], [e, c], [e, d], [e, e], [e, f]],
105
+ [[f, a], [f, b], [f, c], [f, d], [f, e], [f, f]],
106
+ ]
107
+
108
+ row_options = [0, 1, 2, 3, 4, 5]
109
+ col_options = [0, 1, 2, 3, 4, 5]
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
+ @current_subjects = subjects[cur_row][cur_col][cur_arr]
117
+ end
118
+
119
+ def self.verbs
120
+ a = "pet"
121
+ b = "me brosse"
122
+ c = "entretiens"
123
+
124
+ verbs = [
125
+ [[a, a], [a, b], [a, c]],
126
+ [[b, a], [b, b], [b, c]],
127
+ [[c, a], [c, b], [c, c]],
128
+ ]
129
+
130
+ row_options = [0, 1, 2]
131
+ col_options = [0, 1, 2]
132
+ arr_options = [0, 1]
133
+
134
+ cur_row = row_options.sample
135
+ cur_col = col_options.sample
136
+ cur_arr = arr_options.sample
137
+
138
+ @current_verbs = verbs[cur_row][cur_col][cur_arr]
139
+ end
140
+
141
+ def self.adverbs
142
+ a = "quicely"
143
+ b = "lentiment"
144
+ c = "brusquement"
145
+
146
+ adverbs = [
147
+ [[a, a], [a, b], [a, c]],
148
+ [[b, a], [b, b], [b, c]],
149
+ [[c, a], [c, b], [c, c]],
150
+ ]
151
+
152
+ row_options = [0, 1, 2]
153
+ col_options = [0, 1, 2]
154
+ arr_options = [0, 1]
155
+
156
+ cur_row = row_options.sample
157
+ cur_col = col_options.sample
158
+ cur_arr = arr_options.sample
159
+
160
+ @current_adverbs = adverbs[cur_row][cur_col][cur_arr]
161
+
162
+ @current_phrase = "#{@current_wordclass} #{@current_nouns} #{@current_adjectives} #{@current_subjects} #{@current_verbs} #{@current_adverbs}."
163
+
164
+ File.open("data/language/ahuzacos/phrases.txt", "a") { |f|
165
+ f.puts @current_phrase
166
+ }
167
+ end
168
+ end
169
+
170
+ class BaysianForest
171
+ def self.evaluate_text
172
+ require "SelfModifiedDecisionTree"
173
+
174
+ ##############################################################################################################
175
+ # Color Science Architecture #
176
+ ##############################################################################################################
177
+ colorscience = RevisedBayes.new(:PH3DR1, :PH3DR2, :PH3DR3, :PH4DR1, :PH4DR2,
178
+ :PH4DR3, :PH5DR1, :PH5DR2, :PH5DR3, :PH6DR1,
179
+ :PH6DR2, :PH6DR3, :PH7DR1, :PH7DR2, :PH7DR3,
180
+ :PH8DR1, :PH8DR2, :PH8DR3, :PH9DR1, :PH9DR2,
181
+ :PH9DR3, :PHADR1, :PHADR2, :PHADR3
182
+ ),
183
+
184
+ RevisedBayes.new(:salmon_pink, :pinkish_tan, :raspberry, :peachy_pink,
185
+ :leather, :dusty_lavender, :light_orange, :sandy,
186
+ :peach, :apricot, :pastel_yellow, :Pale_teal,
187
+ :very_light_brown, :spring_green, :cool_grey, :pinkish_grey,
188
+ :algae, :dirty_blue, :pinkish_grey, :ocean_green,
189
+ :light_eggplant, :gunmetal, :perrywinkle,
190
+ ),
191
+
192
+ RevisedBayes.new(:rouge_cerise, :orange_sombres, :oranges_droles, :dore,
193
+ :citron_sombres, :turquoise_sombres, :bleu_de_francais, :murasaki_no_kutsu
194
+ )
195
+
196
+ identifiers = colorscience[0]
197
+ standard_color_names = colorscience[1]
198
+ ahuzacos_color_names = colorscience[2]
199
+ ##############################################################################################################
200
+ # Identifiers #
201
+ ##############################################################################################################
202
+ # These are color identification codes for determining PH Value and Dryness. #
203
+ ##############################################################################################################
204
+ # PH3
205
+ identifiers.train(:PH3DR1, "The identifier is PH3DR1.", "PH3DR1")
206
+ identifiers.train(:PH3DR2, "The identifier is PH3DR2.", "PH3DR1")
207
+ identifiers.train(:PH3DR3, "The identifier is PH3DR3.", "PH3DR3")
208
+
209
+ # PH4
210
+ identifiers.train(:PH4DR1, "The identifier is PH4DR1.", "PH4DR1")
211
+ identifiers.train(:PH4DR2, "The identifier is PH4DR2.", "PH4DR2")
212
+ identifiers.train(:PH4DR3, "The identifier is PH4DR3.", "PH4DR3")
213
+
214
+ # PH5
215
+ identifiers.train(:PH5DR1, "The identifier is PH5DR1.", "PH5DR1")
216
+ identifiers.train(:PH5DR2, "The identifier is PH5DR2.", "PH5DR2")
217
+ identifiers.train(:PH5DR3, "The identifier is PH5DR3.", "PH5DR3")
218
+
219
+ # PH6
220
+ identifiers.train(:PH6DR1, "The identifier is PH6DR1.", "PH6DR1")
221
+ identifiers.train(:PH6DR2, "The identifier is PH6DR2.", "PH6DR2")
222
+ identifiers.train(:PH6DR3, "The identifier is PH6DR3.", "PH6DR3")
223
+
224
+ # PH7
225
+ identifiers.train(:PH7DR1, "The identifier is PH7DR1.", "PH7DR1")
226
+ identifiers.train(:PH7DR2, "The identifier is PH7DR2.", "PH7DR2")
227
+ identifiers.train(:PH7DR3, "The identifier is PH7DR3.", "PH7DR3")
228
+
229
+ # PH8
230
+ identifiers.train(:PH8DR1, "The identifier is PH8DR1.", "PH8DR1")
231
+ identifiers.train(:PH8DR2, "The identifier is PH8DR2.", "PH8DR2")
232
+ identifiers.train(:PH8DR3, "The identifier is PH8DR3.", "PH8DR3")
233
+
234
+ # PH9
235
+ identifiers.train(:PH9DR1, "The identifier is PH9DR1.", "PH9DR1")
236
+ identifiers.train(:PH9DR2, "The identifier is PH9DR2.", "PH9DR2")
237
+ identifiers.train(:PH9DR3, "The identifier is PH9DR3.", "PH9DR3")
238
+
239
+ # PHA
240
+ identifiers.train(:PHADR1, "The identifier is PH5DR1.", "PHADR1")
241
+ identifiers.train(:PHADR2, "The identifier is PH5DR2.", "PHADR2")
242
+ identifiers.train(:PHADR3, "The identifier is PH5DR3.", "PHADR3")
243
+ ##############################################################################################################
244
+ # Standard Color Names #
245
+ ##############################################################################################################
246
+ standard_color_names.train(:salmon_pink, "This is Salmon Pink.", "salmon pink")
247
+ standard_color_names.train(:pinkish_tan, "This is Pinkish Tan.", "pinkish tan")
248
+ standard_color_names.train(:raspberry, "This is Raspberry.", "raspberry")
249
+ standard_color_names.train(:peachy_pink, "This is Peachy Pink.", "peachy pink")
250
+ standard_color_names.train(:leather, "This is Leather.", "leather")
251
+ standard_color_names.train(:dusty_lavender, "This is Dusty Lavender.", "dusty lavender")
252
+ standard_color_names.train(:light_orange, "This is Light Orange.", "light orange")
253
+ standard_color_names.train(:sandy, "This is Sandy.", "sandy")
254
+ standard_color_names.train(:peach, "This is Peach.", "peach")
255
+ standard_color_names.train(:apricot, "This is Apricot.", "apricot")
256
+ standard_color_names.train(:pastel_yellow, "This is Pastel yellow.", "pastel yellow")
257
+ standard_color_names.train(:Pale_teal, "This is Pale Teal.", "pale teal")
258
+ standard_color_names.train(:very_light_brown, "This is very light brown.", "light brown")
259
+ standard_color_names.train(:spring_green, "This is very spring green.", "sprint green")
260
+ standard_color_names.train(:cool_grey, "This is very cool grey.", "cool grey")
261
+ standard_color_names.train(:pinkish_grey, "This is pinkish grey.", "pinkish grey")
262
+ standard_color_names.train(:algae, "This ia algae.", "algae")
263
+ standard_color_names.train(:dirty_blue, "This is dirty blue.", "dirty blue")
264
+ standard_color_names.train(:pinkish_grey, "This is pinkish grey.", "pinkish grey")
265
+ standard_color_names.train(:ocean_green, "This is ocean green.", "ocean green")
266
+ standard_color_names.train(:light_eggplant, "This is light eggplant.", "light eggplant")
267
+ standard_color_names.train(:gunmetal, "This is gunmetal grey.", "gunmetal")
268
+ standard_color_names.train(:perrywinkle, "This is periwinkle.", "periwinkle")
269
+ ##############################################################################################################
270
+ # Ahuzacos Color Names #
271
+ ##############################################################################################################
272
+ ahuzacos_color_names.train(:rouge_cerise, "Le pouvre rouge cerise je manger.", "rouge cerise")
273
+ ahuzacos_color_names.train(:orange_sombres, "Le orange sombres je manger.", "oranges sombre")
274
+ ahuzacos_color_names.train(:oranges_droles, "Le orange drole je peinture.", "oranges droles")
275
+ ahuzacos_color_names.train(:dore, "Le pouvre dore je manger.", "dore")
276
+ ahuzacos_color_names.train(:citron_sombres, "Le maison citron sombres je suis en repos.", "citron sombres")
277
+ ahuzacos_color_names.train(:turquoise_sombres, "Le turquoise sombres es anu oshoko.", "turquoise sombres")
278
+ ahuzacos_color_names.train(:bleu_de_francais, "Le maison blue de france es je manger.", "blue de france")
279
+ ahuzacos_color_names.train(:murasaki_no_kutsu, "Anos auberginos murasakos no kutsos je manger.", "murasaki no kutsu")
280
+
281
+ ##############################################################################################################
282
+ # Classifying Input Into Subsets #
283
+ ##############################################################################################################
284
+ current_phrases = File.readlines("data/language/ahuzacos/phrases.txt")
285
+ size_limit = current_phrases.size.to_i
286
+ index = 0
287
+
288
+ size_limit.times do
289
+ classification1 = identifiers.classify(current_phrases[index])
290
+ classification2 = standard_color_names.classify(current_phrases[index])
291
+ classification3 = ahuzacos_color_names.classify(current_phrases[index])
292
+
293
+ print classification1
294
+ print classification2
295
+ print classification3
296
+ puts " "
297
+
298
+ ## First Probability Set
299
+ f1_probability_label = classification1[0]
300
+ f1_probability_no = classification1[1]
301
+ f1_probability_yes = 1 - f1_probability_no
302
+
303
+ ## Second Probability Set
304
+ s_probability_label = classification2[0]
305
+ s_probability_no = classification2[1]
306
+ s_probability_yes = 1 - s_probability_no
307
+
308
+ ## Fourth Probability Set
309
+ f2_probability_label = classification3[0]
310
+ f2_probability_no = classification3[1]
311
+ f2_probability_yes = 1 - f2_probability_no
312
+
313
+ overall_no = f1_probability_no * s_probability_no * f2_probability_no
314
+ overall_yes = f1_probability_yes * s_probability_yes * f2_probability_yes
315
+
316
+ overall_label = "[ #{f1_probability_no} #{s_probability_no} #{f2_probability_no} ] [ #{overall_yes} / #{overall_no} ]"
317
+
318
+ attributes = ["Identifier"], ["Standard Name"], ["Hex Code"], ["Ahuzacos Name"]
319
+
320
+ training = [
321
+ [0.12500, "PH7DR2"],
322
+ [0.56245, "PH5DR2"],
323
+ [0.99990, "PH3DR3"],
324
+ ], [
325
+ [0.12500, "Spring Green"],
326
+ [0.56245, "Peach"],
327
+ [0.99990, "Raspberry"],
328
+ ], [
329
+ [0.12500, "#9AE358"],
330
+ [0.56245, "#E59F66"],
331
+ [0.99990, "#D54661"],
332
+ ], [
333
+ [0.12500, "Vert De Ressort"],
334
+ [0.56245, "Peche"],
335
+ [0.99990, "Framboise"],
336
+ ]
337
+
338
+ dec_tree_configurations = DecisionTree::ID3Tree.new(attributes[0], training[0], 1, :continuous),
339
+ DecisionTree::ID3Tree.new(attributes[1], training[1], 1, :continuous),
340
+ DecisionTree::ID3Tree.new(attributes[2], training[2], 1, :continuous),
341
+ DecisionTree::ID3Tree.new(attributes[2], training[3], 1, :continuous)
342
+
343
+ current_dectree1 = dec_tree_configurations[0]
344
+ current_dectree1.train
345
+
346
+ current_dectree2 = dec_tree_configurations[1]
347
+ current_dectree2.train
348
+
349
+ current_dectree3 = dec_tree_configurations[2]
350
+ current_dectree3.train
351
+
352
+ current_dectree4 = dec_tree_configurations[3]
353
+ current_dectree4.train
354
+
355
+ test1 = [overall_no, "PH5DR2"]
356
+ test2 = [overall_no, "Peach"]
357
+ test3 = [overall_no, "#E59F66"]
358
+ test4 = [overall_no, "Peche"]
359
+
360
+ ## Sesne I got rid of decision trees data marshalling, I have to reassign last tests.
361
+ last_first_decision = test1[1]
362
+ last_second_decision = test2[1]
363
+ last_third_decision = test3[1]
364
+ last_fourth_decision = test4[1]
365
+
366
+ @decision1 = current_dectree1.predict(test1)
367
+ @decision2 = current_dectree2.predict(test2)
368
+ @decision3 = current_dectree3.predict(test3)
369
+ @decision4 = current_dectree4.predict(test4)
370
+
371
+ puts "Identifier: #{@decision1} Decade: #{@decision2} Classification: #{@decision3}"
372
+ # puts "Expected Type: #{last_first_decision} Decade: #{last_second_decision} Classification: #{last_third_decision}"
373
+
374
+ @prolog_rule = "#{@decision4.downcase}(#{@decision1.downcase}, #{@decision2.downcase}, #{@decision3.downcase})."
375
+
376
+ File.open("data/language/prolog/phrases.pl", "a") { |f|
377
+ f.puts @prolog_rule
378
+ }
379
+
380
+ index = index + 1
381
+ end
382
+ end
383
+ end
384
+
385
+ class MarkovChain
386
+ def self.show_results
387
+ require "gabbler"
388
+
389
+ gabbler = Gabbler.new
390
+
391
+ plaintexts = File.read("data/language/ahuzacos/phrases.txt")
392
+
393
+ gabbler.learn(plaintexts)
394
+
395
+ 7.times do
396
+ puts gabbler.sentence
397
+ end
398
+ end
399
+ end
400
+ end
@@ -0,0 +1,4 @@
1
+ module ColorPHMetric
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ColorPHMetric
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-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: SelfModifiedDecisionTree
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: gabbler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.1.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.1.0
41
+ description: Completely redoes the color science algorithm in order to remove data
42
+ deserialization.
43
+ email:
44
+ - lwflouisa@gmail.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".rubocop.yml"
50
+ - CHANGELOG.md
51
+ - CODE_OF_CONDUCT.md
52
+ - ColorPHMetric.gemspec
53
+ - LICENSE.txt
54
+ - README.md
55
+ - Rakefile
56
+ - lib/ColorPHMetric.rb
57
+ - lib/ColorPHMetric/version.rb
58
+ - sig/ColorPHMetric.rbs
59
+ homepage: https://lwflouisa.itch.io/
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: 3.2.5
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubygems_version: 3.4.20
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: This is for evaluating colors based on their identifiers.
82
+ test_files: []