piapia123
en

Occurrence Counter

Text

Everything runs locally in your browser — nothing is uploaded

Input
Drop a file here to load its contents
Output

Which things appear how often? Four measures answer the same question, changing only the size of the thing: characters (which ones you lean on), words (split on whitespace), lines (which line repeats), and given strings (how often the few terms I care about show up). Invisible characters need a label you can read. Used directly as a label, a space produces a row that says “12 times” with no hint of what was counted. So those get a symbol plus a name — `␠ space`, `⇥ tab`, `↵ line break` — where the symbol is universal and the name follows the interface language. Occurrences are counted without overlap. Looking for `aa` inside `aaaa` gives 2, not 3, which is the standard in text search. The ordering is deterministic too: by count descending, then by character ascending. Ordering by first appearance would let the same data come out in a different order on a second run, and you would think the text had changed. The result is a label-and-value table where every row can be copied on its own.

Features

  • Four measures: characters, words, lines and given strings
  • Sorted by count descending, then by character ascending, so the order is stable
  • Every frequency row carries a relative bar (normalised to the highest item in the tally) plus its share, with the top 10 grouped separately
  • Spaces, tabs, line breaks and the ideographic space get a symbol plus a name
  • Every character, word or line has its own copy button
  • Optionally list only items appearing at least N times, or cap the list and say how many were left out
  • Case can be ignored, while the label still shows your original spelling
  • Given strings are counted without overlap, and a repeated target is only counted once
  • The result is an aligned table you can copy whole or row by row
  • Everything runs locally in your browser; nothing is uploaded

How to use

  1. Paste the text you want to count
  2. Choose the measure: characters, words, lines, or your own strings
  3. Optionally filter out the long tail with a minimum count
  4. Copy a single row, or copy the whole table

FAQ

How many times does `aa` appear in `aaaa`?
Twice, not three times. Counting is non-overlapping: after finding the first `aa` the search continues from the end of it, so the second `a` is not reused. That is the usual convention in text search — a find-all in an editor and `grep -o` behave the same way. Overlapping counting would give 3; both are defensible, which is exactly why the convention is spelled out here.
Can it count Chinese text by word?
No. The word measure splits on whitespace, and Chinese prose has no spaces, so a whole sentence comes out as one word and every row shows a count of 1. Use the character measure for Chinese instead: a Chinese character is itself a meaningful unit, and which characters you lean on is what a writer actually wants to know. Counting Chinese by word needs a segmentation dictionary, which this tool deliberately does not ship.
Are blank lines counted?
No. Blank lines are excluded from the line count — there is nothing in them to look at, and “this text contains 12 blank lines” is not what anyone opens this page to find out. If you do need that number, run the text cleaner with Remove blank lines on and compare the line counts before and after.
Why is the top bar full when the percentage is below 100%?
Because the two measure different things. The bar is normalised so that the most frequent item in the tally fills it completely — it answers only “which is more common, and by how much”, so the top item is always full no matter its actual share. The percentage is that item’s share of the total. In `aaab` the bar for `a` is full, yet it accounts for 75% of the text.

Related tools