tantivy-stemmers
Library Listed Dormant
A collection of Tantivy stemmer tokenizers
- Downloads
- 5,962
- Dependents
- 3
- Stars
- 19
- Forks
- 5
- Contributors
- 1
- Commits
- 114
- Latest release
- 0.4.0 ·
About
Tantivy stemmers (tokenizer)
This library bundles several OSS to provide a collection of stemming algorithms for various languages as a Tantivy tokenizer. Tantivy is a full-text search engine library written in Rust. As its default Stemmer tokenizer depends on a less then alive library rust-stemmers, there are only a very few languages available by default. Nevertheless, Tantivy provides an easy way to build our own custom tokenizers (see the tantivy-tokenizer-api for details).
This library compiles several OSS projects into 1 library:
Read the full README
All the raw algorithms in this library are written in the Snowball language, then complied into a Rust code using the Snowball compiler - all these generated algorithms are located at
src/snowball/algorithms/*. A Snowball environment is then needed to execute the generated algorithm. This environment is comprised of filessrc/snowball/among.rsandsrc/snowball/env.rs- both files have been provided (ie. copied) from the official Snowball repository:rust/src/snowball.Implementation of the
Stemmerin this library is more or less a copy of the original implementation of theStemmertokenizer in the Tantivy library. Only this lib does not depend on therust-stemmerspackage and instead includes various algorithms in it self. And instead of importing from thetantivylib, this library imports fromtantivy-tokenizer-api.Algorithms
Most, if not all, stemming algorithms are obtained from the official Snowball website and compiled using the Snowball compiler into Rust. More information about individual algorithm licenses are noted below - most are published under the BSD license.
Cargo features
As this library bundles many algorithms and contains lots of generated code, it would be nice not to have to include it all in our final build. For this reason, each algorithm is published as a Cargo feature. In order to use a specific algorithm, you have to install the appropriate feature first. If you want to use, say, the Dolamic algorithm for Czech in the aggressive variant, your Cargo.toml should look like this:
# ...
[dependencies]
tantivy-stemmers = { version = "0.3.0", features = ["default", "czech_dolamic_aggressive"] }
# ...
See the features table under Supported algorithms below.
Usage
use tantivy::Index;
use tantivy::schema::{Schema, TextFieldIndexing, TextOptions, IndexRecordOption};
use tantivy::tokenizer::{LowerCaser, SimpleTokenizer, TextAnalyzer};
use tantivy_tokenizer_api::TokenFilter;
use tantivy_stemmers;
fn main() {
let mut schema_builder = Schema::builder();
schema_builder.add_text_field(
"title",
TextOptions::default()
.set_indexing_options(
TextFieldIndexing::default()
// Set name of the tokenizer, we will register it shortly
.set_tokenizer("lang_cs")
.set_index_option(IndexRecordOption::WithFreqsAndPositions),
)
.set_stored(),
);
let schema = schema_builder.build();
let index = Index::create_in_ram(schema.clone());
// Create an instance of the StemmerTokenizer
// With default algorithm (default algorithm is [`tantivy_stemmers::algorithms::english_porter_2`])
// let stemmer = tantivy_stemmers::StemmerTokenizer::default();
// With a specific algorithm
let stemmer = tantivy_stemmers::StemmerTokenizer::new(
tantivy_stemmers::algorithms::czech_dolamic_aggressive,
);
// Before we register it, we need to wrap it in an instance
// of the TextAnalyzer tokenizer.
// ❗️ We also have to transform the text to lowercase since
// the stemmer expects lowercase.
let tokenizer = TextAnalyzer::builder(
stemmer.transform(LowerCaser.transform(SimpleTokenizer::default())),
).build();
// Register our tokenizer with Tantivy under a custom name
index.tokenizers().register("lang_cs", tokenizer);
}
Supported algorithms
List of available Cargo features
| Feature | Default | Language | Notes |
|---|---|---|---|
arabic | - | Arabic | |
armenian_mkrtchyan | - | Armenian | |
basque | - | Basque | |
catalan | - | Catalan | |
czech_dolamic_aggressive | - | Czech | |
czech_dolamic_light | - | Czech | |
danish | - | Danish | |
dutch | - | Dutch | |
english_lovins | - | English | |
english_porter | - | English | Porter has been deprecated in favour of Porter 2 |
english_porter_2 | 👈 this | English | |
estonian_freienthal | - | Estonian | |
finnish | - | Finnish | |
french | - | French | |
german | - | German | |
greek | - | Greek | |
hindi_lightweight | - | Hindi | |
hungarian | - | Hungarian | |
indonesian_tala | - | Indonesian | |
irish_gaelic | - | Irish | |
italian | - | Italian | |
lithuanian_jocas | - | Lithuanian | |
nepali | - | Nepali | |
norwegian_bokmal | - | Norwegian | |
polish_yarovoy | - | Polish | Non-Snowball alg. |
polish_yarovoy_unaccented | - | Polish | Non-Snowball alg.; besides stemming, this alg. also removes accents |
portuguese | - | Portuguese | |
romanian_heidelberg | - | Romanian | |
romanian_tirdea | - | Romanian | |
romanian | - | Romanian | |
russian | - | Russian | |
spanish | - | Spanish | |
swedish | - | Swedish | |
turkish_cilden | - | Turkish | |
yiddish_urieli | - | Yiddish |
Notes on individual algorithms and their sources
Arabic
The Arabic Snowball algorithm was developed by Assem Chelli and Abdelkrim Aries. Its source code has been obtained under the BSD license from the official Snowball GitHub repository.
Armenian
The Armenian Snowball algorithm was developed by Astghik Mkrtchyan and source code has been obtained under the BSD license from the official Snowball website.
Basque
The Basque Snowball algorithm was obtained under the BSD license from the official Snowball website.
Catalan
The Catalan Snowball algorithm was obtained under the BSD license from the official Snowball website.
Czech
Currently only a single algorithm (in an
aggressiveandlightvariants) is available:Dolamic. This algorithm has been developed by Ljiljana Dolamic & Jacques Savoy and published under the BSD license. It's written in the Snowball language and is available on the Snowball website.There is 1 more stemming algorithm for the Czech language:
Hellebrand. This algorithm has been developed by David Hellebrand & Petr Chmelař. It's also written in the Snowball language and is available as a Master's thesis here. However, this algorithm has been published under the GNU license and is therefore not included in this library as we'd like to keep the BSD license on this library. (If you wish, you can always compile theHellebrandalgorithm from Snowball to Rust and include it yourself.)Danish
The Danish Snowball algorithm was obtained under the BSD license from the official Snowball website.
Dutch
The Dutch Snowball algorithm was obtained under the BSD license from the official Snowball website.
English
Three english algorithms in Snowball are available from the official Snowball website - the Porter, Porter 2 and Lovins. (At least) the first two algorithms have been developed by Dr. Martin Porter. The Porter algorithm (original) is used as a default algorithm in this library. If you wish, you can specify to use the newer Porter 2 algorithm (
Algorithm::EnglishPorter2) or the Lovins algorithm (Algorithm::EnglishLovins).Estonian
The Estonian Snowball algorithm was developed by Linda Freienthal in 2019 and obtained under the BSD license from the official Snowball website.
Finnish
The Finnish Snowball algorithm was obtained under the BSD license from the official Snowball website.
French
The French Snowball algorithm was obtained under the BSD license from the official Snowball website.
German
The German Snowball algorithm was obtained under the BSD license from the official Snowball website.
Greek
The Greek Snowball algorithm has been developed by Georgios Ntais in 2006 and later enhanced by Spyridon Saroukos in 2008. The source code has been obtained under the BSD license from the official Snowball website.
Hindi
The Hindi (lightweight) Snowball algorithm was developed by A. Ramanathan and D. Rao in 2003. Its source code has been obtained under the BSD license from the official Snowball website.
Hungarian
The Hungarian Snowball algorithm was obtained under the BSD license from the official Snowball website.
Indonesian
The Indonesian Snowball algorithm was developed by Fadillah Z. Tala in 2003 and source codes has been obtained under the BSD license from the official Snowball website.
Irish (Gaelic)
The Irish (Gaelic) Snowball algorithm was obtained under the BSD license from the official Snowball website.
Italian
The Italian Snowball algorithm was obtained under the BSD license from the official Snowball website.
Lithuanian
The Lithuanian Snowball algorithm (
LithuanianJocas) was contributed by Dainius Jocas. Its source code has been obtained under the BSD license from the official Snowball website.Nepali
The Nepali Snowball algorithm (
LithuanianJocas) was contributed by Dainius Jocas. Its source code has been obtained under the BSD license from the official Snowball website. The Nepali Snowball algorithm was developed by Ingroj Shrestha, Oleg Bartunov and Shreeya Singh. Its source code has been obtained under the BSD license from the official Snowball GitHub repository.Norwegian (Bokmål)
The Norwegian (Bokmål variant) Snowball algorithm was obtained under the BSD license from the official Snowball website.
Polish
While there are a few distinct stemming algorithms for the Polish language, there's not a single Polish (OSS) stemming algorithm implemented in the Snowball language. Namely, the most popular stemming algorithm Stempel is implemented in Java. There are also its ports to Python and Go.
There is 1 Polish stemming algorithm with 2 variants in this library:
polish_yarovoyandpolish_yarovoy_unaccented. It has been ported to Rust from a Go implementation by Nikolay Yarovoy, which in turn was inspired by Python implementation by Błażej Kubiński.
There are 2 variants of this algorithm:polish_yarovoystems Polish words and leaves accents as are, while thepolish_yarovoy_unaccentedstems Polish words and also removes all the accents.Portuguese
The Portuguese Snowball algorithm was obtained under the BSD license from the official Snowball website.
Romanian
Three Snowball algorithms for the Romainian language are available:
Romanian,RomanianHeidelbergandRomanianTirdea. All algorithm were obtained under the BSD license from the official Snowball website and Snowball website.The
RomanianHeidelbergalgorithm has been developed in 2006 by Marina Stegarescu, Doina Gliga and Erwin Glockner at the Ruprecht-Karls-University of Heidelberg (Department of Computational Linguistics).The
RomanianTirdeahas been developed in 2006 by Irina Tirdea.Russian
The Russian Snowball algorithm was obtained under the BSD license from the official Snowball website.
Spanish
The Spanish Snowball algorithm was obtained under the BSD license from the official Snowball website.
Swedish
The Swedish Snowball algorithm was obtained under the BSD license from the official Snowball website.
Turkish
The Turkish Snowball algorithm was developed by Evren (Kapusuz) Çilden in 2007. The source code has been obtained under the BSD license from the official Snowball website.
Note from the Snowball website
The Turkish stemming algorithm was provided by Evren Kapusuz Cilden. It stems only noun and nominal verb suffixes because noun stems are more important for information retrieval, and only handling these simplifies the algorithm significantly.
In her paper (linked above) Evren explains
The stemmer can be enhanced to stem all kinds of verb suffixes. In Turkish, there are over fifty suffixes that can be affixed to verbs [2]. The morphological structure of verb suffixes is more complicated than noun suffixes. Despite this, one can use the methodology presented in this paper to enhance the stemmer to find stems of all kinds of Turkish words.
Yiddish
The Yiddish Snowball algorithm was created by Assaf Urieli in 2020 and obtained under the BSD license from the official Snowball website.
Compatibility
- Runs on
- GPU support unknown
What shows it
- no dependency or feature matches a backend row
- Native code
- None found
- No native code found
- Python bindings
- No Python binding crate found
- License
- BSD-3-Clause
Compare with similar projects
Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.
| Project | Downloads | Dependents | Stars | Latest release | Runs on (GPU) | Native code | License |
|---|---|---|---|---|---|---|---|
|
A collection of Tantivy stemmer tokenizers |
5,962 downloads over 30 days | 3 | 19 | 0.4.0 | GPU support unknown | No native code found | BSD-3-Clause |
|
tokenizers Featured
Fastest implementation of the most used tokenizers in AI. |
7,490,451 downloads over 30 days | 1,021 | 11,230 | 0.23.2 | GPU support unknown | Binds native code: tikv-jemalloc-sys, onig_sys (feature default) | Apache-2.0 |
|
tiktoken-rs Featured
Library for encoding and decoding with the tiktoken library in Rust |
3,939,182 downloads over 30 days | 449 | 410 | 0.12.1 | GPU support unknown | No native code found | MIT |
|
High performance tokenizers for Rust Python bindings |
27,821 downloads over 30 days | 12 | 345 | 8.1.1 | GPU support unknown | No native code found | Apache-2.0 |
|
splintr Listed
Tokenizer for Rust and Python: pure Rust by default, with 18 bundled vocabularies and four backends covering BPE, SentencePiece and WordPiece. Its output matches Hugging Face tokenizers id for id on 14 model families, including GPT-2, Qwen, Whisper, T5 and BERT. Python bindings |
8,204 downloads over 30 days | 7 | 63 | 0.22.2 | GPU support unknown | Binds native code: pcre2-sys (feature pcre2) | MIT |
|
Collection of algorithms for keyword extraction from text |
2,311 downloads over 30 days | 2 | 34 | 1.5.0 | GPU support unknown | No native code found | LGPL-3.0-or-later |
Why ListedNo archive, New or Featured rule places it, so it is Listed.
What it lacks for Featured
- It has 2 active dependents and 2 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days. The repository route reads 19 stars, 5 forks and 1 contributor. It needs 4,539 stars, 434 forks and 79 contributors together.
- The project is dormant and not finished. Dormancy rule
What else the check found
- The last activity is on 27 Jun 2024, 865 days ago. That reaches the 365 days the rules expect, so the project is dormant. Dormancy rule
- The oldest outside issue waits 378 days for a reply, past the limit of 270. No maintainer replied in 365 days. Rot signals rule
Not measured: Latest release fails cargo check.
Exact rules: Listed, Featured library. The check on applied thresholds version 9.
Every rule outcome, as the check records it
expected-interval: version 0.4.0 base 140, raised to the 365-day floor: E = 365 daysdormancy: last activity 2024-06-27, 865 days ago, E = 365: dormantrot: oldest unanswered issue 378 days (limit 270), no maintainer reply in 365 daysfeatured: not featured: active_users 2 < 11 and new_adopters 2 < 9 and repository route stars 19 (needs 4539), forks 5 (needs 434), contributors 1 (needs 79); dormant and not stablelisted: listed: no archive, new or featured rule applies
Measurements and sources
Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.
Sources6 sources
- Description: the crates.io description
- crates.io database dump, fetched
- RustSec advisory database, fetched
- GitHub repository, fetched
- crates.io package, fetched
- GitHub contributors, fetched
Adoption2 active dependents, 2 new dependents in 365 days1 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Active dependents | 2 | crates.io database dump | Yes | |
| New dependents (365 days) | 2 | crates.io database dump | Yes | |
| Peak active dependents | 2 | crates.io database dump | Yes | |
| Active dependents as a share of the peak | 1 | crates.io database dump | Yes | |
| Binary downloads per release | Not measured | Yes |
MaintenanceLatest human commit: 2 years ago3 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Latest human commit | 2024-06-27 | GitHub repository | Yes | |
| Latest release | 2024-06-27 | crates.io database dump | Yes | |
| First release | 2024-05-02 | crates.io database dump | Yes | |
| Latest version | 0.4.0 | crates.io database dump | Yes | |
| Days the oldest outside issue waits for a reply | 378 | GitHub repository | Yes | |
| Maintainer replies over 365 days | 0 | GitHub repository | Yes | |
| Repository archived | false | GitHub repository | Yes | |
| Repository gone | false | GitHub repository | Yes | |
| Release commit or manifest in the repo | true | crates.io package | Yes | |
| Published docs | true | crates.io database dump | Yes | |
| Latest release fails cargo check | Not measured | Yes | ||
| Build check date | Not measured | Yes | ||
| Build check toolchain | Not measured | Yes |
SecurityUnpatched vulnerabilities: none
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Unpatched vulnerabilities past the grace window | none | RustSec advisory database | Yes | |
| RustSec unmaintained advisory | none | RustSec advisory database | Yes | |
| Deprecation notice | none | crates.io database dump | Yes | |
| Deprecated requirement | none | crates.io database dump | Yes |
Distribution4 releases, 5,962 downloads over 30 days5 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Releases | 4 | crates.io database dump | Yes | |
| Downloads over 30 days | 5962 | crates.io database dump | Yes | |
| Binary downloads over the last 3 releases | Not measured | Yes | ||
| Homebrew installs on request over 365 days | Not measured | Yes | ||
| Repology repository families | Not measured | Yes | ||
| Docker pull growth over 90 days | Not measured | Yes | ||
| Docker pulls at the growth baseline | Not measured | Yes | ||
| Every version a prerelease | false | crates.io database dump | Yes | |
| Every version 0.0.x | false | crates.io database dump | Yes | |
| Every version yanked | false | crates.io database dump | Yes | |
| Crate deleted from crates.io | false | crates.io database dump | Yes |
Repository19 stars, 5 forks, 1 contributors, 114 commits. Stars alone never qualify a project.
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| GitHub stars | 19 | GitHub repository | Yes — one part of the repository route | |
| GitHub forks | 5 | GitHub repository | Yes — one part of the repository route | |
| Contributors with a GitHub account | 1 | GitHub contributors | Yes — one part of the repository route | |
| Commits on the default branch | 114 | GitHub repository | No | |
| Repository's main crate left out of the entry | none | crates.io database dump | Yes |
Facts that never count
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| License | BSD-3-Clause | crates.io database dump | No | |
| Runs on, from listed crates and their direct dependencies | GPU support unknown | crates.io database dump | No | |
| What shows each backend | no dependency or feature matches a backend row | crates.io database dump | No | |
| Native code, from listed crates and their dependencies | No native code found | crates.io database dump | No | |
| Python bindings, from direct dependencies of listed crates | No Python binding crate found | crates.io database dump | No | |
| Crates that depend on a listed crate directly | 3 | crates.io database dump | No |
Corrections and review history
No correction applies to this entry.
Judgments
A judgment enters only through an approved issue and a merged pull request.
No judgment applies to this entry.