-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
RelationExtractor
model (still being worked on but functional for now)RelationLabel
, which can be added to aSentence
like any other label, but next to label and confidence also includes pointers to the twoSpans
that are involved in the relationflair.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 modelsbeta
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 PRlabel_type
to indicate the denominator of the label they predictThis PR includes many contributions by @melvelet and @ChristophAlt - thanks a lot!!!