Kaceka2016/dictionary.rb
2016-11-17 08:45:29 +01:00

15 lines
299 B
Ruby

txt = open("keywords.txt")
filenames = ["actions.txt", "directions.txt", "movement.txt"]
dictionary = {}
txt.each_line do |line|
filenames.each do |name|
if File.read(name).include?line
dictionary[name.chomp('.txt')] = line.chomp("\n")
end
end
end
puts dictionary