Skip to content

Python-C quick start

1. Install

python -m pip install --only-binary=:all: radixor-c

The dependency radixor-models-standard supplies the 31 compiled standard models. Radixor-C supports CPython 3.10 through 3.14.

2. Stem one word

from radixor_c import Stemmer

english = Stemmer("en")
print(english.stem("running"))       # run
print(english.stem("unknown_word"))  # None when no patch applies

Construct a stemmer once and reuse it. Scalar calls are the principal reason to choose this C runtime.

3. Stem a collection

words = ["running", "studies", "cars"]
print(english.stem_batch(words))

Batch and PyStemmer-compatible calls are available for API portability:

english.stemWord("unknown_word")
english.stemWords(words)

stemWord() and stemWords() return unmatched inputs unchanged; stem() and stem_batch() return None for them.

4. Load a custom compiled model

custom = Stemmer(compiled="models/domain-english.rxc")

Radixor-C accepts a prepared compiled Radixor model only. To create it, use Java or install radixor in the preparation environment:

import radixor

radixor.compile("domain.tsv.gz", "models/domain-english.rxc", language="en")

See Data Formats for the complete workflow.