NLP Cache
A caching component for Doc
classes in spacy
.
Installation
pip install nlp_cache_sebastian_stigler
Usage
import spacy
nlp = spacy.load("de_core_news_sm")
text = "Ich wünsche Ihnen einen guten Morgen!"
doc_1 = nlp(text)
doc_2 = nlp(text)
To speed up loading a recurrent text you can use this caching utility, to
lookup known texts from the cache stored in the cache
directory (relative
to the current directory).
import spacy
from nlp_cache import NlpCache
nlp = NlpCache(uncached_nlp=spacy.load("de_core_news_sm"), path="cache")
text = "Ich wünsche Ihnen einen guten Morgen!"
doc_1 = nlp(text)
doc_2 = nlp(text)