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

How can I get the offset position of each mention returned by coref.get_mentions() #25

Closed
smudgekick opened this issue Apr 4, 2018 · 1 comment

Comments

@smudgekick
Copy link

Currently 'coref.get_mentions()' only returns a list mentions. Ideally, it would be helpful to get a list of dictionaries returned with the mention and its offset position within the utterance (basically the string being passed in for processing).

Is there a way do this?

@thomwolf
Copy link
Member

thomwolf commented Apr 4, 2018

Hi Bryan, the Mention class of neuralcoref is a subclass of spaCy Span class so you can access all the attributes of a spaCy span in the mention like offset position, length, etc.
For example: coref.get_mentions()[0].start will gives you the token offset for the start of the first mention.
Check spaCy Span API doc for the full list and more information: https://spacy.io/api/span#attributes

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

No branches or pull requests

2 participants