Cannot import biluo_tags_from_offsets from spacy.gold

Question:

I am trying to import biluo_tags_from_offsets from spacy.gold but cannot do it.
Getting ModuleNotFoundError.

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-21-d17a54331c7a> in <module>
      3 
      4 import spacy
----> 5 from spacy.gold import biluo_tags_from_offsets
      6 nlp = spacy.load("en_core_web_lg")
      7 

ModuleNotFoundError: No module named 'spacy.gold'

How can I use this spacy.gold module. I have already installed spacy.
I am an amateur, sorry if this question does not make any sense.
Any kind of help is appreciated.
Thanks!

Asked By: thenocturnalguy

||

Answers:

As the documentation says, spacy.gold was disabled in spaCy 3.0. If you have the latest spaCy version, that is why you are getting this error.

You need to replace from spacy.gold import biluo_tags_from_offsets with from spacy.training import offsets_to_biluo_tags.

Answered By: Amir
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.