Example #1
0
 def incCount(self,word):
         # Add code to clean the word
         word = clean(word)
         # Do not add the empty string to the dictionary
         if word == "":
                 return
         # Add code here to update the dictionary
         #self.wordCounts[word] = 1
         if word in self.wordCounts:
                 self.wordCounts[word] = 1 + self.wordCounts.get(word,0)
         else:
                 self.wordCounts[word] = 1
         return
    def incCount(self, word):
        # Add code to clean the word
        word = clean(word)
        # Do not add the empty string to the dictionary
        if word == "":
            return
        #elif statement to check if the word is part of the stop word list
        elif word in self.stopWordList:
            return

        # Add code here to update the dictionary
        elif word in self.wordCounts:
            self.wordCounts[word] += 1
        else:
            self.wordCounts[word] = 1