asyml / asyml/ForteHealth

Add support for Coreference Resolution

Open
#15 8 comments 0 reactions 1 assignee Assigned to @KiaLAN View on GitHub
new component
Dominant language
Python
Stars
14
Forks
5
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
Issues with coreference resolution are one of the most frequently mentioned challenges for information extraction from the biomedical literature. We plan to add support for coreferencing into our pipeline through a `CoreferenceProcessor` and this issue will help you get the implementation kickstarted.

**Describe the solution you'd like**
We will be developing a wrapper around Huggingface's NeuralCoref library to suit our use case and leverage their pre trained model for coreference resolution purposes. It uses spaCy with Neural Networks in the backend. The following is the link to the GitHub repo for the NeuralCoref project:
https://github.com/huggingface/neuralcoref

This is the blogpost by Huggingface to better describe their coreference resolution:
https://medium.com/huggingface/state-of-the-art-neural-coreference-resolution-for-chatbots-3302365dcf30

Please give the GitHub repository Readme file and the blogpost a read as it would help implementing the wrapper around NeuralCoref.
Their model is trained on English language (non biomedical corpus). The ontologies pertaining to this issue have already been defined, i.e. `CoreferenceGroup`, `EntityMention`, `MedicalEntityMention`. `CoreferenceGroup` currently works with `EntityMention` members, and we might have to translate/merge those as `MedicalEntityMention` for our medical pipeline.

`doc._.coref_clusters` <=> `CoreferenceGroup`
`doc._.coref_clusters[1].mentions` <=> `EntityMentions`

[(Building and Generating Ontologies documentation)](https://asyml-forte.readthedocs.io/en/latest/toc/ontology_generation.html?highlight=generate)

As is clear from the GitHub repository, if `doc._.has_coref` is `True`, `doc._.coref_clusters` returns a list of all coref clusters, each of which would in turn define CoreferenceGroups. NeuralCoref mentions are all Span objects, which implies its straightforward to define EntityMentions/MedicalEntityMentions from these. These in turn can then be used to define a `CoreferenceGroup`.

Regarding config for the processor, the user can provide values for greediness, max_dist, blacklist, etc. These parameters are mentioned in the GitHub repository readme and can be referred to for more details.

Example call:
```
pl.add(
CoreferenceProcessor(),
{
lang: "en_core_web_sm",
greedyness: 0.75,
max_dist: 50,
max_dist_match: 500,
},
)

```

Another thing that we will have to ensure is that we must install neuralcoref along with forte-medical. Hence, it will have to be added to the setup.py and requirements files.

Also, make sure you add unit test cases for the processor. You can refer any of the test files in https://github.com/asyml/ForteHealth/tree/master/tests/forte_medical/processors for reference.

P.S. You can follow [NegationContextAnalyzer](https://github.com/asyml/forte-medical/blob/master/forte_medical/processors/negation_context_analyzer.py) processor for the structure and code design. It can be used as the template processor to refer to when implementing a new one.

**Describe alternatives you've considered**
Several papers were referred to and a couple GitHub repositories as well. E2E was another alternative to this for coreference resolution, but Huggingface's NeuralCoref seems to be strightforward to implement and since we already have spaCy based processors in our code base, it can be easier to write this wrapper.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.