source: FOIAVistA/trunk/r/LEXICON_UTILITY-LEX-GMPT/LEXERF.m@ 1437

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

initial load of FOIAVistA 6/30/08 version

File size: 2.5 KB
Line 
1LEXERF ; ISL Functions for Exc/Rep Words ; 09-23-96
2 ;;2.0;LEXICON UTILITY;;Sep 23, 1996
3 ;
4EXIST(X) ; Boolean function returns:
5 ; 0 If X will result in a unsuccessful search (not found)
6 ; 1 If X will result in a successful search (found)
7 ; IFN If X has an exact match (found)
8 Q:'$D(X) 0 Q:X="" 0
9 I $D(^LEX(757.01,"AB",$$UP^XLFSTR(X))) Q $O(^LEX(757.01,"AB",$$UP^XLFSTR(X),0))
10 N LEXOK D PTX^LEXTOLKN S LEXOK=1
11 I '$D(^TMP("LEXTKN",$J,0)) K ^TMP("LEXTKN"),LEXOK Q 0
12 I ^TMP("LEXTKN",$J,0)<1 K ^TMP("LEXTKN"),LEXOK Q 0
13 I ^TMP("LEXTKN",$J,0)=1 D K ^TMP("LEXTKN"),LEXKEY,LEXKEY2 Q LEXOK
14 . S LEXKEY=$O(^TMP("LEXTKN",$J,1,""))
15 . S:$L(LEXKEY)>1 LEXKEY2=$E(LEXKEY,1,$L(LEXKEY)-1)_$C($A($E(LEXKEY,$L(LEXKEY)))-1)_"~"
16 . S:$L(LEXKEY)=1 LEXKEY2=$C($A(LEXKEY)-1)_"~"
17 . S:$G(LEXKEY2)="" LEXKEY2=""
18 . S:LEXKEY="" LEXOK=0 Q:LEXKEY=""
19 . I $O(^LEX(757.01,"AWRD",LEXKEY2))[LEXKEY S LEXOK=1 Q
20 . S LEXOK=0
21 N LEXKEY,LEXKEY2,LEXREC,LEXWRD,LEXOTH,LEXCNT
22 S (LEXOK,LEXREC)=0,LEXKEY=$O(^TMP("LEXTKN",$J,1,""))
23 S LEXKEY2=$S($L(LEXKEY)>1:$E(LEXKEY,1,$L(LEXKEY)-1)_$C($A($E(LEXKEY,$L(LEXKEY)))-1)_"~",$L(LEXKEY)=1:$C($A(LEXKEY)-1)_"~",1:"")
24 I LEXKEY2="" K LEXKEY,LEXKEY2,LEXREC,LEXWRD,LEXOTH,LEXCNT Q 0
25 F S LEXKEY2=$O(^LEX(757.01,"AWRD",LEXKEY2)) Q:LEXKEY2'[LEXKEY!(LEXOK) D
26 . S LEXREC=0 F S LEXREC=$O(^LEX(757.01,"AWRD",LEXKEY2,LEXREC)) Q:+LEXREC=0!(LEXOK) D
27 . . S (LEXCNT,LEXWRD)=1,LEXOTH="" F S LEXWRD=$O(^TMP("LEXTKN",$J,LEXWRD)) Q:+LEXWRD=0 D
28 . . . S LEXOTH=$O(^TMP("LEXTKN",$J,LEXWRD,""))
29 . . . S:$$UP^XLFSTR($G(^LEX(757.01,LEXREC,0)))[$$UP^XLFSTR(LEXOTH) LEXCNT=LEXCNT+1
30 . . . S:LEXCNT=^TMP("LEXTKN",$J,0) LEXOK=1 S:LEXCNT'=^TMP("LEXTKN",$J,0) LEXOK=0
31 K ^TMP("LEXTKN"),LEXKEY,LEXWRD,LEXREC,LEXCNT,LEXOTH Q LEXOK
32ADDEXC(X) ; Boolean function returns:
33 ; 0 Not OK to add X to the Excluded Words file #757.04
34 ; 1 OK to add X to the Excluded Words file #757.04
35 Q:X="" 0
36 I +(+($$ISEXC(X))+($$ISREP(X))+($$ISBY(X)))>0 Q 0
37 Q 1
38ISREP(X) ; Boolean function returns:
39 ; 0 If X is not a "Replacement" word
40 ; 1 If X is a "Replacement" word
41 Q:X="" 0 Q:$D(^LEX(757.05,"AB",$$UP^XLFSTR(X))) 1 Q 0
42ISBY(X) ; Boolean function returns:
43 ; 0 If X is not a "Replacement" term
44 ; 1 If X is a "Replacement" term
45 Q:X="" 0 Q:$D(^LEX(757.04,"C",$$UP^XLFSTR(X))) 1 Q 0
46ISEXC(X) ; Boolean function returns:
47 ; 0 If X is not an "Excluded" word
48 ; IFN If X is an "Excluded" word
49 Q:X="" 0
50 I $D(^LEX(757.04,"AB",$$UP^XLFSTR(X))) Q $O(^LEX(757.04,"AB",$$UP^XLFSTR(X),0))
51 Q 0
Note: See TracBrowser for help on using the repository browser.