Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relation Extraction (RE) and refactoring of interfaces #2333

Merged
merged 84 commits into from
Jul 9, 2021

Conversation

alanakbik
Copy link
Collaborator

@alanakbik alanakbik commented Jul 9, 2021

This PR adds datasets and a model architecture for relation extraction to Flair. This is the first of many new NLP model types that will be added to extend Flair to many new NLP-tasks.

In the course of adding this model and preparing the other models, we are refactoring the interfaces and abstractions in Flair to make it easier to add new models & to cut down on code redundancies. This is an ongoing process and this PR is only the first step.

Specifically, this PR adds:

  • Relation extraction datasets for CoNLL-04, SemEval 2010 Task 8 and TACRED
  • A baseline RelationExtractor model (still being worked on but functional for now)
  • A refactoring of the label logic such that there are now "complex" labels that can include additional information next to the label and confidence. An example is the RelationLabel, which can be added to a Sentence like any other label, but next to label and confidence also includes pointers to the two Spans that are involved in the relation
  • A refactoring of the evaluation logic such that all Flair classification models now inherit from flair.nn.Classifier and so automatically share the entire evaluation logic. This massively cuts down on redundancies and creates a single evaluation routine shred by all models
  • the beta parameter is no longer a field of the models - it never really belonged there, rather it will become a parameter to be passed to the unified evaluation routine in a future PR
  • all Flair models now need to implement the property label_type to indicate the denominator of the label they predict

This PR includes many contributions by @melvelet and @ChristophAlt - thanks a lot!!!

@alanakbik alanakbik merged commit 8a2946e into master Jul 9, 2021
@alanakbik alanakbik deleted the relation_classification_script branch July 22, 2021 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants