#tally #words #count #word-count #cli #input-file

bin+lib word-tally

Output a tally of the number of times unique words appear in source input

8 releases (4 breaking)

new 0.5.1 Jun 6, 2024
0.5.0 May 24, 2024
0.4.0 May 23, 2024
0.3.2 May 21, 2024
0.1.0 May 16, 2024

#318 in Text processing

Download history 279/week @ 2024-05-12 653/week @ 2024-05-19 23/week @ 2024-05-26

955 downloads per month

MIT license

17KB
253 lines

word-tally

Crates.io docs.rs GitHub Actions Workflow Status

Output a tally of the number of times unique words appear in source input.

Usage

Usage: word-tally [OPTIONS] [INPUT]

Arguments:
  [INPUT]  File path to use as input rather than stdin ("-") [default: -]

Options:
  -s, --sort <ORDER>       Sort order [default: desc] [possible values: desc, asc, unsorted]
  -c, --case <FORMAT>      Case normalization [default: lower] [possible values: original, upper, lower]
  -m, --min-chars <COUNT>  Exclude words that contain fewer than min chars [default: 1]
  -M, --min-count <COUNT>  Exclude words that appear fewer than min times [default: 1]
  -D, --delimiter <VALUE>  Delimiter between keys and values [default: " "]
  -o, --output <PATH>      Write output to file rather than stdout
  -v, --verbose            Print verbose details
  -d, --debug              Print debugging information
  -h, --help               Print help
  -V, --version            Print version

Examples

> word-tally README.md | head -n6
tally 9
word 8
input 5
default 4
print 4
output 4
> word-tally --delimiter="," --output="tally.csv" README.md

Installation

cargo install word-tally

Documentation

https://docs.rs/word-tally

Tests

git clone https://github.com/havenwood/word-tally
cd word-tally
cargo test

Dependencies

~1.9–2.6MB
~45K SLoC