rsnltk
Library Listed Dormant
Rust-based Natural Language Toolkit
- Downloads
- 0
- Dependents
- 0
- Stars
- 32
- Forks
- 2
- Contributors
- 1
- Commits
- 24
- Latest release
- 0.1.3 ·
About
Rust-based Natural Language Toolkit (rsnltk)
A Rust library to support natural language processing with pure Rust implementation and Python bindings
Rust Docs | Crates Home Page | Tests | NER-Kit
Features
The rsnltk library integrates various existing Python-written NLP toolkits for powerful text analysis in Rust-based applications.
Functions
This toolkit is based on the Python-written Stanza and other important NLP crates.
A list of functions from Stanza and others we bind here include:
- Tokenize
- Sentence Segmentation
- Multi-Word Token Expansion
- Part-of-Speech & Morphological Features
- Named Entity Recognition
- Sentiment Analysis
- Language Identification
- Dependency Tree Analysis
Some amazing crates are also included in rsnltk but with simplified APIs for actual use:
Additionally, we can calculate the similarity between words based on WordNet though the semantic-kit PyPI project via pip install semantic-kit.
Read the full README
Installation
Make sure you install Python 3.6.6+ and PIP environment in your computer. Type
python -Vin the Terminal should print no error message;Install our Python-based ner-kit (version>=0.0.5a2) for binding the
Stanzapackage viapip install ner-kit==0.0.5a2;Then, Rust should be also installed in your computer. I use IntelliJ to develop Rust-based applications, where you can write Rust codes;
Create a simple Rust application project with a
main()function.Add the
rsnltkdependency to theCargo.tomlfile, keep up the Latest version.After you add the
rsnltkdependency in thetoml file, install necessary language models from Stanza using the following Rust code for the first time you use this package.
fn init_rsnltk_and_test(){
// 1. first install the necessary language models
// using language codes
let list_lang=vec!["en","zh"];
//e.g. you install two language models,
// namely, for English and Chinese text analysis.
download_langs(list_lang);
// 2. then do test NLP tasks
let text="I like Beijing!";
let lang="en";
// 2. Uncomment the below codes for Chinese NER
// let text="我喜欢北京、上海和纽约!";
// let lang="zh";
let list_ner=ner(text,lang);
for ner in list_ner{
println!("{:?}",ner);
}
}
Or you can manually install those language models via the Python-written ner-kit package which provides more features in using Stanza. Go to: ner-kit
If no error occurs in the above example, then it works. Finally, you can try the following advanced example usage.
Currently, we tested the use of English and Chinese language models; however, other language models should work as well.
Examples with Stanza Bindings
Example 1: Part-of-speech Analysis
fn test_pos(){
//let text="我喜欢北京、上海和纽约!";
//let lang="zh";
let text="I like apple";
let lang="en";
let list_result=pos(text,lang);
for word in list_result{
println!("{:?}",word);
}
}
Example 2: Sentiment Analysis
fn test_sentiment(){
//let text="I like Beijing!";
//let lang="en";
let text="我喜欢北京";
let lang="zh";
let sentiments=sentiment(text,lang);
for sen in sentiments{
println!("{:?}",sen);
}
}
Example 3: Named Entity Recognition
fn test_ner(){
// 1. for English NER
let text="I like Beijing!";
let lang="en";
// 2. Uncomment the below codes for Chinese NER
// let text="我喜欢北京、上海和纽约!";
// let lang="zh";
let list_ner=ner(text,lang);
for ner in list_ner{
println!("{:?}",ner);
}
}
Example 4: Tokenize for Multiple Languages
fn test_tokenize(){
let text="我喜欢北京、上海和纽约!";
let lang="zh";
let list_result=tokenize(text,lang);
for ner in list_result{
println!("{:?}",ner);
}
}
Example 5: Tokenize Sentence
fn test_tokenize_sentence(){
let text="I like apple. Do you like it? No, I am not sure!";
let lang="en";
let list_sentences=tokenize_sentence(text,lang);
for sentence in list_sentences{
println!("Sentence: {}",sentence);
}
}
Example 6: Language Identification
fn test_lang(){
let list_text = vec!["I like Beijing!",
"我喜欢北京!",
"Bonjour le monde!"];
let list_result=lang(list_text);
for lang in list_result{
println!("{:?}",lang);
}
}
Example 7: MWT expand
fn test_mwt_expand(){
let text="Nous avons atteint la fin du sentier.";
let lang="fr";
let list_result=mwt_expand(text,lang);
}
Example 8: Estimate the similarity between words in WordNet
You need to firstly install semantic-kit PyPI package!
fn test_wordnet_similarity(){
let s1="dog.n.1";
let s2="cat.n.2";
let sims=wordnet_similarity(s1,s2);
for sim in sims{
println!("{:?}",sim);
}
}
Example 9: Obtain a dependency tree from a text
fn test_dependency_tree(){
let text="I like you. Do you like me?";
let lang="en";
let list_results=dependency_tree(text,lang);
for list_token in list_results{
for token in list_token{
println!("{:?}",token)
}
}
}
Examples in Pure Rust
Example 1: Word2Vec similarity
fn test_open_wv_bin(){
let wv_model=wv_get_model("GoogleNews-vectors-negative300.bin");
let positive = vec!["woman", "king"];
let negative = vec!["man"];
println!("analogy: {:?}", wv_analogy(&wv_model,positive, negative, 10));
println!("cosine: {:?}", wv_cosine(&wv_model,"man", 10));
}
Example 2: Text summarization
use rsnltk::native::summarizer::*;
fn test_summarize(){
let text="Some large txt...";
let stopwords=&[];
let summarized_text=summarize(text,stopwords,5);
println!("{}",summarized_text);
}
Example 3: Get token list from English strings
use rsnltk::native::token::get_token_list;
fn test_get_token_list(){
let s="Hello, Rust. How are you?";
let result=get_token_list(s);
for r in result{
println!("{}\t{:?}",r.text,r);
}
}
Example 4: Word segmentation for some language where no space exists between terms, e.g. Chinese text.
We implement three word segmentation methods in this version:
- Forward Maximum Matching (fmm), which is baseline method
- Backward Maximum Matching (bmm), which is considered better
- Bidirectional Maximum Matching (bimm), high accuracy but low speed
use rsnltk::native::segmentation::*;
fn test_real_word_segmentation(){
let dict_path="30wdict.txt"; // empty if only for tokenizing
let stop_path="baidu_stopwords.txt";// empty when no stop words
let _sentence="美国太空总署希望,在深海的探险发现将有助于解开一些外太空的秘密,\
同时也可以测试前往太阳系其他星球探险所需的一些设备和实验。";
let meaningful_words=get_segmentation(_sentence,dict_path,stop_path, "bimm");
// bimm can be changed to fmm or bmm.
println!("Result: {:?}",meaningful_words);
}
Credits
Thank Stanford NLP Group for their hard work in Stanza.
License
The rsnltk library with MIT License is provided by Donghua Chen.
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
- Has Python bindings
- rsnltk needs Python
- License
- MIT
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 |
|---|---|---|---|---|---|---|---|
|
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 |
|
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 |
|
Natural Language Processing for Rust |
Not measured | Not applicable | 236 | Not measured | Not measured | Not measured | MIT |
Why ListedNo archive, New or Featured rule places it, so it is Listed.
What it lacks for Featured
- It has 0 active dependents and 0 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days. The repository route reads 32 stars, 2 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 4 Feb 2022, 1739 days ago. That reaches the 365 days the rules expect, so the project is dormant. Dormancy rule
- The oldest outside issue waits 523 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.1.3 base 300, capped at 4 releases = 200, raised to the 365-day floor: E = 365 daysdormancy: last activity 2022-02-04, 1739 days ago, E = 365: dormantrot: oldest unanswered issue 523 days (limit 270), no maintainer reply in 365 daysfeatured: not featured: active_users 0 < 11 and new_adopters 0 < 9 and repository route stars 32 (needs 4539), forks 2 (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
Adoption0 active dependents, 0 new dependents in 365 days1 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Active dependents | 0 | crates.io database dump | Yes | |
| New dependents (365 days) | 0 | crates.io database dump | Yes | |
| Peak active dependents | 0 | 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: 4 years ago3 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Latest human commit | 2022-02-04 | GitHub repository | Yes | |
| Latest release | 2022-02-02 | crates.io database dump | Yes | |
| First release | 2022-02-01 | crates.io database dump | Yes | |
| Latest version | 0.1.3 | crates.io database dump | Yes | |
| Days the oldest outside issue waits for a reply | 523 | 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, 0 downloads over 30 days5 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Releases | 4 | crates.io database dump | Yes | |
| Downloads over 30 days | 0 | 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 |
Repository32 stars, 2 forks, 1 contributors, 24 commits. Stars alone never qualify a project.
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| GitHub stars | 32 | GitHub repository | Yes — one part of the repository route | |
| GitHub forks | 2 | 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 | 24 | 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 | MIT | 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 | Has Python bindings: rsnltk needs Python | crates.io database dump | No | |
| Crates that depend on a listed crate directly | 0 | 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.