Thank spacy for providing the very nice library. I found a question: merging span very slow(about 200ms) when using the model "en_core_web_md". The code is as follows:
import spacy
import time
nlp = spacy.load("en_core_web_md")
doc = nlp("I need to speak with one of your technicians")
st = time.time()
with doc.retokenize() as retokenizer:
retokenizer.merge(doc[0:4])
print(time.time() - st)
print([w.text for w in doc])
This is fast(about 12ms) while using the model:"en_core_web_sm" or "en_core_web_lg".
The environment:
spacy 2.3.2
en-core-web-md 2.3.1
Python 3.8.6
Ubuntu 16.04.7 LTS
I tried to add:
doc.tensor = None
before retokenize according to here, but it did not work. Anyone can help me. Thanks in advance.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…