Skip to content

Conversation

@dumbshow
Copy link

@dumbshow dumbshow commented Oct 25, 2020

Hi, I was getting errors with noun phrases that occurred at the beginning and end of SpaCy docs in hyponym_detector.py. (Not sure if I have filed this request correctly....I am new to git....) Thank you.

@dakinggg
Copy link
Collaborator

@DeNeutoy can you have a look a this?

Copy link
Contributor

@DeNeutoy DeNeutoy left a comment

Choose a reason for hiding this comment

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

@dumbshow, thanks for catching this! Two small things, and then also could you add a test for this in this file?

https://github.com/allenai/scispacy/blob/master/tests/test_hyponym_detector.py#L8

Thanks!


start = token.i
while True:
if start==0:
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add spaces between symbols, (our linter requires it), like if start == 0:

end = token.i + 1
while True:
previous = doc[end]
try:
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of using try/except here, could you get the length of the doc before this while loop (len(doc)) and check against it each time? It's more explicit and doesn't silently catch other index errors that may be thrown e.g within spacy.

Copy link
Author

Choose a reason for hiding this comment

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

Sorry for the delay. Should have time to make these updates shortly.

Copy link
Contributor

Choose a reason for hiding this comment

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

No problem, contributions are always welcome regardless of timeframe :)

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