Skip to content
Discussion options

You must be logged in to vote

Hi @aishaki ,

If you want to get the labels for each Span, then you need to access its Span.label_ attribute. You can find all other accessible attributes in the spaCy Span documentation. In your case, the code will look like this:

spans_key = "sc"
for doc in docs:
    print(doc.text)
    for span in doc.spans[spans_key]:
        print(span.text, span.label_)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ljvmiranda921
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat / spancat Feature: Span Categorizer
2 participants