[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: Auto correcting suffixes



Reply to note from Harry Binswanger  Thu, 24 Sep
2009 12:27:27 -0400

Harry:

> How do I make Autocorrect, using pers.spl accept wildcards.
> Thus, I want to automatically change any word ending in tn
> (oratn, destructn, etc.) to "tion."

No can do. (You mean Auto-Replace, BTW. Auto-Correct is something
else.) I've tried it every which way, at one time or another. It
can't be done via the SPL file.

You can do it with XPL, of course. The trick is to integrate the XPL
routine with native Auto-Replace, so that they work interchangeably.
Here's a U2 routine, WILDAZ, that does just that (I think). Here's
what to do:

1) Decode the frame below: XYDEC if you use the first
encoding; DECODE if you use the second -- the results are
identical (you only need one). DeFine the result and issue
ADD2U2 to add it to your U2 file.

2) Modify the space key assignment in your KBD file, thus:

;;57=  <== old assignment
57=NOJM(,2,.,w,i,l,d,A,Z,), ,NO

Note that the space character comes *after* the call to WILDAZ in
the key assignment. You can, optionally, make analogous mods to
other punctuation keys. Obviously, only the key(s) you modify will
trigger the "wild" Auto-Replace.

3) Add the following line to XYWWWEB.REG, then SAve the file:

WildAZ.1=tn=tion;tns=tions;sn=sion;sns=sions;tnd=tioned;snd=sioned;

This gives you the following types of replacements (end of word
only!) when you press the space key:

locatn ==> location
locatns ==> locations
extensn ==> extension
extensns ==> extensions
statnd ==> stationed
pensnd ==> pensioned

You can add substitutions of your own, of course -- tack them on to
the line in REG. Make sure, though, that the line length does not
exceed 100 characters. If you reach the 100-char limit, start a new
line, incrementing the numerical stem:
WildAZ.2=
WildAZ.3=
etc.

You may want to use multiple lines in any event, to keep similar
types of substitutions together. For example:

WildAZ.2=fl=ful;fly=fully

Which would give you (e.g.):

plentifl ==> plentiful
plentifly ==> plentifully

Etc., etc.

The substitutions only work if Auto-Replace is On. If you turn it
Off (toggle func AZ), WildAZ turns Off with it. You can also disable
WildAZ without turning off Auto-Replace: put "//" (no quotes) on the
CMline, or make "//" display persistently on the PRompt line by
commanding D/NV MG=//. (Undo it with D/NV=.)

Let me know if it works -- or not.

'%--_XYENCode_start--
{{5wildAZ}}_Wild_Auto-Replace_(end_of_word_only)_[CLD_9/25/09]
'^~B~<1&~>0&~>0&"//"~{~<0&
"//"~{~<0~>'DX~'JM2.Regdata'Q2~~>',*','^~<1~>~~~'YD
'DF'PW'DF'DE~~~>0~>~~="',"
~>~~~~>~~~<
SX05,~~>~~~~>~+"~N"~>~)+"~N")~=@upr(~)~>~+"~N"~>~~==@upr(~)~>~)~>~~+~~>'DN
~~~~~'YD~~B'^'^
'%--_XYENCode___end--

XPLeNCODE v2.0
b-gin [UNTITLED]
{{;5wildAZ}} Wild Auto-Replace (end of word only) [CLD 9/25/0
9][cr|lf]{002}{<}IF{<}VA$RE{>}<1&{<}VA$TX{>}>0&{<}VA$AR{>}>0&
"//"{238}{<}VA$CL{>}<0&"//"{238}{<}VA$MG{>}<0{>}[DX_]{<}SV99,
WildAZ{>}[JM_]2.Regdata[Q2_]{<}SX01,{<}IS99{>}{>};*;[cr|lf]{<
}IF{<}VA|01{>}<1{>}{<}SV01,;{>}{<}EI{>}{<}SV02,;{>}[YD_][DF_]
[PW_][DF_][DE_]{<}SV03{>}{<}LBa{>}{<}IF{<}VA|01{>}>0{>}{<}IF{
<}IS01{>}{240}";"{>}{<}SV04,{>}{<}XS01,02,05,06,04{>}{<}SX01,
{<}IS04{>}{>}{<}GLb{>}{<}EI{>}{<}SX05,{<}IS01{>}{>}{<}SV01,{>
}{<}LBb{>}{<}SX07,{<}VA@05=2{>}{>}{<}SX06,{<}VA@05=1{>}+"{014
}"{>}{<}IF(@upr({<}IS03{>})+"{014}"){240}@upr({<}IS06{>}){>}{
<}SX03,{<}IS03{>}+"{014}"{>}{<}XS03,06,04,05,08{>}{<}IF{<}IS0
5{>}==@upr({<}IS06{>}){>}{<}SX07,@upr({<}IS07{>}){>}{<}EI{>}{
<}SX03,{<}IS04{>}+{<}IS07{>}{>}[DN_]{<}GT03{>}{<}EX{>}{<}EI{>
}{<}GLa{>}{<}EI{>}[YD_]{<}EI{>}{002}[cr|lf][cr|lf]
-nd
XPLeNCODE

--
Carl Distefano
cld@xxxxxxxx