aibrain 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cf1263fba95f2126908f8f29f1026e15eff7a0010c7eb5106805c4a5a31c29e0
4
+ data.tar.gz: ca752c256229c1e9d9b63cf38d046d6821fd4a0f64a280255fe0c286cc03f833
5
+ SHA512:
6
+ metadata.gz: fb10451af1f2bfffacd1ad347403b17fd9cff51adf39d0f4931dfda08b6e1799ba710a6e97c7c7a60705f7778ef2db3d36d99d3c81fe8013948ec7b1ed4ec695
7
+ data.tar.gz: 2f79ce896b439bf78b783771b4ade7c5954328a44acaa7377bf4fc7c3384d79a58b86fa90593fc818741b603b75dd90df0a5558a9f57857af6cb54fe3821c21a
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.5.1
6
+ before_install: gem install bundler -v 2.1.4
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at gitea@fake.local. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in aibrain.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Gitea
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,44 @@
1
+ # Aibrain
2
+
3
+ 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/aibrain`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'aibrain'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install aibrain
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. Then, run `rake spec` to run the tests. 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 tags, 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]/aibrain. 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]/aibrain/blob/master/CODE_OF_CONDUCT.md).
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
41
+
42
+ ## Code of Conduct
43
+
44
+ Everyone interacting in the Aibrain project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/aibrain/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/aibrain.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ require_relative 'lib/aibrain/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "aibrain"
5
+ spec.version = Aibrain::VERSION
6
+ spec.authors = ["LWFlouisa"]
7
+ spec.email = ["lwflouisa@riseup.net"]
8
+
9
+ spec.summary = %q{Process for generalizing across multiple printed DDG files.}
10
+ spec.description = %q{Generates DDG sets useable across methods, to find a larger solution.}
11
+ spec.homepage = ""
12
+ spec.license = "MIT"
13
+
14
+ # Specify which files should be added to the gem when it is released.
15
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
16
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
17
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_runtime_dependency 'naive_bayes', '~> 0.0.3'
24
+ spec.add_runtime_dependency 'duck-duck-go', '~> 1.1', '>= 1.1.3'
25
+ spec.add_runtime_dependency 'tts', '~> 0.7.1'
26
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "aibrain"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/lib/aibrain.rb ADDED
@@ -0,0 +1,244 @@
1
+ require "aibrain/version"
2
+
3
+ module Aibrain
4
+ class Error < StandardError; end
5
+
6
+ class Knowledge_Areas
7
+ def self.generate_knowledge_set
8
+
9
+ # Generate symbolic relationship from first dataset.
10
+ def self.first_set
11
+ require "duck_duck_go"
12
+ require "tts"
13
+
14
+ noun = File.readlines("data/input/first_set/nouns.txt")
15
+ verb = File.readlines("data/input/first_set/verbs.txt")
16
+ action = File.readlines("data/input/first_set/actions.txt")
17
+
18
+ chosen_noun = noun.sample
19
+ chosen_verb = verb.sample
20
+ chosen_action = action.sample
21
+
22
+ ddg = DuckDuckGo.new
23
+ zci = ddg.zeroclickinfo("#{verb}") # ZeroClickInfo object
24
+
25
+ heading = zci.heading
26
+ abstract_text = zci.abstract_text
27
+ related_topics = zci.related_topics["_"][0].text
28
+
29
+ "#{heading}#{abstract_text}#{related_topics}".play "en"
30
+
31
+ open("data/output/first_set/problem_defintion.txt", "w") { |f|
32
+ f.puts "#{abstract_text}"
33
+ }
34
+ end
35
+
36
+ # Generate symbolic relationship from second dataset.
37
+ def self.second_set
38
+ require "duck_duck_go"
39
+ require "tts"
40
+
41
+ noun = File.readlines("data/input/second_set/nouns.txt")
42
+ verb = File.readlines("data/input/second_set/verbs.txt")
43
+ action = File.readlines("data/input/second_set/actions.txt")
44
+
45
+ chosen_noun = noun.sample
46
+ chosen_verb = verb.sample
47
+ chosen_action = action.sample
48
+
49
+ ddg = DuckDuckGo.new
50
+ zci = ddg.zeroclickinfo("#{verb}") # ZeroClickInfo object
51
+
52
+ heading = zci.heading
53
+ abstract_text = zci.abstract_text
54
+ related_topics = zci.related_topics["_"][0].text
55
+
56
+ "#{heading}#{abstract_text}#{related_topics}".play "en"
57
+
58
+ open("data/output/second_set/problem_defintion.txt", "w") { |f|
59
+ f.puts "#{abstract_text}"
60
+ }
61
+ end
62
+
63
+ # Generate solutin based on both data sets.
64
+ def self.solution_brainstorm
65
+ require "duck_duck_go"
66
+ require "naive_bayes"
67
+ require "tts"
68
+
69
+ # Chosen nouns from first and second dataset.
70
+ first_noun = File.read("data/output/first_set/chosen_noun.txt")
71
+ second_noun = File.read("data/output/second_set/chosen_noun.txt")
72
+
73
+ # Chosen verbs from first and second dataset.
74
+ first_verb = File.read("data/output/first_set/chosen_verb.txt")
75
+ second_verb = File.read("data/output/second_set/chosen_verb.txt")
76
+
77
+ # Chosen actions from first and second dataset.
78
+ first_action = File.read("data/output/first_set/chosen_action.txt")
79
+ second_action = File.read("data/output/second_set/chosen_action.txt")
80
+
81
+ ddg = DuckDuckGo.new
82
+ zci = ddg.zeroclickinfo("#{first_verb}#{second_verb}") # ZeroClickInfo object
83
+
84
+ heading = zci.heading
85
+ abstract_text = zci.abstract_text
86
+ related_topics = zci.related_topics["_"][0].text
87
+
88
+ "#{heading}#{abstract_text}#{related_topics}".play "en"
89
+
90
+ open("data/output/third_set/problem_defintion.txt", "w") { |f|
91
+ f.puts "#{abstract_text}"
92
+ }
93
+ end
94
+ end
95
+
96
+ def self.sum_of_knowledge
97
+ first_definition_text = File.read("data/output/first_set/problem_defintion.txt")
98
+ second_definition_text = File.read("data/output/second_set/problem_defintion.txt")
99
+ overall_problem = File.read("data/output/third_set/problem_definition.txt")
100
+
101
+ puts "Your first problem had been: #{first_definition_text}"
102
+ puts "Your second problem had been: #{second_definition_text}"
103
+
104
+ puts "Therefore, one possible solution is: #{overall_problem}"
105
+
106
+ puts "Lets see if I have a solution..."; sleep(3)
107
+
108
+ ddg = DuckDuckGo.new
109
+ zci = ddg.zeroclickinfo("#{verb}") # ZeroClickInfo object
110
+
111
+ heading = zci.heading
112
+ abstract_text = zci.abstract_text
113
+ related_topics = zci.related_topics["_"][0].text
114
+
115
+ "#{heading}#{abstract_text}#{related_topics}".play "en"
116
+ end
117
+
118
+ def self.create_solution
119
+ require "naive_bayes"
120
+ require "tts"
121
+
122
+ a = NaiveBayes.new(:solution, :notsolution)
123
+
124
+ # Solution non lethal
125
+ a.train(:solution, "check", "word"); a.train(:solution, "cash", "word")
126
+ a.train(:solution, "fix", "word"); a.train(:solution, "solve", "word")
127
+ a.train(:solution, "program", "word"); a.train(:solution, "code", "word")
128
+ a.train(:solution, "check.", "word"); a.train(:solution, "cash.", "word")
129
+ a.train(:solution, "fix.", "word"); a.train(:solution, "solve.", "word")
130
+ a.train(:solution, "program.", "word"); a.train(:solution, "code.", "word")
131
+ a.train(:solution, "check;", "word"); a.train(:solution, "cash;", "word")
132
+ a.train(:solution, "fix;", "word"); a.train(:solution, "solve;", "word")
133
+ a.train(:solution, "program;", "word"); a.train(:solution, "code;", "word")
134
+ a.train(:solution, "check:", "word"); a.train(:solution, "cash:", "word")
135
+ a.train(:solution, "fix:", "word"); a.train(:solution, "solve:", "word")
136
+ a.train(:solution, "program:", "word"); a.train(:solution, "code:", "word")
137
+ a.train(:solution, "check?", "word"); a.train(:solution, "cash?", "word")
138
+ a.train(:solution, "fix?", "word"); a.train(:solution, "solve?", "word")
139
+ a.train(:solution, "program?", "word"); a.train(:solution, "code?", "word")
140
+
141
+ # Solution lethal
142
+ a.train(:notsolution, "guillotine", "word"); a.train(:notsolution, "gallows", "word")
143
+ a.train(:notsolution, "choke", "word"); a.train(:notsolution, "asfyxiate", "word")
144
+ a.train(:notsolution, "strangle", "word"); a.train(:notsolution, "neck", "word")
145
+ a.train(:notsolution, "beheading", "word"); a.train(:notsolution, "headsman", "word")
146
+ a.train(:notsolution, "sword", "word"); a.train(:notsolution, "axe", "word")
147
+ a.train(:notsolution, "cleaver", "word"); a.train(:notsolution, "chop", "word")
148
+ a.train(:notsolution, "hack", "word"); a.train(:notsolution, "chop", "word")
149
+ a.train(:notsolution, "slash", "word"); a.train(:notsolution, "chop", "word")
150
+ a.train(:notsolution, "cut", "word"); a.train(:notsolution, "suicide", "word")
151
+ a.train(:notsolution, "slit", "word"); a.train(:notsolution, "noose", "word")
152
+ a.train(:notsolution, "car", "word"); a.train(:notsolution, "drown", "word")
153
+ a.train(:notsolution, "murder", "word"); a.train(:notsolution, "disappear", "word")
154
+ a.train(:notsolution, "vanish", "word"); a.train(:notsolution, "death", "word")
155
+ a.train(:notsolution, "die", "word"); a.train(:notsolution, "firearm", "word")
156
+ a.train(:notsolution, "heart", "word"); a.train(:notsolution, "head", "word")
157
+ a.train(:notsolution, "guillotine.", "word"); a.train(:notsolution, "gallows.", "word")
158
+ a.train(:notsolution, "choke.", "word"); a.train(:notsolution, "asfyxiate.", "word")
159
+ a.train(:notsolution, "strangle.", "word"); a.train(:notsolution, "neck.", "word")
160
+ a.train(:notsolution, "beheading.", "word"); a.train(:notsolution, "headsman.", "word")
161
+ a.train(:notsolution, "sword.", "word"); a.train(:notsolution, "axe.", "word")
162
+ a.train(:notsolution, "cleaver.", "word"); a.train(:notsolution, "chop.", "word")
163
+ a.train(:notsolution, "hack.", "word"); a.train(:notsolution, "chop.", "word")
164
+ a.train(:notsolution, "slash.", "word"); a.train(:notsolution, "chop.", "word")
165
+ a.train(:notsolution, "cut.", "word"); a.train(:notsolution, "suicide.", "word")
166
+ a.train(:notsolution, "slit.", "word"); a.train(:notsolution, "noose.", "word")
167
+ a.train(:notsolution, "car.", "word"); a.train(:notsolution, "drown.", "word")
168
+ a.train(:notsolution, "murder.", "word"); a.train(:notsolution, "disappear.", "word")
169
+ a.train(:notsolution, "vanish.", "word"); a.train(:notsolution, "death.", "word")
170
+ a.train(:notsolution, "die.", "word"); a.train(:notsolution, "firearm.", "word")
171
+ a.train(:notsolution, "heart.", "word"); a.train(:notsolution, "head.", "word")
172
+ a.train(:notsolution, "guillotine;", "word"); a.train(:notsolution, "gallows;", "word")
173
+ a.train(:notsolution, "choke;", "word"); a.train(:notsolution, "asfyxiate;", "word")
174
+ a.train(:notsolution, "strangle;", "word"); a.train(:notsolution, "neck;", "word")
175
+ a.train(:notsolution, "beheading;", "word"); a.train(:notsolution, "headsman;", "word")
176
+ a.train(:notsolution, "sword;", "word"); a.train(:notsolution, "axe;", "word")
177
+ a.train(:notsolution, "cleaver;", "word"); a.train(:notsolution, "chop;", "word")
178
+ a.train(:notsolution, "hack;", "word"); a.train(:notsolution, "chop;", "word")
179
+ a.train(:notsolution, "slash;", "word"); a.train(:notsolution, "chop;", "word")
180
+ a.train(:notsolution, "cut;", "word"); a.train(:notsolution, "suicide;", "word")
181
+ a.train(:notsolution, "slit;", "word"); a.train(:notsolution, "noose;", "word")
182
+ a.train(:notsolution, "car;", "word"); a.train(:notsolution, "drown;", "word")
183
+ a.train(:notsolution, "murder;", "word"); a.train(:notsolution, "disappear;", "word")
184
+ a.train(:notsolution, "vanish;", "word"); a.train(:notsolution, "death;", "word")
185
+ a.train(:notsolution, "die;", "word"); a.train(:notsolution, "firearm;", "word")
186
+ a.train(:notsolution, "heart;", "word"); a.train(:notsolution, "head;", "word")
187
+ a.train(:notsolution, "guillotine:", "word"); a.train(:notsolution, "gallows:", "word")
188
+ a.train(:notsolution, "choke:", "word"); a.train(:notsolution, "asfyxiate:", "word")
189
+ a.train(:notsolution, "strangle:", "word"); a.train(:notsolution, "neck:", "word")
190
+ a.train(:notsolution, "beheading:", "word"); a.train(:notsolution, "headsman:", "word")
191
+ a.train(:notsolution, "sword:", "word"); a.train(:notsolution, "axe:", "word")
192
+ a.train(:notsolution, "cleaver:", "word"); a.train(:notsolution, "chop:", "word")
193
+ a.train(:notsolution, "hack:", "word"); a.train(:notsolution, "chop:", "word")
194
+ a.train(:notsolution, "slash:", "word"); a.train(:notsolution, "chop:", "word")
195
+ a.train(:notsolution, "cut:", "word"); a.train(:notsolution, "suicide:", "word")
196
+ a.train(:notsolution, "slit:", "word"); a.train(:notsolution, "noose:", "word")
197
+ a.train(:notsolution, "car:", "word"); a.train(:notsolution, "drown:", "word")
198
+ a.train(:notsolution, "murder:", "word"); a.train(:notsolution, "disappear:", "word")
199
+ a.train(:notsolution, "vanish:", "word"); a.train(:notsolution, "death:", "word")
200
+ a.train(:notsolution, "die:", "word"); a.train(:notsolution, "firearm:", "word")
201
+ a.train(:notsolution, "heart:", "word"); a.train(:notsolution, "head:", "word")
202
+ a.train(:notsolution, "guillotine?", "word"); a.train(:notsolution, "gallows?", "word")
203
+ a.train(:notsolution, "choke?", "word"); a.train(:notsolution, "asfyxiate?", "word")
204
+ a.train(:notsolution, "strangle?", "word"); a.train(:notsolution, "neck?", "word")
205
+ a.train(:notsolution, "beheading?", "word"); a.train(:notsolution, "headsman?", "word")
206
+ a.train(:notsolution, "sword?", "word"); a.train(:notsolution, "axe?", "word")
207
+ a.train(:notsolution, "cleaver?", "word"); a.train(:notsolution, "chop?", "word")
208
+ a.train(:notsolution, "hack?", "word"); a.train(:notsolution, "chop?", "word")
209
+ a.train(:notsolution, "slash?", "word"); a.train(:notsolution, "chop?", "word")
210
+ a.train(:notsolution, "cut?", "word"); a.train(:notsolution, "suicide?", "word")
211
+ a.train(:notsolution, "slit?", "word"); a.train(:notsolution, "noose?", "word")
212
+ a.train(:notsolution, "car?", "word"); a.train(:notsolution, "drown?", "word")
213
+ a.train(:notsolution, "murder?", "word"); a.train(:notsolution, "disappear?", "word")
214
+ a.train(:notsolution, "vanish?", "word"); a.train(:notsolution, "death?", "word")
215
+ a.train(:notsolution, "die?", "word"); a.train(:notsolution, "firearm?", "word")
216
+ a.train(:notsolution, "heart?", "word"); a.train(:notsolution, "head?", "word")
217
+
218
+ b = File.read("data/output/third_set/problem_definition.txt").strip
219
+
220
+ a_class = a.classify(*b)
221
+ result = a_class[0]
222
+ decision = result.to_s
223
+
224
+ if decision == "notsolution"
225
+ "I can't think of anything, sorry.".play "en"
226
+ else
227
+ first_action = File.read("data/output/first_set/chosen_action.txt")
228
+ second_action = File.read("data/output/second_set/chosen_action.txt")
229
+
230
+ ddg = DuckDuckGo.new
231
+ zci = ddg.zeroclickinfo("#{first_action}#{second_action}") # ZeroClickInfo object
232
+
233
+ problem = zci.heading # Stephen Fry
234
+ defintion = zci.abstract_text # Stephen John Fry is an English actor, screenwriter, author, playwright, ...
235
+ possible_solutions = zci.related_topics["_"][0].text
236
+
237
+ puts "Your problem is #{problem}: #{definition}"
238
+
239
+ puts "Therefore: #{possible_solutions}"
240
+ end
241
+ end
242
+
243
+ end
244
+ end
@@ -0,0 +1,3 @@
1
+ module Aibrain
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aibrain
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: 2020-02-04 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: duck-duck-go
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 1.1.3
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '1.1'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 1.1.3
47
+ - !ruby/object:Gem::Dependency
48
+ name: tts
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: 0.7.1
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: 0.7.1
61
+ description: Generates DDG sets useable across methods, to find a larger solution.
62
+ email:
63
+ - lwflouisa@riseup.net
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files: []
67
+ files:
68
+ - ".gitignore"
69
+ - ".rspec"
70
+ - ".travis.yml"
71
+ - CODE_OF_CONDUCT.md
72
+ - Gemfile
73
+ - LICENSE.txt
74
+ - README.md
75
+ - Rakefile
76
+ - aibrain.gemspec
77
+ - bin/console
78
+ - bin/setup
79
+ - lib/aibrain.rb
80
+ - lib/aibrain/version.rb
81
+ homepage: ''
82
+ licenses:
83
+ - MIT
84
+ metadata: {}
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubygems_version: 3.0.6
101
+ signing_key:
102
+ specification_version: 4
103
+ summary: Process for generalizing across multiple printed DDG files.
104
+ test_files: []