-
Notifications
You must be signed in to change notification settings - Fork 249
Added index checking to hyponym_detector.py #282
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,8 @@ def expand_to_noun_compound(self, token: Token, doc: Doc): | |
|
|
||
| start = token.i | ||
| while True: | ||
| if start==0: | ||
| break | ||
| previous = doc[start - 1] | ||
| if previous.pos_ in {"PROPN", "NOUN", "PRON"}: | ||
| start -= 1 | ||
|
|
@@ -70,7 +72,10 @@ def expand_to_noun_compound(self, token: Token, doc: Doc): | |
|
|
||
| end = token.i + 1 | ||
| while True: | ||
| previous = doc[end] | ||
| try: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of using
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for the delay. Should have time to make these updates shortly.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No problem, contributions are always welcome regardless of timeframe :) |
||
| previous = doc[end] | ||
| except IndexError: | ||
| break | ||
| if previous.pos_ in {"PROPN", "NOUN", "PRON"}: | ||
| end += 1 | ||
| else: | ||
|
|
||
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.
Please add spaces between symbols, (our linter requires it), like
if start == 0: