$spellcheck

Platform:  mIRC
Published  Dec 21, 2007
Updated  Dec 21, 2007
Very simple spell checker using basic sockets to spellcheck a word. $spellcheck(<word>) ; -------------------------------------
; $spellcheck()
; Spell checks a word based on data from www.spellchecker.net

; $spellcheck(<word>)
; -------------------------------------

alias spellcheck {
if ($1) && ($1 isalpha) {
set %spell.input $1
sockopen SPELLCHECKING www.spellcheck.net 80
return %spelling.output
}
var %e = .echo -ac info * $!spellcheck:
if (!$1) %e no parameters
elseif ($1 !isalpha) %e insufficient parameters
halt
}

on *:sockopen:SPELLCHECKING:{
unset %spell.output
sockwrite -nt SPELLCHECKING GET /cgi-bin/spell.exe?action=CHECKWORD&string= $+ %spell.input HTTP/1.0
sockwrite -n SPELLCHECKING
}

on *:sockread:SPELLCHECKING: {
var %t
sockread %t
if (*is misspelled* iswm $nohtml(%t)) {
set %spelling.output FALSE
.echo -q $spelling.output
sockclose SPELLCHECKING
halt
}
if (*spelled correctly* iswm $nohtml(%t)) {
set %spelling.output TRUE
sockclose SPELLCHECKING
}
}

on *:sockclose:SPELLCHECKING:unset %spell.input


alias nohtml {
var %o, %temp = $regsub($1-,/(<[^>]+>)/g,$null,%o)
return %o
}

Comments

Sign in to comment.
Tsuiseki   -  Mar 21, 2008
Mountaindew, it doesn\'t look like that serves any purpose in this snippet, so I don\'t think is vital to the functionality. It wouldn\'t make sense to have it as %spelling.output because %spelling.output returns the results, and isn\'t an identifier. However, that line serves no purpose in the script so the author should remove it.

Rebellious, I\'ve noticed that your script doesn\'t return the results on cue. IE: if you used //echo -a $spellcheck(misspelled word) and then use //echo -a $spellcheck(correctly spelled word) again, they would return the same results. After much irritability and using the command multiple times with the same syntax, I\'ve also realized that the script will return the correct result if you were to use the second command again:

First round: //echo -a $spellcheck(assafaff) returns FALSE
Second round: //echo -a $spellcheck(hello) returns FALSE
Third round: //echo -a $spellcheck(hello) returns TRUE

~Tsuiseki
 Respond  
mountaindew   -  Mar 21, 2008

Code

 

shouldn\'t it be %spelling.output ?
 Respond  
Rebellious   -  Dec 21, 2007
Now uses sockets.

Here is the COM version in case you care. Same syntax and all:

Code

 
 Respond  
MoNoXiDe   -  Dec 21, 2007
I think this way works faster tbh :)
 Respond  
Rebellious   -  Dec 21, 2007
That\'s odd. I hadn\'t received that long of a delay at all. Personally, I have never really experimented with Sockets so I\'m not sure how to use them. I will try to research about them and generate a new version ASAP.
 Respond  
Lindrian   -  Dec 21, 2007
I had a 5 secs delay atleast.
 Respond  
MoNoXiDe   -  Dec 21, 2007
Mine works with a second delay at most. Faster than most online ones anyway.
 Respond  
Lindrian   -  Dec 21, 2007
It\'s a great idea, but it takes too long to get the information.
This is not a solution for any scripter. Rather using sockets and match a website or a library with hash tables etc.

Great idea though.
4/10 for the idea, but the slow speed makes the score low.
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.