nlp.py 349 B

123456789101112131415
  1. import fr_core_news_md
  2. nlp = fr_core_news_md.load()
  3. def repond(message):
  4. doc = nlp(message)
  5. for token in doc:
  6. print(token.text, token.lemma_, token.pos_, token.tag_, token.dep_,
  7. token.shape_, token.is_alpha, token.is_stop)
  8. for ent in doc.ents:
  9. print(ent.text, ent.start_char, ent.end_char, ent.label_)