import spacy
nlp = spacy.load('en')

import neuralcoref
neuralcoref.add_to_pipe(nlp)

def get_coref(s1):
    doc = nlp(s1)
    print(doc._.has_coref)
    if doc._.has_coref:
        print(doc._.coref_clusters)

get_coref('My sister has a dog. She loves him.')
get_coref('Some like to play football, others are fond of basketball.')
get_coref('The more a man knows, the more he feels his ignorance.')

自然语言处理与知识图谱week7 | 篇章分析(neuralcoref)

相关文章:

  • 2021-06-03
  • 2021-09-25
  • 2021-06-12
  • 2021-04-28
  • 2021-07-11
  • 2021-10-24
  • 2021-12-04
  • 2021-05-09
猜你喜欢
  • 2021-06-24
  • 2021-05-19
  • 2021-04-23
  • 2021-04-18
  • 2022-01-22
  • 2022-12-23
  • 2021-05-10
相关资源
相似解决方案