spacy_ex.py 336 B

1234567891011
  1. import fr_core_news_sm
  2. nlp = fr_core_news_sm.load()
  3. doc = nlp(u"Salut c'est nous! On revient de Paris.")
  4. for token in doc:
  5. print(token.text, token.lemma_, token.pos_, token.tag_, token.dep_,
  6. token.shape_, token.is_alpha, token.is_stop)
  7. for ent in doc.ents:
  8. print(ent.text, ent.start_char, ent.end_char, ent.label_)