title: spacy.tokens.doc.Doc objects in a loop
body: <p>I have a book text to do NLP. I need to do it on chapter-level I have Splitted the chapters text and stored them in Dictionary.</p>
  <p>{'chapter 1' : 'long text///', 'chapter 2': 'long text of chap 2'}</p>
  <p>Now to do NER on chapter text I need to store each chapter text in spacy doc object. I need to do it within the loop as I am dealing with 56 chapters here.</p>
  <pre><code>chapner = []
  for key,value in bookdict.items():
      chapterwisedoc=nlp(str(value))
      find_entities(chapterwisedoc,chapner,&quot;PERSON&quot;)  #to find persons in doc obj &amp; store in list 
      chapterwisecountofperson_lst = countOccurrence(chapner) #to count occurences of each person
      chapterwisecountofperson_dict = dict(chapterwisecountofperson_lst) #to save the counts in dict
  </code></pre>
  <p>Currently this I am trying to do in Loop but the results are not desireable. Someone please help me in how to write loop in such a way that it takes value of dict in a spacy object and after ner moves to next dict value.</p>