Word frequency counter
Count how often each word appears in a text and list the most common ones, optionally skipping stop words.
Input
Result
Fill in the input and press Run.
Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.
Use it from code or an agent
curl -s https://setget.net/v1/tools/word-frequency \
-H 'Content-Type: application/json' \
-d '{"input":{"text":"the cat and the hat and the bat","top":2}}'
import json, urllib.request
body = {'input': {'text': 'the cat and the hat and the bat', 'top': 2}}
request = urllib.request.Request("https://setget.net/v1/tools/word-frequency", json.dumps(body).encode(),
{"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/word-frequency", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({"input":{"text":"the cat and the hat and the bat","top":2}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
"slug": "word-frequency",
"input": {
"text": "the cat and the hat and the bat",
"top": 2
}
}
{
"input": {
"text": "the cat and the hat and the bat",
"top": 2
}
}
Endpoint: POST /v1/tools/word-frequency. Over MCP: run_tool with slug: "word-frequency".
Machine-readable: input schema, Markdown. Connect an agent.
Inputs
| Name | Type | Required | What it does |
|---|---|---|---|
text |
string | yes | The text to analyse. |
top |
integer | no | How many words to list. Default: 10. From 1 to 1000. |
min_length |
integer | no | Ignore words shorter than this many characters. Default: 1. From 1 to 100. |
case_sensitive |
boolean | no | Count "Word" and "word" separately. Default: false. |
ignore_stop_words |
boolean | no | Leave out common English words such as "the", "and" and "of". Default: false. |
Examples
Input
{
"text": "the cat and the hat and the bat",
"top": 2
}Result
{
"words": [
{
"word": "the",
"count": 3
},
{
"word": "and",
"count": 2
}
],
"total_words": 8,
"unique_words": 5
}Without stop words
Input
{
"text": "The cat and the hat and the bat",
"ignore_stop_words": true
}Result
{
"words": [
{
"word": "cat",
"count": 1
},
{
"word": "hat",
"count": 1
},
{
"word": "bat",
"count": 1
}
],
"total_words": 3,
"unique_words": 3
}Questions
- What counts as a word?
- A run of letters or digits. Apostrophes inside a word are kept, so "don't" is one word; "well-known" counts as two.
- How are ties ordered?
- Words with the same count are listed in the order they first appear in the text.
- What do the totals cover?
- total_words and unique_words count the words left after the min_length and stop-word filters.
Related tools
- Word and character counterCount characters, words, lines, sentences, paragraphs and UTF-8 bytes in a text.
text-count - Readability scoreScore English text with Flesch reading ease and Flesch-Kincaid grade, with a plain-language verdict.
readability-score - Remove duplicate linesRemove repeated lines from text, keeping the first occurrence of each and the original order.
dedupe-lines - Apply a patchApply a unified diff to a text and get the patched result, with clear errors when a hunk does not fit.
patch-apply - Case converterConvert text between lower, UPPER, Title, Sentence, camelCase, PascalCase, snake_case, kebab-case and more.
case-convert - Escape and unescape textEscape or unescape text for HTML, URLs, JSON strings, shell commands, regular expressions and CSV fields.
escape-unescape