Needing to target typo’s is a common problem but coming up with lists of them is hard to do. I looked around and there were several good tools out there already but none offered the source code so I could use it in other things. I went ahead and wrote a class in PHP to generate common typos.
Check it out here in the free webmaster scripts section.
Typo Types that are created include:
- striking the wrong key thats near your intended key
- missing a character when you type
- a single transposition error
- and entering a key twice
The keyboard I based this one is the type used for American English and the only included keystrike typoes it generates are those that would make valid domain names. One of these days I am going to add typos based on similiar phonetics.
Like it? Subscribe to the blog if you haven't already
| Filed under: Content Creation, General, Tools, Web Technologies — Scott @ March 16, 2006 4:50 pm |
|





First off, this code looks great. The problem I’m running into is getting it to display, ie. what HTML are you using to display the contents. I’ve added:
Typo Generator
before your code, but it doesn’t show all the results that you show and shows some strange messages. My sample is here:
http://www.1hs.org/beta/typo.php?word=dell
Thanks!
Eric Unangst
lastname@gmail.com
Ok, so WP “ate my html”. My real questions are “What HTML are you using to display the contents?” and ” Can I get rid of the ‘Array ( [0]‘ that’s showing and show all output as you did?”
Thanks!
Eric Unangst
TechKid.org
lastname@gmail.com
Eric your comment had a link so it was put in moderation, awainting my approval, it helps discourage spammers. Your using a print_r which prints out the contents of an array or object. Instead you need to take the array returned and for a foreach on it to iterate over the values.
Ok, here’s the code I was trying to use:
http://www.1hs.org/beta/typo.php.txt
Eric check this out:
http://us2.php.net/foreach
You need to use a foreach function to do what you want.
Thanks Scott. I’m still at a loss with the foreach command. I can’t get it to display the results and the most that I could display using foreach (after an hour) was the $word.
But, I’m cutting my losses on that front because I realized that what I was actually trying to do is push all the results into the address bar via a form; typos separated by a ‘+’ (plus) or ‘,’ (comma)… IE typo.php?keyword=dell+ell+dll…
for typos of the word ‘dell’
If you take a peak at:
http://www.1hs.org/beta/typo.php?keyword=dell
you’ll see what (and WHY) I’m trying…. Take a peek at that 8th line.
Thanks again for the help.
BTW, I used your Text2Image form yesterday to create: http://www.1hs.org/beta/fakereceipts/
as a fun ‘proof of concept’ for April 1st.
“Take a peek at that 8th line…”
refers to the updated file at
http://www.1hs.org/beta/typo.php.txt
Scott, it seem’s only work on php 5 ?
Yeah Alex that came up recently sorry about that I’ll update the entry.