View/Edit #12:autocorrect

Switch to edit mode.

Name(s): autocorrect
1:  "Automatically correct spelling errors."
2:  {text} = args
3:  if (!$tcm && !$command_utils:running_out_of_time())
4:    "COrrect ANy SImple CApitalization ERrors."
5:    while (m = match(text, "%<[A-Z][A-Z]%([a-z][a-z]+%|[a-rt-z]%)%>", 1))
6:      text[m[1] + 1] = $string_utils.alphabet[index($string_utils.alphabet, text[m[1] + 1])]
7:    endwhile
8:    "Common typos."
9:    "text = strsub(text, \"oudl\", \"ould\", 1)"
10:   for x in (this.autocorrect)
11:     text = strsub(text, x[1], x[2], 1)
12:     if ($command_utils:running_out_of_time())
13:       break
14:     endif
15:   endfor
16:   "Mark up the text."
17:   text = $html_utils:structured_phrase_recognition(text)
18: endif
19: return text
20: "Last modified by Dax (#789) on Mon May 29 00:52:28 2006 MDT."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Hacker (#60)

You are not logged in.

[home | help | who | search | setup | code]