word-letter-frequency
by @simmusjune
Count how many times each letter appears in a word or short phrase. Trigger when a user asks for per-letter frequencies, distributions, or statistics inside...
clawhub install word-letter-frequency๐ About This Skill
name: word-letter-frequency description: Count how many times each letter appears in a word or short phrase. Trigger when a user asks for per-letter frequencies, distributions, or statistics inside a single word or very short string.
Word Letter Frequency
Quick start
1. Identify the input text (typically one word or a short phrase). Default behavior lowercases the text and ignores non-letters so repeated letters likea/A are merged.
2. Run scripts/count_letters.py "" to get a frequency table. Use the optional flags when needed:
- --case-sensitive keeps uppercase and lowercase separate.
- --include-non-alpha counts digits/punctuation as-is.
- --json returns machine-friendly JSON for downstream processing.
3. Summarize the counts for the user. Include clarifying notes (e.g., whether you ignored punctuation) when relevant.Script reference
scripts/count_letters.py
Lightweight CLI/utility that powers this skill. It exposes two layers:python3 scripts/count_letters.py "balloon" --jsonfrom scripts.count_letters import count_letters and call count_letters(text, case_sensitive=False, include_non_alpha=False) to get a collections.Counter.Sample CLI output (default options):
$ python3 scripts/count_letters.py "balloon"
Character Count
--------- -----
a 1
b 1
l 2
o 2
n 1
Sample JSON output (good for embedding directly into responses):
$ python3 scripts/count_letters.py "AaB!" --case-sensitive --include-non-alpha --json
{"A": 1, "a": 1, "B": 1, "!": 1}
Response patterns
balloon contains bร1, aร1, lร2, oร2, nร1 (case-insensitive, punctuation ignored).โ--json flag.Edge cases & tips
--include-non-alpha is not set, the script intentionally reports โ(no characters were counted)โ. Explain why in the response.๐ก Examples
1. Identify the input text (typically one word or a short phrase). Default behavior lowercases the text and ignores non-letters so repeated letters like a/A are merged.
2. Run scripts/count_letters.py " to get a frequency table. Use the optional flags when needed:
- --case-sensitive keeps uppercase and lowercase separate.
- --include-non-alpha counts digits/punctuation as-is.
- --json returns machine-friendly JSON for downstream processing.
3. Summarize the counts for the user. Include clarifying notes (e.g., whether you ignored punctuation) when relevant.