Skip to main content
## spacy_kenlm: KenLM extension for spaCy 2.0

This package adds [kenLM](https://github.com/kpu/kenlm) support
as a [spaCy 2.0 extension](https://spacy.io/usage/processing-pipelines#extensions).

## Usage

Train a `kenLM` language model first (or use the test model from `test.arpa`).

Add the spaCyKenLM to the spaCy pipeline to return scores.

```
import spacy
from spacy_kenlm import spaCyKenLM

nlp = spacy.load('en_core_web_sm')

spacy_kenlm = spaCyKenLM() # default model from test.arpa

nlp.add_pipe(spacy_kenlm)

doc = nlp('How are you?')

# doc score
doc._.kenlm_score

# span score
doc[:2]._.kenlm_score

# token score
doc[2]._.kenlm_score
```

## Installation

Install from the pip package.

```
pip install spacy_kenlm
```

Release files for spacy_kenlm 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spacy_kenlm 0.1.1
File Size Uploaded
spacy_kenlm-0.1.1.tar.gz 3.2 kB Details

Release files / spacy_kenlm-0.1.1.tar.gz

Download URL spacy_kenlm-0.1.1.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
33f2b7dc71e42b92e1bf65bd3a572accebd79c7ea707517a8bfa8442210b797f
BLAKE2b-256 checksum
How to use checksums
8dacdc62d6eef6d0f5eeb3f6e6cf34c47ee6e4b6d11141daa93d15a53ee3a18a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page