DevJuice: Spellchecking short strings
I've been working on updating my UIColor utilities as part of building a color-sampling app. Stumbling across this survey, I decided to add the xkcd colors to my repository, along with code that matched colors to their nearest xkcd equivalents.
What I found is that as delightful as the sourced color descriptions are, that they were rather full of misspellings, for example "urple."
So I put together a simple NSString category to find misspellings and "creatively" described colors. I found this approach to be useful enough that I decided to share it on a DevJuice.
Normally, you use text checkers to find misspellings in text view and fields, and to present those items to the user. But you're certainly not limited to that scenario. This simple string category lets you test whether a misspelled word was found, enabling me to automate my inspection.
I loaded up the xkcd names as an array and searched them to find any potential errors. Out of nearly a thousand color names, it quickly flagged about two dozen issues -- saving a huge amount of detail checking.
This doesn't of course, guarantee the correctness of my results. I know I left in a few amusing misspellings: "Blurple," for example, plus if any misspellings ended up as a legal English word, they will not have been flagged.
What's more, I had to bowdlerize some entries. Apple does not have any "offensive language" tester that I could find. (Know of one? Please ping me about it!) So I had to update those items by hand.
In any case, I hope you'll find this useful. Happy coding!
Subscribe to Newsletter
Software Updatesmore updates
- Vizzywig 8xHD price tag now a very affordable $49.99
- Automatic targets teen drivers with License+ service
- Dropbox adds support for TouchID
- YouTube for iOS gets updated with full support for iPhone 6 and 6 Plus
- iOS 8.0.1 update now available (Updated -- Don't update!)
- NFL Mobile updated for 2014 Season with new Fantasy Football features, NFL Now integration