spacynamed-entity-recognitionspacy-3

How to get a description for each Spacy NER entity?


I am using Spacy NER model to extract from a text, some named entities relevant to my problem, such us DATE, TIME, GPE among others.

For example, I need to recognize the Time Zone in the following sentence:

"Australian Central Time"

With Spacy model en_core_web_lg, I got the following result:

doc = nlp("Australian Central Time")
print([(ent.label_, ent.text) for ent in doc.ents])
    
>> [('NORP', 'Australian')]

My problem is: I don't have a clear idea about what exactly means entity NORP and more general what exactly means each Spacy NER entity (leaving aside the intuitive values of course).

I found the following snippet to get the complete entities list, but after that I'm blocked:

import spacy
nlp = spacy.load("en_core_web_lg")
nlp.get_pipe("ner").labels

I'm pretty new to using Spacy NLP and didn't find what I'm looking for on the official documentation, so any help will be appreciated!

BTW, I'm using Spacy version 3.2.1.


Solution

  • Most labels have definitions you can access using spacy.explain(label).

    For NORP: "Nationalities or religious or political groups"

    For more details you would need to look into the annotation guidelines for the resources listed in the model documentation under https://spacy.io/models/.