spaCy 並行分詞
在使用spacy的時候,感覺比nltk慢了許多,一直在尋找並行化的方案,好在找到了,下面給出spaCy並行化的分詞方法使用示例:
import spacy
nlp = spacy.load("en")
docs = [
"Our dream was to bring to Shanghai a tribute event dedicated to China which tells our history and visio.",
"It was not simply a fashion show, but something that we created especially with love and passion for China and all the people around the world who loves Dolce & Gabbana"
]
for doc in nlp.pipe(docs, batch_size=100, n_threads=3):
print(list(doc))
print("*" * 50)