code: def count_n_grams_py_polarity(self, data_set_reader, n_grams, filters):
          
          self.data_set_reader = data_set_reader
          token_trie = TokenTrie(n_grams)
  
          counter = {}
  
          # Todo: parallelize
          for entry in data_set_reader.items():
              tweet = filters.apply(entry.get_tweet())
              tokens = token_trie.find_optimal_tokenization(RegexFilters.WHITESPACE.split(tweet))
  
              for n_gram in tokens:
                  n_gram_words = RegexFilters.WHITESPACE.split(n_gram)
                  if self.contains_illegal_word(n_gram_words):
                      continue
                  if not n_gram in counter:
                      counter[n_gram] = self.Counter()
  
                  if entry.get_classification().is_positive():
                      counter[n_gram].num_positive += 1
                  elif entry.get_classification().is_negative():
                      counter[n_gram].num_negative += 1
  
          return counter
docs: Returns a map of n-gram and the number of times it appeared in positive context and the number of times it
          appeared in negative context in dataset file.
  
          :param data_set_reader: Dataset containing tweets and their classification
          :param n_grams: n-grams to count occurrences for
          :param filters: filters to apply to tweets in dataset before searching for n-grams
          :return: Map of Counter instances for n-grams in nGrams Collection