source: WorldVistAEHR/trunk/r/LEXICON_UTILITY-LEX-GMPT/LEXAS4.m@ 1006

Last change on this file since 1006 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.5 KB
Line 
1LEXAS4 ; ISL Look-up Check Input (DBL,REM) ; 09-23-96
2 ;;2.0;LEXICON UTILITY;;Sep 23, 1996;Build 1
3 ;
4DBL(LEXX) ; Excessive Double Characters
5 ;
6 ; LEXI Incremental counter
7 ; LEXOK Flag - found word yes/no
8 ; LEXT Temporary word
9 ; LEXD Temporary word (Double doubles)
10 ; LEXX Return string
11 ;
12 N LEXI,LEXOK,LEXT,LEXD S LEXOK=0,LEXD=""
13 F LEXI=1:1:$L(LEXX) D Q:LEXOK
14 . S LEXT=LEXX I $E(LEXX,LEXI)=$E(LEXX,(LEXI+1)) D
15 . . S LEXT=$E(LEXX,1,LEXI)_$E(LEXX,(LEXI+2),$L(LEXX))
16 . . I $D(^LEX(757.01,"ASL",LEXT)) S LEXX=LEXT,LEXOK=1 Q
17 . . Q:LEXI=1
18 . . S LEXT=$E(LEXX,1,(LEXI-1))_$E(LEXX,(LEXI+2),$L(LEXX))
19 . . I $D(^LEX(757.01,"ASL",LEXT)) S LEXX=LEXT,LEXOK=1 Q
20 I LEXOK Q LEXX
21 F LEXI=1:1:$L(LEXX) D
22 . I $E(LEXX,LEXI)'=$E(LEXX,(LEXI+1)) D
23 . . S LEXD=LEXD_$E(LEXX,LEXI)
24 I $D(^LEX(757.01,"ASL",LEXD)) S LEXX=LEXD
25 Q LEXX
26 ;
27REM(LEXX) ; Remove character
28 ;
29 ; LEXI Incremental counter
30 ; LEXOK Flag - found word yes/no
31 ; LEXF First segment
32 ; LEXT Trailing segment
33 ; LEXN Altered tolken
34 ; LEXTN Temporary altered tolken
35 ; LEXX Return string
36 ;
37 N LEXI,LEXO,LEXCS,LEXCA,LEXTN,LEXOK,LEXF,LEXT,LEXN,LEXL
38 S LEXOK=0,LEXO=LEXX
39 F LEXI=2:1:$L(LEXO) D Q:LEXOK
40 . S LEXF=$E(LEXO,1,(LEXI-1)),LEXT=$E(LEXO,(LEXI+1),$L(LEXO))
41 . I $D(^LEX(757.01,"AWRD",(LEXF_LEXT))),$O(^LEX(757.01,"ASL",(LEXF_LEXT),0))>1 D Q
42 . . S LEXX=LEXF_LEXT,LEXOK=1
43 . S LEXN=$$REM2(LEXO,LEXI) I $D(^LEX(757.01,"AWRD",LEXN)) S LEXX=LEXN,LEXOK=1 Q
44 . Q:$D(^LEX(757.01,"ASL",$E(LEXO,1,LEXI)))
45 . S LEXF=$E(LEXO,1,(LEXI-1)),LEXT=$E(LEXO,(LEXI+1),$L(LEXO))
46 . I '$D(^LEX(757.01,"ASL",LEXF)),$O(^LEX(757.01,"ASL",LEXF,0))>1 D Q
47 . . S LEXX=$E(LEXF,1,($L(LEXF)-1)),LEXOK=1
48 . S LEXCA=LEXF_LEXT
49 . S LEXCS=LEXF_$E(LEXT,1)
50 . I $D(^LEX(757.01,"ASL",LEXCS)),$O(^LEX(757.01,"ASL",LEXCS,0))>1 D
51 . . S LEXO=LEXCA,LEXI=LEXI+1 S:LEXI=$L(LEXO) LEXOK=1
52 . S LEXTN=$$SHIFT^LEXAS3(LEXO)
53 . I $D(^LEX(757.01,"AWRD",LEXTN)),$O(^LEX(757.01,"ASL",LEXTN,0))>1 S LEXX=LEXTN,LEXOK=1 Q
54 . I $D(^LEX(757.01,"ASL",LEXO)),$O(^LEX(757.01,"ASL",LEXO,0))>1 S LEXX=LEXO,LEXOK=1
55 Q LEXX
56REM2(LEXO,LEXI) ; Remove character at position LEXI
57 N LEXOK S LEXOK=0
58 S LEXF=$E(LEXO,1,LEXI)_$E(LEXO,(LEXI+2),(LEXI+3))
59 I $L(LEXF)>3 D
60 . N LEXT,LEXN,LEXP1,LEXP2 S LEXT=$E(LEXX,($L(LEXX)-4),$L(LEXX))
61 . S LEXN=$E(LEXF,1,($L(LEXF)-1))_$C($A($E(LEXF,$L(LEXF)))-1)_"~"
62 . F S LEXN=$O(^LEX(757.01,"AWRD",LEXN)) Q:LEXN=""!($E(LEXN,1,$L(LEXF))'=LEXF)!(LEXOK) D
63 . . S LEXP1=$E(LEXN,($L(LEXN)-($L(LEXT)-1)),$L(LEXN))
64 . . I $E(LEXN,($L(LEXN)-($L(LEXT)-1)),$L(LEXN))=LEXT S LEXO=LEXN,LEXOK=1
65 Q LEXO
Note: See TracBrowser for help on using the repository browser.