title: Remove Named Entities from the spacy object
body: <p>I am trying to remove Named Entities from the document using Spacy. I didn't find any troubles to recognize the named entities. used this code:</p>
  
  <pre><code>ne = [(ent.text, ent.label_) for ent in doc.ents]
  print(ne)
  persons = [ent.text for ent in doc.ents if ent.label_ == 'PERSON']
  print(persons)
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>'Timothy D. Cook',
   'Peter',
   'Peter',
   'Benjamin A. Reitzes',
   'Timothy D. Cook',
   'Steve Milunovich',
   'Steven Mark Milunovich',
   'Peter',
   'Luca Maestri'
  </code></pre>
  
  <p>But then I am trying to use this chunk to actually remove them from the document:</p>
  
  <pre><code>text_no_namedentities = []
  
  ents = [e.text for e in doc.ents]
  for item in doc:
      if item.text in ents:
          pass
      else:
          text_no_namedentities.append(item.text)
  print(" ".join(text_no_namedentities))
  </code></pre>
  
  <p>It does not work, since the NE are n-grams. And if I just check the contents of a little chunk of spacy object it is as follows:</p>
  
  <pre><code>for item in doc:
      print(item.text)
  
  iPad
  has
  a
  78
  %
  Steve
  Milunovich
  share
  of
  the
  U.S.
  commercial
  tablet
  market
  </code></pre>
  
  <p>So the spacy object is tokenized. Hence I can't remove the NEs with my code above. Any ideas on how I can remove all the named entities from the object? </p>