107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
# File 'lib/crowsad.rb', line 107
def self.teach_word
require "duck_duck_go"
old_third_object = File.read("dictionary/third_object.txt")
new_word = File.read("data/input/third_object.txt").strip
ddg = DuckDuckGo.new
zci = ddg.zeroclickinfo(new_word)
open("data/output/glossary/#{new_word}.txt", 'w') { |f|
f.puts zci.heading
f.puts zci.abstract_text
f.puts zci.related_topics['_'][0].text
}
open('dictionary/next_action.txt', 'w') { |f|
f.puts zci.heading
f.puts old_third_object
}
end
|