question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add Sentence pointer in Named Entity object

See original GitHub issue

The named entities returned from .ents have individual spans returned. Is it possible to add a member to the span so that it points to the sentence that it is a part of?

Would breaking a document up into sentences first be a better way to go to keep entities and sentences self-contained?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
honnibalcommented, May 5, 2016

Hmm. That’s probably a good idea.

In the meantime something like this should work:

    def get_sent(span):
        root = span.root
        i = 0
        while root.head is not root:
            root = root.head
            i += 1
            if i > len(root.doc):
                raise ValueError("Infinite loop. Cycle in parse tree?")
        return root.doc[root.left_edge.i : root.right_edge.i + 1]
0reactions
lock[bot]commented, May 9, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Named Entity Recognition in NLP - Towards Data Science
In natural language processing, named entity recognition (NER) is the problem of recognizing and extracting specific types of entities in text.
Read more >
Named Entity Extraction with Python - NLP-FOR-HACKERS
Named Entity Extraction is the first step towards information extraction from text. This guide helps you understand how NER works and how to...
Read more >
Data Objects and Annotations - Stanza - Stanford NLP Group
A Span object stores attributes of a contiguous span of text. A range of objects (e.g., named entities) can be represented as a...
Read more >
Linguistic Features · spaCy Usage Documentation
spaCy is a free open-source library for Natural Language Processing in Python. It features NER, POS tagging, dependency parsing, word vectors and more....
Read more >
A Survey on Deep Learning for Named Entity Recognition
A named entity is a word or a phrase that clearly identi- fies one item from a set ... The added language modeling...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found