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

Kylel/2023/wrappers #38

Merged
merged 6 commits into from
Aug 6, 2023
Merged

Kylel/2023/wrappers #38

merged 6 commits into from
Aug 6, 2023

Conversation

kyleclo
Copy link
Collaborator

@kyleclo kyleclo commented Aug 6, 2023

No description provided.

@kyleclo kyleclo requested a review from soldni August 6, 2023 22:21
Copy link
Member

@soldni soldni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! only left 2 small suggestions.

def check_field_name_availability(self, field_name: str) -> None:
if field_name in self.SPECIAL_FIELDS:
raise AssertionError(f"{field_name} not allowed Document.SPECIAL_FIELDS.")
if field_name in self.__entity_span_indexers.keys():
raise AssertionError(f"{field_name} already exists. Try `is_overwrite=True`")
raise AssertionError(f"{field_name} already exists. Try `doc.remove_entity({field_name})` first.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
raise AssertionError(f"{field_name} already exists. Try `doc.remove_entity({field_name})` first.")
raise AssertionError(f"{field_name} already exists. Try `doc.remove_entity(\"{field_name}\")` first.")

Nit, but otherwise it looks like you are providing a variable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 76 to 80
def annotate(self, field_name: str, entiites: List[Entity]) -> None:
if isinstance(entiites[0], Entity):
self.annotate_entity(field_name=field_name, entities=entiites)
else:
raise NotImplementedError(f"Unsupported entity type {type(entiites[0])}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def annotate(self, field_name: str, entiites: List[Entity]) -> None:
if isinstance(entiites[0], Entity):
self.annotate_entity(field_name=field_name, entities=entiites)
else:
raise NotImplementedError(f"Unsupported entity type {type(entiites[0])}")
def annotate(self, field_name: str, entiites: List[Entity]) -> None:
if all(isinstance(e, Entity) for e in entities):
self.annotate_entity(field_name=field_name, entities=entiites)
else:
raise NotImplementedError(f"entity list contains non-entities: {[type(e) for e in entities]}")

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@soldni soldni merged commit 4b3187e into main Aug 6, 2023
3 checks passed
@soldni soldni deleted the kylel/2023/wrappers branch August 6, 2023 22:59
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.

2 participants