This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#The output is as follows: | |
# word followed by "total: " with the total amount next to it | |
# 2:1 The sentence that the word appears in and the number of times it appears. | |
# 2:1 means that the word appears in the second sentence one time. | |
class Concordance | |
shash = Array.new | |
total_hash = Hash.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@myArray = [1,3,5,[7,9,11],12,[15,16,[17,18,19],[20,21,22],[23,24],[25,26]]] | |
@outArray = Array.new | |
def flatten(inArray) | |
inArray.each do |a| | |
if a.is_a?(Array) | |
flatten(a) | |
else | |
@outArray.push(a) | |
end |
NewerOlder