Method: WordCloud#wordCount
- Defined in:
- lib/wordcloud.rb
#wordCount(word) ⇒ Object
Counts number of times a word shows up
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/wordcloud.rb', line 68 def wordCount(word) commonwords = ["the", "and", "of", "a", "to", "is", "in", "its", "The", "on", "as", "for", "has", "will", "As", "or", "have", "while", "While", "that", "out", "such", "also", "by", "said", "with", "than", "only", "into", "an", "one", "other", "but", "for", "from", "<br />", "I", "more", "about", "About", "again", "Again", "against", "all", "are", "at", "be", "being", "been", "can", "could", "did", "do", "don't", "down", "up", "each", "few", "get", "got", "great", "had", "have", "has", "he", "her", "she", "he", "it", "we", "they", "if", "thus", "it's", "hers", "his", "how", "why", "when", "where", "just", "like", "you", "me", "my", "most", "more", "no", "not", "yes", "off", "once", "only", "our", "out", "over", "under", "own", "then", "some", "these", "there", "then", "this", "those", "too", "through", "between", "until", "very", "who", "with", "wouldn't", "would", "was", "were", "itself", "himself", "herself", "which", "make", "during", "before", "after", "if", "any", "become", "around", "several", "them", "their", "however"] # Make capitalized array of common words commoncaps = Array.new commonwords.each do |c| commoncaps.push(c.capitalize) end if (@wordhash[word]) && (!commonwords.include? word) && (!commoncaps.include? word) @wordhash[word] += 1 else @wordhash[word] = 1 end end |