Access NER Tags in a converted .spacy file #11496
-
Hi Everyone, Raphael and Thomas, who are a few of the SPACY developers helped me to convert my IOB file to a .spacy file. However, when I asked about how I can view the NER tags in my .spacy converted file, I was told to use the '.label_' property. The .label_ property works for accessing entities using pretrained spacy models. I want to train a model with my converted data but I want to see if the data converted properly first but I am unable to see that: I know the '.label_ ' property works for doc objects, based on the spacy course, but what i have is a DocBin object and there is no property for extracting the entity label. I converted and IOB file to a .spacy file. This is what the iob file looks like: When i converted my IOB file to json, i was able to see what the data looks like: But i cannot see what my converted spacy file looks like. I can access the vocab with nlp.vocab but not the ner tags. Please help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
Please don't paste images of code or terminal output; paste text as text. It's hard for us to read images and we can't modify your code or inspect, and we can't search it on the forums. You could have a look at this link that offers general guidelines about submitting issues and discussions on Github.
I think what is perhaps a bit confusing here is that there are two views of the same entity data. You can set and access entity labels either at the
Doc
level e.g. usingset_ents()
or at the level of the individual tokens that make up aDoc
. For example,token = doc[2]
returns you the third token in the document. You can then access any entity information relating to that token viatoken…