#readability #nlp #text #variety #formulas #complexity #index

rust_readability

A package to assess the complexity of texts using a variety of readability formulas

3 releases

0.1.2 Oct 3, 2022
0.1.1 Sep 5, 2022
0.1.0 Aug 29, 2022

#1061 in Text processing

Download history 14/week @ 2024-02-22 13/week @ 2024-02-29 59/week @ 2024-03-07

86 downloads per month

GPL-3.0-or-later

15KB
261 lines

rust_readability

A package to assess the complexity of texts using a variety of readability formulas, written in Rust. The package includes implementations of the Lix, Rix, Flesch, Flesch-Kincaid, Coleman-Liau, and Automated Readability Index methods.

How to Use

The package includes functions for the Lix, Rix, Flesch, Flesch-Kincaid, Coleman-Liau, and Automated Readability Index methods. Each function prints and returns its corresponding readability index. Call each method on a file or string like so:

use rust_readability::lix;

lix("path/to/file.txt");
// or, for a string: lix_string("your string");

To remove stopwords before assessing the readability of a text, use the functions stopwords_file (to remove stopwords from a file) and stopwords_string (to remove stopwords from a string), like so:

use rust_readability::stopwords_string;
stopwords_string("this is an example string", "[your language]");

use rust_readability::stopwords_file;
stopwords_file("path/to/file.txt", "[your language]");

All languages included in NLTK's stopwords lists can be used.

The full list of function names is as follows:

lix("path/to/file.txt");
rix("path/to/file.txt");
flesch("path/to/file.txt");
flesch_kincaid("path/to/file.txt");
coleman_liau("path/to/file.txt");
ari("path/to/file.txt");

And for strings:

lix_string("your string");
rix_string("your string");
flesch("your string");
flesch_kincaid("your string");
coleman_liau("your string");
ari("your string");

Dependencies

~15MB
~147K SLoC