Skip to main content

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

Project description

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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nlp_cache_sebastian_stigler-0.3.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file nlp_cache_sebastian_stigler-0.3.0.tar.gz.

File metadata

  • Download URL: nlp_cache_sebastian_stigler-0.3.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.6.9

File hashes

Hashes for nlp_cache_sebastian_stigler-0.3.0.tar.gz
Algorithm Hash digest
SHA256 cedef96fda4c2915c813e6a8a10240be5ef762e6b56174b5e7ea00753cfd710f
MD5 b0d1ed38f6afa72a9ec7c53d28dfece0
BLAKE2b-256 b5ade0d1379f5e62fb7108320aea8b5617e89c5f9cc7f439b4f597ba24a4534f

See more details on using hashes here.

File details

Details for the file nlp_cache_sebastian_stigler-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: nlp_cache_sebastian_stigler-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.6.9

File hashes

Hashes for nlp_cache_sebastian_stigler-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 73e49397eafb535ff190b2931e513129685e2f93f2aa9a54147efe10b511cf52
MD5 c1a6cb669f57ab5905e52d3f930efbea
BLAKE2b-256 5f41bd9aca96318a82023a9f9a4b2d07ecc0fe15a429eb669bd8a172d869e61d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page