Skip to content

Count the words and characters, with or without whitespaces.

License

Notifications You must be signed in to change notification settings

magiclen/words-count

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Words Count

CI

Count the words and characters, with or without whitespaces.

The algorithm is roughly aligned with the way LibreOffice is counting words. This means that it does not exactly match the Unicode Text Segmentation standard.

Examples

use words_count::WordsCount;

assert_eq!(WordsCount {
    words: 20,
    characters: 31,
    whitespaces: 2,
    cjk: 18,
}, words_count::count("Rust是由 Mozilla 主導開發的通用、編譯型程式語言。"));
let result = words_count::count_separately("apple banana apple");

assert_eq!(2, result.len());
assert_eq!(Some(&2), result.get("apple"));

Crates.io

https://crates.io/crates/words-count

Documentation

https://docs.rs/words-count

License

MIT

About

Count the words and characters, with or without whitespaces.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages