Tag Archives: spell

diction: The words you choose and why

Earlier this month I pointed out a grammar checker utility that was, because of its age and its arrangement, omitted from this daily showcase of software. And I felt a little bad about that because as far as I can tell, it was the only grammar checker for a text-only environment that I’ve seen in 21 months.

There are two conclusions to be drawn from that: One, that relying on outside sources as a core component of your software might make it obsolete before its time. And two, if you’re a budding programmer looking to make your mark on the world, there’s a big open gap right around text-based grammar checkers.

If you want to take a step in that direction, take a gander at diction.

2014-09-17-6m47421-diction

In that example, I fed diction a short and cumbersome passage from some lunkhead-Linux-blogger-wannabe I found on the Internet. ๐Ÿ˜‰ And if you look close, you can see where diction plucks out particular words and phrases, and gives you reminders — sometimes grammatical — on usage.

Not really a grammar checker, and not really a dictionary, which makes diction something in-between.

Points of note: diction is really just a filter for specific words and phrases, with cued responses inserted where appropriate. That’s important to remember, since rearranging or misspelling those key phrases is going to let diction pass right over them.

Furthermore, diction is hopeless at innuendo, double-entendre, turns of phrase or deliberate wordplay. If it’s not in the onboard repertoire, diction will either run right past it or flag it as some sort of unrelated error. So higher-order writing is susceptible to false positives.

The only other gripe I have is that the output is particularly dense. No color filtering, no line-by-line trapping, no formatting aside from the use of square brackets to set off comments from original text. So while I appreciate the effort diction goes through, the results are going to need some heavy adjustment before they will be readable.

All that being said, this is a step in the right direction for anyone who wants to do some text wrangling from the command line. diction sends its analysis straight back through STDOUT, so it’s a simple matter to pipe it into something else — like one of the million color filtering tools we’ve seen — and further adjust it.

Now let’s move to diction’s little brother. …

hunspell: A spellchecker with vast dictionary support

I see an occasional spellchecker around here — there was aspell and ispell a long while back, look was another one. codespell was good for picking through code for spelling errors, and I guess in an offhand way, dict is a spellchecker. Here’s a great one for stepping through a document and picking out errors: hunspell.

2014-08-23-6m47421-hunspell

hunspell was already installed on my Arch system, as a dependency to a dependency to a dependency to Pidgin. I see that it’s also optional for a lot of other programs, like Pale Moon or even re-alpine. Which I suppose, is a testament to its usefulness.

In its console interface, hunspell shows the possible error in context, alongside a list of suggested replacements. Key in the number of your correction, or use one of the other options to replace or ignore the error. Reach the end of the document, and you have the option to save. Easy as that.

It’s very sparse, but then again, it’s a tried-and-tested formula. Text-based spellcheckers have been around since the 1970s, if not earlier. We’re working with the benefit of experience here. … ๐Ÿ˜‰

Besides the obvious “no color” complaint, I can’t find anything that is a detriment to hunspell. Like I said, my Arch installation had hunspell installed already, but I needed to install the English dictionary before it would work directly on a text file.

And that might be part of hunspell’s greatest asset: An immense number of dictionaries. I doubt that list is complete; add to that the number of LibreOffice and Mozilla extensions that the home page implies. Plus MySpell dictionaries. And Android and Abiword support.

I’m drifting off-target again though. My real desire here was to show you the terminal interface, and point out that it’s a very real possibility that you’ve already got it on your system. Install a dictionary, and hunspell is ready to roll.

Now I had better go over this post one more time, to make sure I didn’t commit any errors in here. … ๐Ÿ˜

codespell: Prevents embarrassing code

Today is Pick on Kernel Developers’ Spelling Abilities Day.

2014-07-31-lv-c5551-codespell

As if they didn’t have enough work to do, along comes me and codespell to harass them about their spelling mistakes. :\

Spelling is sometimes important though, so a spellchecker specific to code is probably a good idea. And since I have no ability when it comes to creating software, I have to have something to complain about. O_o

codespell is neat stuff, and I don’t say that just because it has a lot of color in it. For one thing, you can step through a folder of code word-by-word, and codespell will give you the chance to correct things interactively.

2014-07-31-lv-c5551-codespell-corrx

Aside from that, codespell can write corrections directly into files, print a summary of the changes it suggested, and access custom dictionaries. There are quite a few other options, include one to — gasp! — strip out all that lovely color.

As I understand it, codespell’s main reference is part of the release, but is derived from Wikipedia’s page of common misspellings for machines (and-or technology).

If you really want to put codespell through its paces, I would suggest matching it head-to-head against something like aspell (or ispell or …). The difficulty in that, of course, is that aspell (or ispell or …) is likely to stumble over any portion of code that doesn’t look like a standard English (or other language) word. Which means codespell might end up saving you time.

And now for my regularly scheduled pity party, where I insist I would make much more use of codespell if I had a stick of programming ability. I’ll spare you that this time; if I had spent a tenth of the time learning to write software as I have moaning about my inability, I’d have come up with something vaguely usable by now. ๐Ÿ™„

look: A spellchecker at the command line

Here’s a quick and easy tool. look is part of util-linux, and does little more than show possible variations on portions of words.

It’s probably easier to show than explain.

2013-12-26-lv-r1fz6-look

You can pick a dictionary file as a flag, and both cracklib and words make good options.

Best I can tell, that’s all look does. But like so many other things, how you use it is a lot more important than what it does.

ispell: With this, yes you can

Spellcheckers are in no short supply at that console, and we’ve already seen aspell in action. ispell is similar, even if the interface is a little different.

2013-12-07-lv-r1fz6-ispell

By comparison, ispell seems a bit meticulous. One of the reasons I liked aspell was because it showed a list of alternatives by default.

As best I can tell, if you want to look up a word, not only will you need another package like words, you’ll have to ask ispell specifically to poke around for it.

ispell does show you what it thinks is the right word, and it may be that there are several that are similar.

As I understand it, ispell has better support for European languages, but I can’t attest to that. Check and see what you think.

Aside from that there’s not much that will surprise you about ispell. It behaves much as you might expect, and depending on your personal preferences, it might be more useful than the competition. ๐Ÿ˜‰

aspell: A spellchecker at the console

I’m into a short slew of software that I’ve worked with for quite a while, but want to mention again.

It’s always good to go over old ground. You never know what you’ll notice. Here’s aspell again:

2013-04-14-solo-2150-aspell

Animated, just for fun. ๐Ÿ™‚

I ran into aspell first when I made the shift to charm a few years ago. I brought it out again a few weeks ago for reference and kept it around for a while.

Dictionaries abound in Linux, and aspell makes for a very nice frontend.

Simple word-by-word checks, custom dictionaries, one-key replacement and correction, the ability to ignore or replace words document-wide … all the features you would expect in a standard spellchecker.

Best of all it is light as a feather and can practically nuzzle up to any other application without causing a scene.

Personally, I plan to incorporate this, vim and pip into something vaguely like a homemade word processor. We’ll see how that goes. … ๐Ÿ™„