title: Aggregation in function not working right
body: <p>Hello so I have a python function that's working but not in the way I expect and I'm not sure where my code is off.</p>
  <pre><code>def preprocess(text):
      case = truecase.get_true_case(text)
      doc = nlp(case)
      return doc
  
  def summarize_texts(texts):
      actions = {}
      entities = {}
      for item in texts:
          doc = preprocess(item)
          for token in doc:
              if token.pos_ == &quot;VERB&quot;:
                  actions[str.lower(token.text)] = actions.get(token.text, 0) +1
          for token in doc.ents:
              entities[token.label_] = [token.text]
              if token.text not in entities[token.label_]:
                  entities[token.label_].append(token.text)
      return {
          'actions': actions,
          'entities': entities
      }
  </code></pre>
  <p>when I call the function for a list of sentences, this is the output I get:</p>
  <pre><code>docs = [
      &quot;Play something by Billie Holiday, and play again&quot;,
      &quot;Set a timer for five minutes&quot;,
      &quot;Play it again, Sam&quot;
  ]
  
  summarize_texts(docs)
  
  output: {'actions': {'play': 1, 'set': 1},
   'entities': {'PERSON': ['Sam'], 'TIME': ['five minutes']}}
  </code></pre>
  <p>It it's working in that it's finding the action keys and entities keys but I am having two issues.</p>
  <ol>
  <li>it's not counting the actions right</li>
  <li>it's only storing the last value of each entity.</li>
  </ol>
  <p>output should be:</p>
  <pre><code>output: {'actions': {'play': 3, 'set': 1},
   'entities': {'PERSON': ['Billie','Sam'], 'TIME': ['five minutes']}}
  </code></pre>
  <p>Any help would be AMAZING! I have a feeling its something easy but just too brain fried to see it.</p>