rs-natural
App Listed Dormant
Natural Language Processing for Rust
- Downloads
- Not measured
- Dependents
- Not applicable
- Stars
- 236
- Forks
- 30
- Contributors
- 7
- Commits
- 97
About
Natural language processing library written in Rust. Still very much a work in progress. Basically an experiment, but hey maybe something cool will come out of it.
Currently working:
- Jaro-Winkler Distance
- Levenshtein Distance
- Tokenizing
- NGrams (with and without padding)
- Phonetics (Soundex)
- Naive-Bayes classification
- Serialization via Serde
- Term Frequency-Inverse Document Frequency(tf-idf)
- Serialization via Serde
Near-sight goals:
- Logistic regression classification
- Optimize naive-bayes (currently pretty slow)
- Plural/Singular inflector
How to use
Use at your own risk. Some functionality is missing, some other functionality is slow as molasses because it isn't optomized yet. I'm targeting master, and don't offer backward compatibility.
Setup
It's a crate with a cargo.toml. Add this to your cargo.toml:
[dependencies]
natural = "0.3.0"
# Or enable Serde support
natural = { version = "0.4.0", features = ["serde_support"]}
serde = "1.0"
Distance
extern crate natural;
use natural::distance::jaro_winkler_distance;
use natural::distance::levenshtein_distance;
assert_eq!(levenshtein_distance("kitten", "sitting"), 3);
assert_eq!(jaro_winkler_distance("dixon", "dicksonx"), 0.767);
Read the full README
Note, don't actually assert_eq! on JWD since it returns an f64. To test, I actually use:
fn f64_eq(a: f32, b: f32) {
assert!((a - b).abs() < 0.01);
}
Phonetics
There are two ways to gain access to the SoundEx algorithm in this library, either through a simple soundex function that accepts two &str parameters and returns a boolean, or through the SoundexWord struct. I will show both here.
use natural::phonetics::soundex;
use natural::phonetics::SoundexWord;
assert!(soundex("rupert", "robert"));
let s1 = SoundexWord::new("rupert");
let s2 = SoundexWord::new("robert");
assert!(s1.sounds_like(s2));
assert!(s1.sounds_like_str("robert"));
Tokenization
extern crate natural;
use natural::tokenize::tokenize;
assert_eq!(tokenize("hello, world!"), vec!["hello", "world"]);
assert_eq!(tokenize("My dog has fleas."), vec!["My", "dog", "has", "fleas"]);
NGrams
You can create an ngram with and without padding, e.g.:
extern crate natural;
use natural::ngram::get_ngram;
use natural::ngram::get_ngram_with_padding;
assert_eq!(get_ngram("hello my darling", 2), vec![vec!["hello", "my"], vec!["my", "darling"]]);
assert_eq!(get_ngram_with_padding("my fleas", 2, "----"), vec![
vec!["----", "my"], vec!["my", "fleas"], vec!["fleas", "----"]]);
Classification
extern crate natural;
use natural::classifier::NaiveBayesClassifier;
let mut nbc = NaiveBayesClassifier::new();
nbc.train(STRING_TO_TRAIN, LABEL);
nbc.train(STRING_TO_TRAIN, LABEL);
nbc.train(STRING_TO_TRAIN, LABEL);
nbc.train(STRING_TO_TRAIN, LABEL);
nbc.guess(STRING_TO_GUESS); //returns a label with the highest probability
Tf-Idf
extern crate natural;
use natural::tf_idf::TfIdf;
tf_idf.add("this document is about rust.");
tf_idf.add("this document is about erlang.");
tf_idf.add("this document is about erlang and rust.");
tf_idf.add("this document is about rust. it has rust examples");
println!(tf_idf.get("rust")); //0.2993708f32
println!(tf_idf.get("erlang")); //0.13782766f32
//average of multiple terms
println!(tf_idf.get("rust erlang"); //0.21859923
Compatibility
- License
- MIT
- Crate facts
- Not measured
- Runs on, Native code and Python bindings read crates on crates.io. This entry lists no crate.
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 |
|---|---|---|---|---|---|---|---|
|
Natural Language Processing for Rust |
Not measured | Not applicable | 236 | Not measured | Not measured | Not measured | MIT |
|
whatlang-rs Featured
Fast and lightweight language identification library for Rust. |
882,019 downloads over 30 days | 74 | 1,087 | 0.18.0 | GPU support unknown | No native code found | MIT |
|
lingua-rs Featured
An accurate natural language detection library, suitable for short text and mixed-language text Python bindings |
286,625 downloads over 30 days | 22 | 1,152 | 1.8.0 | GPU support unknown | Binds native code: cld2-sys (feature accuracy-reports) | Apache-2.0 |
|
whichlang Listed
A blazingly fast and lightweight language detection library for Rust. |
52,880 downloads over 30 days | 11 | 464 | 0.1.1 | GPU support unknown | No native code found | MIT |
|
A fast, low-resource Natural Language Processing and Error Correction library. |
8,412 downloads over 30 days | 6 | 679 | 0.6.4 | GPU support unknown | Binds native code: onig_sys (feature regex-onig) | Apache-2.0 OR MIT |
|
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 |
|
Rust-based Natural Language Toolkit Python bindings |
0 downloads over 30 days | 0 | 32 | 0.1.3 | GPU support unknown | No native code found | MIT |
Why ListedNo archive, New or Featured rule places it, so it is Listed.
What it lacks for Featured
- The project is dormant and not finished. Dormancy rule
What else the check found
- The last activity is on 13 Feb 2020, 2461 days ago. That reaches the 365 days the rules expect, so the project is dormant. Dormancy rule
- The oldest outside issue waits 3372 days for a reply, past the limit of 270. No maintainer replied in 365 days. Rot signals rule
Not measured: Latest release, Unpatched vulnerabilities past the grace window, First release.
Exact rules: Listed, Featured app. The check on applied thresholds version 9.
Every rule outcome, as the check records it
expected-interval: app: E = 365 daysdormancy: last activity 2020-02-13, 2461 days ago, E = 365: dormantrot: oldest unanswered issue 3372 days (limit 270), no maintainer reply in 365 daysfeatured: not featured: 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.
Sources4 sources
- Description: the GitHub repository description
- GitHub repository, fetched
- GitHub releases, fetched
- GitHub contributors, fetched
AdoptionNot measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Active dependents | Not measured | Yes | ||
| New dependents (365 days) | Not measured | Yes | ||
| Peak active dependents | Not measured | Yes | ||
| Active dependents as a share of the peak | Not measured | Yes | ||
| Binary downloads per release | Not measured | Yes |
MaintenanceLatest human commit: 6 years ago8 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Latest human commit | 2020-02-13 | GitHub repository | Yes | |
| Latest release | Not measured | Yes | ||
| First release | Not measured | Yes | ||
| Latest version | Not measured | Yes | ||
| Days the oldest outside issue waits for a reply | 3372 | 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 | Not measured | Yes | ||
| Published docs | Not measured | Yes | ||
| Latest release fails cargo check | Not measured | Yes | ||
| Build check date | Not measured | Yes | ||
| Build check toolchain | Not measured | Yes |
SecurityNot measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Unpatched vulnerabilities past the grace window | Not measured | Yes | ||
| RustSec unmaintained advisory | Not measured | Yes | ||
| Deprecation notice | Not measured | Yes | ||
| Deprecated requirement | Not measured | Yes |
Distribution0 binary downloads over the last 3 releases10 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Releases | Not measured | Yes | ||
| Downloads over 30 days | Not measured | Yes | ||
| Binary downloads over the last 3 releases | 0 | GitHub releases | 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 | Not measured | Yes | ||
| Every version 0.0.x | Not measured | Yes | ||
| Every version yanked | Not measured | Yes | ||
| Crate deleted from crates.io | Not measured | Yes |
Repository236 stars, 30 forks, 7 contributors, 97 commits. Stars alone never qualify a project.1 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| GitHub stars | 236 | GitHub repository | Yes — one part of the repository route | |
| GitHub forks | 30 | GitHub repository | Yes — one part of the repository route | |
| Contributors with a GitHub account | 7 | GitHub contributors | Yes — one part of the repository route | |
| Commits on the default branch | 97 | GitHub repository | No | |
| Repository's main crate left out of the entry | Not measured | Yes |
Facts that never count
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| License | MIT | GitHub repository | No | |
| Runs on, from listed crates and their direct dependencies | Not measured | No | ||
| What shows each backend | Not measured | No | ||
| Native code, from listed crates and their dependencies | Not measured | No | ||
| Python bindings, from direct dependencies of listed crates | Not measured | No | ||
| Crates that depend on a listed crate directly | Not measured | 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.