We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When we recognize sub-national regions - e.g., states in the US, provinces in Canada, we should also provide links to the entity id of the country.
The text was updated successfully, but these errors were encountered:
We can add an extra attribute to entities of provinces/states along with the original attribute of wikilink. This will look like:
for ent in doc.ents: if ent.label_ in ['US_STATE', 'CANADIAN_PROVINCE']: print(f'{ent.text}, type: {ent.label_}, {ent._.wikilink}, parent: {ent._.parent} [{ent.start_char}, {ent.end_char}]') else: print(f'{ent.text}, type: {ent.label_}, {ent._.wikilink} [{ent.start_char}, {ent.end_char}]')
Or we can just tack on the link after the matching process is done by checking the label type of the entities:
for ent in doc.ents: if ent.label_ == 'US_STATE',: print(f'{ent.text}, type: {ent.label_}, {ent._.wikilink}, parent: {USA_WIKILINK} [{ent.start_char}, {ent.end_char}]') elif ent.label_ == 'CANADIAN_PROVINCE': print(f'{ent.text}, type: {ent.label_}, {ent._.wikilink}, parent: {CANADA_WIKILINK} [{ent.start_char}, {ent.end_char}]') else: print(f'{ent.text}, type: {ent.label_}, {ent._.wikilink} [{ent.start_char}, {ent.end_char}]')
@lintool which option seems better? I think adding an extra attribute is more consistent.
Sorry, something went wrong.
No branches or pull requests
When we recognize sub-national regions - e.g., states in the US, provinces in Canada, we should also provide links to the entity id of the country.
The text was updated successfully, but these errors were encountered: