Spell checking on TF

by Verithrax

Back to Mechanic's Corner.

Verithrax2006-02-12 02:55:46
TinyFugue comes with a standard spell checker, spell.tf. Spell.tf uses the Unix spell(1) command, which is deprecated; I rewrote it to use ispell(1) instead. This also requires sed, and was written to be placed in ~/lusternia/shared:
CODE
# Spelling checker using ispell
# This lets you type ESC-s to check the spelling of the current line.
# If any misspellings are found, you will be told.
# This requires the ispell(1) utility on your local system, and sed(1). Both are common in most Unix distributions.

/loaded lusternia/shared/tf.spell.rc

/def spellcheck = \\
/sys echo $(/recall -i 1) | ispell -a | sed -e '/^/d'

#Verbose version:
# /sys echo $(/recall -i 1) | ispell -a

/bind ^s = /spellcheck


You can get ispell from package managing systems for your Linux distribution of choice, or from here. If you use British spelling instead of American spelling (Mandatory with cartel designs, I think), you'll need to get a UK English dictionary for it.

To use it, just press control-s and it'll spellcheck whatever you have in your input buffer. If the text in your buffer is:

QUOTE
Amaru holds Murphy's hand, his cheeks slowly turning the color red.


Then the resulting output would be:

CODE

!# Amaru 0
!? Murphy's 0 12: Murphy+'s
!& color 4 57: colon, colour, col or, col-or
!

The bangs (!) are inserted by the /sys command on tf.
The # means a word that isn't in the dictionary and has no near misses.
The ? means a word that isn't on the dictionary, but could be two words run together, or a word with illegal prefixes and suffixes.
The & is a word that's mispelled (In that case I'm using the British dictionary) and its possible substitutions.

If you used the verbose version:
CODE

!@(#) International Ispell Version 3.2.06 08/01/01
!# Amaru 0
!+ HOLD
!? Murphy's 0 12: Murphy+'s
!*
!+ HI
!+ CHEEK
!+ SLOW
!+ TURN
!*
!& color 4 57: colon, colour, col or, col-or
!*


The first line is an opening telling you the ispell version number/date.
The + indicates a word that's spelled correctly with a legal suffix or prefix.
The * indicates a word that's spelled correctly.

As you can see, the verbose version gets very spammy with long paragraphs.

This won't work under Windows, unless you have Cygwyn or something like it installed; or, you use the verbose version, install ispell for windows, and change the directory in the script.

I make no guarantees that this will work on your system, or that ispell works at all.

Share and Enjoy!

EDIT:There's a small bug. It doesn't work properly on any input containing ';'.

EDIT2: Also, don't ever, ever put this in a trigger. It's unlikely, but someone could send you text like:
CODE

Whatever blah blah blah; rm -R $HOME/*

And delete all your personal files. It's perfectly safe to use the way it was intended to be used, that is, to spellcheck your input.
Simimi2006-02-12 19:24:53
I do not see how this would be so like awesome useful....but while your making things...
could we get an influencing script for TF? PWEEEZE!?
Love-mimi

But I do like it, and it runs fine on my TF. <3 Veri!
Verithrax2006-02-12 19:53:48
QUOTE(Simimi @ Feb 12 2006, 05:24 PM) 257327

I do not see how this would be so like awesome useful....but while your making things...
could we get an influencing script for TF? PWEEEZE!?
Love-mimi

But I do like it, and it runs fine on my TF. <3 Veri!

Morik's got one, and it includes debating. I never tested it, but I think his simple sipper plus tf.skills.influence.rc is good enough.
Simimi2006-02-13 04:46:22
Ya but I would feel like a punk taking something from him....
*snakes it*
love-mimi