Skip to main content

This is a coreference resolution utility package that supports multiple transformer-based coreference resolvers. The current version supports an improved version of the AllenNLP SPANBERT model and a GPT3 (text-davinci-003) based resolver that supports few-shot prompts. Coreference resolution is the task of identifying all expressions (e.g., pronouns, names, definite descriptions) in a text that refer to the same entity. This is a crucial task for many natural language processing applications such as question answering, summarization, and sentiment analysis.

Our tool is designed to help researchers and developers experiment with different transformer-based coreference resolvers and compare their performance. The package is currently under experimentation and cannot be readily used. However, we aim to make it publicly available in the future.

The AllenNLP SPAN-BERT model is a state-of-the-art coreference resolution model that is based on the popular BERT architecture. We have made improvements to the model by handling nested coreferent mentions and cataphoras. The GPT3-based resolver, on the other hand, is a cutting-edge model that is capable of few-shot learning, meaning that it can adapt to new variations with a few example prompts.

Our Python package is designed to be easy to use and integrate with existing NLP pipelines. It provides a simple interface for loading and using different coreference resolvers, and supports various input formats such as raw text and pre-processed text. We believe that our tool will be a valuable resource for researchers and developers working on coreference resolution and related NLP tasks.

Examples of using CorefTools

Here are a few examples of how to use CorefTools, a Python package for coreference resolution.

Example 1: Using the SpanBERTResolver

Note that by default we use spanbert-large model, you can alter the model by passing the corresponding model_url while initializing the SpanBERTResolver class

from coreftools.corefresolvers import SpanBERTResolver

resolver = SpanBERTResolver()
example_query = "John and Jane went to the park. They had a picnic and played frisbee. When they were done, they walked home together."
resolved_query = resolver.resolve_coref(example_query)
print(resolved_query)

# Output
# John and Jane went to the park. John and Jane had a picnic and played frisbee. When John and Jane were done, John and Jane walked home together.

Example 2: Using the GPTResolver

The following example demonstrates how to use the GPTResolver class to resolve coreferences using the GPT-3 model. Note that we use "text-davinci-003" as our default model due to performance reasons. You can also pass other models, such as "text-davinci-002" or "GPT3.5" with engine parameter to resolve_coref method of the GPTResolver class. This would resemble gpt.resolve_coref(query_to_resolve, engine=your_choice_of_engine)

from coreftools.corefresolvers import GPTResolver

resolver = GPTResolver()
example_query = "My dog is very cute. She loves to play fetch."
resolved_query = resolver.resolve_coref(example_query)
print(resolved_query)

# Output
# My dog is very cute. My dog loves to play fetch

Metadata

Release files for coreftools 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for coreftools 1.1.1
File Interpreter ABI Platform Actions
coreftools-1.1.1-py3-none-any.whl Python 3 none any Details for coreftools-1.1.1-py3-none-any.whl

Release files / coreftools-1.1.1-py3-none-any.whl

Download URL coreftools-1.1.1-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca84dfa3a49970958525d96d6220567830aad1168454d111281a33b44ae56b4e
BLAKE2b-256 checksum
How to use checksums
de59e052e700cafe5cc8dbd4c34fb7675d449bd873f80c5461577fcc69fb056b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.0

Security for coreftools 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page