All pastes #246803 Raw Edit

Mine

public text v1 · immutable
#246803 ·published 2006-11-12 18:41 UTC
rendered paste body
on *:input:*: {
  if ($asc($left($1, 1)) == 47) { return }
  var %text
  var %i = 0
  :loop
  inc %i 1
  if (%i > $0) goto endloop
  %text = %text $checkSpelling($ [ $+ [ %i ] ])
  goto loop
  :endloop
  .say %text
  haltdef
}

alias checkSpelling {
  if ($ctrlenter) return $1

  var %word = $1
  var %gotsymbol = $false
  var %symbol
  var %regexp = $regex(gotsymbol, %word, ([\.,\-!@#$%\^&*()_\+=}{/'\:;?><]{1,}$))

  if ($regml(gotsymbol, 0) == 1) {
    %symbol = $regml(gotsymbol, 1)
    if ($len(%symbol) < $len(%word)) {
      %word = $left($1, $calc($len($1) - $len(%symbol)))
      if (%symbol !isin %word) { %gotsymbol = $true }
      else { %word = $1 }
    }
  }