Metadata-Version: 2.1
Name: nlp-cache-sebastian-stigler
Version: 0.3.0
Summary: A caching component for `Doc` classes in `spacy`.
Home-page: https://in-stigler.htw-aalen.de/gitea/bantel/nlp_cache
Author: Sebastian Stigler
Author-email: sebastian.stigler@hs-aalen.de
License: UNKNOWN
Platform: UNKNOWN
Classifier: Intended Audience :: Education
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

# NLP Cache

A caching component for `Doc` classes in `spacy`.

# Installation

```bash
pip install nlp_cache_sebastian_stigler
```

# Usage

```python
import spacy

nlp = spacy.load("de_core_news_sm")
text = "Ich wünsche Ihnen einen guten Morgen!"
doc_1 = nlp(text)  # mean loading time about 4.5 ms
doc_2 = nlp(text)  # recurrent mean loading time about 4.5 ms
```

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).

```python
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)  # mean loading time about 4.5 ms
doc_2 = nlp(text)  # recurrent mean loading time about 840 µs
```


