Every time you type on a phone or a computer, something in the software decides whether each word looks right. A naive spellchecker would keep the entire dictionary in memory and look each word up. That works — but a standard English dictionary has hundreds of thousands of entries, and on early hardware (or on a microcontroller today) even that lookup table is a luxury.
In 1970, Burton Howard Bloom published a two-page paper that made the tradeoff explicit: you can check membership in a set using a tiny fraction of the memory, as long as you accept a small probability of a false positive — calling a valid word incorrect when it isn't.
The data structure he proposed, now called a Bloom filter, works by hashing each dictionary word through several independent hash functions and turning on the corresponding bits in a compact array. Checking a query word runs the same hashes; if any bit is off, the word is definitely not in the dictionary. If all bits are on, the word is probably in the dictionary — but it might be a false positive, a word whose hash pattern happens to overlap with dictionary entries.
The crucial property is that false negatives are impossible: a word that is in the dictionary will always pass. The filter may occasionally flag a valid word as a typo, but it will never let a genuine typo slip through undetected. That asymmetry makes Bloom filters ideal for spellchecking.
Comments
Loading comments...