Shotnest

Shotnest · Library

Compare text with repeated spaces

Red blue with two spaces is not exactly equal to Red blue, but both collapse to red blue, so normalized equality is Yes and the token overlap is 1.

Three levels of sameness

Exactly equal compares the raw strings character by character, so a second space makes Red blue different from Red blue. Equal after normalization first lowercases and folds accents, then replaces every run of spaces, tabs or line breaks with one space and trims both ends. Both inputs become red blue. Token overlap then compares the distinct words, here an identical set, giving 1.

The same collapse explains other pairs. A tab and a trailing line break, as in Red, tab, blue, newline, normalize to red blue as well. Café and cafe also become equal, because accent folding happens before whitespace is collapsed.

The letter table used by search runs here as well, so full-width letters and the ideographic space are converted before whitespace is collapsed: RED BLUE normalizes to red blue and is equal to it.

Try the original example

First text
Red blue
Second text
Red blue
Exactly equal
No
Equal after normalization
Yes
Token overlap
1

Decide whether spacing matters

  1. Read Exactly equal first; No means at least one character differs.
  2. Read Equal after normalization; Yes means the difference was case, accents or whitespace.
  3. Ask whether the layout carries meaning, as it does in code, poetry or a table.
  4. If it does, compare the original screenshots rather than the extracted text.
Red, tab, blue, newline vs red blue · normalized
Yes
Café vs cafe · exact
No
Café vs cafe · normalized
Yes

Mistakes with collapsed spacing

Equal text, possibly different pictures

Normalized equality describes the extracted words only. Two screenshots with equal text can still differ in layout, colour or a detail that text recognition missed.

In Shotnest's cleanup the text check uses letter-only words, so digits are ignored there as well; the picture fingerprint is what separates two near-identical screens.

Tools