GH-1449: labeling logic is part of DataPoint #1450
Merged
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 refactors the
DataPoint
class and classes that inherit from it (Token
,Sentence
,Image
,Span
, etc.) so that all have the same methods for adding and accessing labels.DataPoint
base class now defined labeling methods (closes All DataPoint classes should have the same Label logic #1449)Sentence
constructor, so instead of:you should now do:
or:
Note that Sentence labels now have a
label_type
(in the example that's 'sentiment').Corpus
method_get_class_to_count
is renamed to_count_sentence_labels
Corpus
method_get_tag_to_count
is renamed to_count_token_labels
Span
is now aDataPoint
(so it has anembedding
andlabels
)