-
Notifications
You must be signed in to change notification settings - Fork 7
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
simplify transformer_token_classification_taskmodule #71
simplify transformer_token_classification_taskmodule #71
Conversation
…tion_annotation (backwards compatible)
…quence() and _encode_text() to ease testing
…ot partition is provided to _encode_text
single_sentence: bool = False, | ||
sentence_annotation: str = "sentences", | ||
partition_annotation: Optional[str] = None, | ||
single_sentence: bool = False, # deprecated, set partition_annotation instead |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're still at version 0.x -- no need for backwards compatibility or deprecations, just remove it. 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, nice :)
def _encode_text(self, text, partition: Optional[LabeledSpan] = None): | ||
if self.partition_annotation is not None and partition is None: | ||
raise ValueError(f"partitioning is enabled, but no partition is provided") | ||
_text = text[partition.start : partition.end] if partition is not None else text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we agree on not using underscores for variable names. I'm sure there is a name that fits better.
Looks good! 👍 The unittest cleanup will be done in a different commit. |
No description provided.