reading-time
Estimate how long a text takes to read.
Counts the words in a text and estimates reading time, with sensible handling of CJK
characters (each counts as a word, and trailing punctuation is absorbed). A faithful Rust
port of the widely-used reading-time npm
package — handy for blogs, CMSs, and feeds.
- Zero dependencies
- Word count, minutes, milliseconds, and a
"N min read"summary - CJK / Hiragana / Hangul aware
- Differential-tested against the reference
reading-timeimplementation (60k cases)
Install
[]
= "0.1"
Usage
use ;
let result = reading_time;
assert_eq!;
assert_eq!;
// Custom words-per-minute (default 200):
let slow = reading_time_with;
assert_eq!;
assert_eq!;
The returned [ReadingTime] exposes text, minutes (fractional), time (milliseconds),
and words.
Contributors ✨
This project follows the all-contributors specification. Contributions of any kind are welcome — code, docs, bug reports, ideas, reviews! See the emoji key for how each contribution is recognized, and open a PR or issue to get involved.
Thanks goes to these wonderful people:
License
Licensed under either of MIT or Apache-2.0 at your option.