Skip to main content

Coreference Resolution wrapper

Project description

Coreference Resolution wrapper

Coreference Resolution is the task of finding all expressions that refer to the same entity in a text. It is an important step for a lot of higher level NLP tasks that involve natural language understanding such as document summarization, question answering, and information extraction.

This is a simple library that wrap two Coreference Resolution models form StanfordNLP package: the statistic and neural models. We use here the SpaCy package to load the neural model (a.k.a, NeuralCoref), and the stanfordnlp package to load the statistic model (a.k.a, CoreNLPCoref).

Requirements

pip3 install spacy==2.1.0
pip3 install stanfordnlp
python3 -m spacy download en
pip3 install neuralcoref
pip3 install wrapperCoreference

StanfordNLP also require the manual downloading of a core of modules, review here for more details.

wget http://nlp.stanford.edu/software/stanford-corenlp-full-2018-10-05.zip

Methods

Example of usage of the neural model

from wrapperCoreference import WrapperCoreference
wc = WrapperCoreference()
wc.NeuralCoref(u'My sister has a dog. She loves him.')
#output: [{'start': 21, 'end': 24, 'text': 'She', 'resolved': 'My sister'}, {'start': 31, 'end': 34, 'text': 'him', 'resolved': 'a dog'}]

Example of usage of the statistic model

from wrapperCoreference import WrapperCoreference
wc = WrapperCoreference()
wc.setCoreNLP('/tmp/stanford-corenlp-full-2018-10-05')
print(wc.CoreNLPCoref(u'My sister has a dog. She loves him.'))
#output: [{'start': 31, 'end': 34, 'text': 'him', 'resolved': 'a dog', 'fullInformation': [{'start': 14, 'end': 19, 'text': 'a dog'}]}, {'start' : 21, 'end': 24, 'text': 'She', 'resolved': 'My sister', 'fullInformation': [{'start': 0, 'end': 9, 'text': 'My sister'}]}]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wrapperCoreference-0.0.2.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wrapperCoreference-0.0.2-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file wrapperCoreference-0.0.2.tar.gz.

File metadata

  • Download URL: wrapperCoreference-0.0.2.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for wrapperCoreference-0.0.2.tar.gz
Algorithm Hash digest
SHA256 4bfc767d9ca72d77537146233feace85a16e090ee28a8d9230382dcc484ad198
MD5 3d15843056990cc5729568c2eb1bff9c
BLAKE2b-256 b16727d3448299f6dca81967b5c62beac6d3b06f87a768475b12569966fc01bb

See more details on using hashes here.

File details

Details for the file wrapperCoreference-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: wrapperCoreference-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for wrapperCoreference-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 114ae05cd6ff5e8f85c869ef696557d5c5689e49459f015f4bc2f844ddc3516a
MD5 e99d8ace0ceb038f93bb146f2dc55a41
BLAKE2b-256 10c809d562ebdf71fa0876f22cbafcc479edb71893fa8d4a771f5b8a630cef32

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page