48 comments

[ 3.3 ms ] story [ 49.6 ms ] thread
A basic spellchecker is extremely simple to implement:

http://norvig.com/spell-correct.html

An instance with a similar code could be run, say, at Heroku (it would even be for free for the low traffic) with, say, a Flask wrapper:

http://flask-restful.readthedocs.org/en/latest/api.html

If the output format is reproduced, all it would take is changing the reference url.

Good idea if someone has a large amount of WP installs (for clients, etc)..
>A basic spellchecker is extremely simple to implement

That reminds me of this article: http://prog21.dadgum.com/29.html "A Spellchecker Used to Be a Major Feat of Software Engineering"

Every time I read a norvig article I can feel myself get a little bit cleverer

Edit: And dumber, until I work through the examples twice

NB Chrome's spell checker has an edit distance of one. I learnt something useful and immediately applicable from norvig - I tell you this guy is great :-)

It is simple in case of English. For highly inflectional languages [1] it is quite challenging.

[1] http://en.wikipedia.org/wiki/Inflection

You have not even glanced at the referred article, have you? It is not conceptually harder, pretty much the same thing.

I played with some similar tasks for my native Russian. You can just add up a layer of hash tables/dictionaries to link to the original word. There are inflections in English too (and it is even harder for spelling purposes as the difference is often by one character) so it is conceptually similar.

On the other hand, compounding languages (http://en.wikipedia.org/wiki/Compound_(linguistics)) such as Dutch and German are somewhat harder. Words of over 20 characters are fairly common in Dutch and German (hence, it is not surprising that Wikipedia's lemma on word length is only available in those languages (http://nl.wikipedia.org/wiki/Woordlengte))

If you meet a word that looks no way like anything you have seen before you must try and check whether you can construct it (or something similar to it) from constituent parts that each are in your dictionary. That can be difficult, because you must also know how compound words can be constructed. For example, a preposition can be a part, but (typically?) not at the end of a word, you (typically?) have at most one verb, adjectives (typically?) show up at the start only, etc. (the 'typically?' disclaimers show my ignorance)

A decent spelling checker needs to handle this, as it should signal missing spaces between words. For example, "blackeyed", "eyewhite", "blackkeyed", "grayblack" and "blackgray" are acceptable, but "eyedblack" is not.

I found the spell-checking in VIM to be quite awesome as well. I'm not sure the algo behind it, but it seems to give good results even when I totally butcher a word.
IIRC vim has been using/able to use the openoffice spell stuff, in turn based on hunspell which has extremely wide usage (OOo, OSX, Chrome, Opera, Eclipse, Mozilla etc)
Uh, not based on, OOo and LO uses hunspell.
Maybe no one noticed because browsers have spell checking built in now?
Would this even apply to something like TinyMCE? I thought (read:assumed) the in-browser spell checking only worked against textarea's and text inputs.
We use TinyMCE and a .NET plugin that uses the GoogleSpell check service. It's dead right now and we are trying to find a solve for it.
Most (if not all) WYSIWYG HTML editors like TinyMCE use a contenteditable container (e.g. div) and all current browsers offer spell check in the contenteditable element.
It actually is a TinyMCE problem. (Article says that Tiny used the non public URL and if it got back 500 error, just defaulted to "oh, no spelling errors then")
We offered a content-creation service to users and thought that the in-browser spell check would be good enough- turns out there's a LOT of people who prefer the old, Word 6 style of spellcheck where you enact a thing and then step through the errors one-by-one. We never actually built that but we STILL get emails asking for it, and we can tell from context that they're on modern browsers.
Spell-checking these days is and should be a function of the browser.
...unless you want to implement some sort of server-side automated correcting that improves bad quality comments for instance. Rare, and possibly not very practical, but I've seen attempts at it here and there.
More bloated software, yeeeey!!
I'll take the software bloat over the network bloat from the extra requests sending every keystroke over the wire.
On OSX at least spell checking is a function of the OS rather than the browser.
But I want to add domain-specific wordlists to the spell checking in my web app. I don't think this is that unusual a request.
I think I can see the next product headed for the graveyard?
As soon as Google realizes they still have it online, probably. I'd be willing to bet the reason it's still alive is that they plain and simply forgot about it.
Right, because a highly used endpoint with, presumably given it's widespread usage, millions of requests is easily forgotten.
In a company the size of Google, I could easily see that happening
Google what now?
Nothing.... He just wanted another backlash against Google policies. But nobody cares about Google fartsy products anymore after we all gave up Google for good sine closing down Reader... right? or am I the only one that stuck to that method of protest :)))))
Well, just tried Wordpress VIP spell-checker and it works just fine.

If they were relying on this feature they've fixed it on their side.

Read the article carefully. This was a non-Google plug-in using a private Google API that was then shutdown when Google stopped using it. This impacted users of the plug-in. This has nothing to do with Google, really.
What I took from the article is that it was a bad idea for the API client to let errors pass over in silence.
Well, there is silence at one level, and the next level reports a success (lack of spelling error).
They used a hacky method from the old IE Toolbar. That's like me scraping a website and blaming them when they change it.
This was just a private API that presumably Google no longer uses.

I wonder if this is related to the new Chrome spelling suggest feature (http://mashable.com/2013/03/29/chrome-spell-check/), and if that means there's a new private undocumented API for people to play with.

This is the plan. And in the end They will switch off Google and this is what St. John saw as Apocalypse.
Well the users of our Spell Checker app for Android did notice.

Sure, we know it's entirely our fault for using a non-public API.

This reminds of what happened with the (unofficial) Google Weather API.

People should really disclose what APIs they use and offer alternatives should the first go down, especially when it's unofficial.

Actually, I have been noticing some false positives in Chrome on Windows in the last few weeks... I wonder if it could be related somehow.

Hm, I don't seem to have online spellcheck enabled though. Perhaps not.

This blew up while I was away, sweet!

So there are a few takaways. All WP and other TinyMCE spellcheckers are silently erroring now. Not cool.

In general, people should properly handle errors, and not rely on non-public APIs.

so many people use ajax.googleapis.com it's ridiculous. Most the time when you block this, the page fails to load at all. That's fine though because they often don't have content that interests me anyway if they're that type of dev on the web.
That type of dev? One who uses fully public and well documented APIs to fetch extremely common libraries from a fast CDN? The horror!

ajax.googleapis.com isn't comparable to this now-defunct undocumented private API at all.

lesson people should learn, stop building your business around FREE/PUBLIC APIs. If you are not paying for it, don't use it for your product.
no, the lesson people should learn is "stop building your business around UNPUBLISHED/PRIVATE APIs." If you do, you have no excuse for complaining when they go away.
We use Google spellchecker with TinyMCE in our app (salestrakr.com) and it is currently working just fine. If it was down, it was for a short period of time. Though apparently long enough for someone to write a blog post, come up with a funny title, and get it on HN.