Sentence Stats is a Go tool for visualizing character and character pair frequencies in sentences. It generates histogram plots to help analyze the composition of text.
- Character Frequency: Visualizes the frequency of each character in the input text.
- Character Pair Frequency: Visualizes the frequency of character pairs (bigrams), ignoring order (e.g., "ab" and "ba" are counted together).
- Sentence-based Analysis: Processes input sentence by sentence (split by '.').
Ensure you have Go installed (version 1.22+).
go install github.com/arran4/sentencestats/cmd/characters@latest
go install github.com/arran4/sentencestats/cmd/character-pairs@latestThe tools read from standard input and output a PNG file.
echo "This is an example. This is also a test. This is also a demo." | characters -o characters-example.pngOutput:
echo "This is an example. This is also a test. This is also a demo." | character-pairs -o character-pairs-example.pngOutput:
To run the tools from source:
go run ./cmd/characters/ -o out.png < input.txt
go run ./cmd/character-pairs/ -o out.png < input.txtTo run tests:
go test ./...
