Keep in mind that $replace() doesn't replace whole words, so word like "m
ind" will be changed to "m
ahnd" because of the i => ah replacement.
Instead of using $replace I'd create a hash table with original words as items and replacements as data.
- /hmake rep
/hadd rep about aboot
/hadd rep after efter
...
$reptext($1-) will loop through the words in text and return a modified version,
alias reptext {
var %r, %i = 1
tokenize 32 $1-
while %i <= $0 {
%r = %r $iif($hget(rep,$ [ $+ [ %i ] ]),$ifmatch,$ [ $+ [ %i ] ])
inc %i
}
return %r
}