MLP Parsing Grammar Source
 
— The following syntactic types with NULL definitions are included
— in emgrm because they appear as OBJLIST attributes (names of BNF
— definitions which can serve as object strings) of some verbs
— in emlex, even though currently they are not called upon or
— substantively defined in emgrm. Should it be desirable to
— reinstate them, their definitions are given in Appendix 1
— of N. Sager, Natural Language Information Processing: A Computer
— Grammar of English and its Applications, Addison-Wesley (1981).
<ADJN> ::= NULL.
<DP1P> ::= NULL.
<DP2PN> ::= NULL.
<DP3PN> ::= NULL.
<DP4PN> ::= NULL.
<DPSN> ::= NULL.
<NASOBJBE> ::= NULL.
<NPVINGSTG> ::= NULL.
<NSVINGO> ::= NULL.
<NPSNWH> ::= NULL.
<PSNWH> ::= NULL.
<NPSVINGO> ::= NULL.
<NSNWH> ::= NULL.
<PNSNWH> ::= NULL.
<PNTHATSVO> ::= NULL.
<PNVINGSTG> ::= NULL.
<VINGSTGPN> ::= NULL.
<PNN> ::= NULL.
<PVINGSTG> ::= NULL.
<SNWH> ::= NULL.
<VINGOFN> ::= NULL.
<VINGSTG> ::= NULL.
— The following terminal symbols of the grammar appear as category
— assignments (part of speech) of some words in emlex, hence they
— must appear in a definition in emgrm even though currently they
— are not called upon.
<UNUSED> ::= <*CS4> / <*CS7> / <*CS8> / <*NULLRECIP>.
— BNF DEFINITIONS

— 1. SENTENCE
<SENTENCE> ::= <TEXTLET>.
<TEXTLET> ::= <ONESENT> <MORESENT>.
<ONESENT> ::= <SECTION> <INTRODUCER> <CENTER> <ENDMARK>.
<SECTION> ::= <SECT-NAME> / <*NULL>.
<SECT-NAME> ::= '[' (SUBJECTIVE / OBJECTIVE / ASSESSMENT / PLAN
        / ADMINISTRATION / BIRTHDATE / RISK-BEHAVIORS
        / HISTORY-OF-PRESENT-ILLNESS / IMPRESSION
        / PAST-MEDICAL-HISTORY / SOCIAL-HISTORY
        / FAMILY-HISTORY / MEDICATIONS / PHYSICAL-EXAM
        / PHYSICAL-EXAMINATION / LABORATORY-DATA
        / LAB / FOLLOW-UP / MEDICATIONS-ON-DISCHARGE
        / DISCHARGE-DIAGNOSIS / DISCHARGE-PROCEDURES
        / SURGERIES / DISCUSSION / ALLERGIES / GENERAL
        / HOSPITAL-COURSE / PATIENT-INSTRUCTIONS)
        ( MALE / FEMALE / <*NULL> )
        ']
'.
<MORESENT> ::= <*NULL> / <TEXTLET>.
<INTRODUCER> ::= <LISTMARK> / AND / OR / BUT / <INT-PHRASE> (':'/ '-')
        / <*NULL>.
<LISTMARK> ::= 'A.' / 'B.' / 'C.' / 'D.' / 'E.' / '1.' / '2.' / '3.'
        / '4.' / '5.'.
<INT-PHRASE> ::= PROBLEM LIST / LABORATORY DATA / NEUROLOGIC
        / LABORATORY DATA '/' TEST RESULTS / CHIEF COMPLAINT
        / <LDATER> / <LNR> ['/' <LNR> ] / <*ADJ> [ '/' <*ADJ>].
<CENTER> ::= (<ASSERTION> / <FRAGMENT>
        / <TSUBJVO> / <OBES>) <PAREN-FRAG>.
<PAREN-FRAG> ::= '(' <FRAGMENT> ')' / '(' <ASSERTION> ')' / <*NULL>.
<ENDMARK> ::= '.' / ';'.
— 2. CENTER STRINGS
<ASSERTION> ::= <SA> <SUBJECT> <SA> <TENSE> <SA> <VERB> <SA>
        <OBJECT> <SA-LAST>.
<FRAGMENT> ::= <SA> (<TOVO> / <TVO> / <VO> / <VINGO> /<NSTGF>
        / <BESHOW> / <SVEN> / <VENPASS> /<ASTGF> / <PN>
        / <WHOSEG>/ <LDATER>) <SA-LAST>.
<TSUBJVO> ::= (NEITHER / NOR) ((DID / DOES) <SUBJECT> <VO>)
        / (HAS <SUBJECT> <VENO>).
<NSTGF> ::= <NSTG>.
<ASTGF> ::= <ASTG>.
<BESHOW> ::= <PROC> <BESUBJ> (':' / '-' / <*NULL>)
        (<PDATE>/<SACONJ>/<*NULL>)
        (<OBJBE>/<VENPASS>/<VINGO>/<ASSERTION>) <SA-LAST>.
<PROC> ::= <NSTG> (<PDATE>/<*NULL>) (':'/<*NULL>) / <*NULL>.
<BESUBJ> ::= <NSTG> / <*NULL>.
<WHOSEG> ::= WHO <TENSE> <SA> <VERB> <SA> <OBJECT> <SA-LAST>.
<OBES> ::= <ASTG> <SA> <TENSE> <SA> <VERB> <SA> <SUBJECT>
        <SA-LAST>.
— 5. SUBJECT STRINGS
<SUBJECT> ::= THERE / <EKGSTG> / <NSTG> / <*NULLWH> / <*NULLC> /
        <WHATS-N>.
<NSTG> ::= <LNR>.
<LNR> ::= <LN> <NVAR> <RN>.
<NVAR> ::= <*N> / <*PRO> / <*VING> / <*DS> / <QN>/ <NQ> / <Q10S>.
<Q10S> ::= <*Q>.
<EKGSTG> ::= <LWVR>.
<LWVR> ::= <LN> <WVVAR> <RWV>.
<WVVAR> ::= <*N>.
<RWV> ::= <RWVOPTS> <RWV> / <*NULL>.
<RWVOPTS> ::= <IN-LEADS> / <PN> / <VENPASS> / <TOVO> / <ADJINRN>/
        <QUANT>.
<IN-LEADS> ::= (<*P> / <*NULL>) <LLEADR>.
<LLEADR> ::= <LN> <LEADVAR> <RLEAD>.
<LEADVAR> ::= <*N> '-' <*N> /
        <*N> THROUGH <*N> /
        <*N> '-' <*Q> /
        <*N> THROUGH <*Q> /
        <*N>.
<RLEAD> ::= <*D> / <*NULL>.
— 7. VERB AND VERBAL OBJECT STRINGS
<VERB> ::= <*NULLFRAG> / <*NULLC> / <LV> <VVAR> <RV>.
<VVAR> ::= <*TV> / <*V>.
<TENSE> ::= <LW> <*W> <RW> / <*NULL> / <*NULLC>.
<LVR> ::= <LV> <*V> <RV>.
<VENO> ::= <LVENR> <SA> <OBJECT> <SA-LAST>.
<LVENR> ::= <LV> <*VEN> <RV>.
<VENPASS> ::= <LVENR> <SA> <PASSOBJ> <SA-LAST>.
<VINGO> ::= <LVINGR> <SA> <OBJECT> <SA-LAST>.
<LVINGR> ::= <LV> <*VING> <RV>.
— 8. OBJECT STRINGS
<OBJECT> ::= <*NULLFRAG> / <*NULLC> / <NPVINGO> / <NTOVO> / <NPN>/
        <VENO> / <THATS> / <NSTGO> / <NPDOSE> / <PDATE> /
        <PQUANT> / <PVINGO> / <PSVINGO> / <DP2> / <DP3> /
        <DP1>/ <TOVO> / <PN> / <VO> /
        <ND> / <DSTG> / <PNTHATS> / <VINGO> /
        <OBJECTBE> / <OBJBE> / <SVEN> / <VENPASS> / <NTHATS>/
        <ASTG> / <NN> / <SOBJBE> / <WHETHS> / <ASSERTION> /
        <C1SHOULD> / <SVO> / <NA> / <*NULLOBJ>.
<PASSOBJ> ::= <ASTG> / <PVINGO> / <ASOBJBE> / <PNTHATS> / <PN> /
        <PDOSE> / <NSTGO> / <WHETHS> /
        <TOVO> / <P1> / <DP1> / <OBJBE> / <*NULLOBJ> / <THATS>/
        <DSTG> / <ASSERTION> / <DP1PN>.
<OBJECTBE> ::= <VINGO> / <VENPASS> / <EKGSTG> / <TOVO> / <OBJBE>/
        <THATS> / <WHERES>.
<OBJBE> ::= <ASTG> / <QUANT> / <NSTG> / <PVINGO> / <PN> / <PQUANT>/
        <PDATE> / <LDR>.
<QUANT> ::= <QN> <TIME-ADJ> / <QPERUNIT> <TIME-ADJ> /
        <NQ> <TIME-ADJ>.
<TIME-ADJ> ::= <PDATE> / <WHENS> / <PN> / <*NULL>.
<NQ> ::= <*N> <LQR>.
<QPERUNIT> ::= (THE/ A / AN /<*NULL>) <LQR> <PERUNIT> <REG-ADJ>.
<PERUNIT> ::= (BY / '/') <*N> / '%' / PER <*N> / A <*N> / <*NULL>.
<REG-ADJ> ::= (AND / <*NULL>) <*ADJ> / <*NULL>.
<QN> ::= <LQR> <*N> <RQ> <PERUNIT> <SCALESTG> <MORE-QN>.
<MORE-QN> ::= ('X'/'TO'/'BY'/<*NULL>) <QN>/<*NULL>.
<SCALESTG> ::= <*ADJ> / <IN-DIM> / <*D> / <*NULL>.
<IN-DIM> ::= (IN / OF) <*N>.
<PQUANT> ::= <*P> <QUANT>.
<ASTG> ::= <LAR>.
<NSTGO> ::= <EKGSTG> / <NSTG> / <QUANT> / <*NULLC> / <*NULLWH>.
<DSTG> ::= <LDR>.
<ND> ::= <NSTGO> <DSTG>.
<LDR> ::= <LD> <*D> <RD>.
<NTOVO> ::= <NSTGO> <TOVO>.
<TOVO> ::= <LP> TO <VO>.
<THATS> ::= THAT <ASSERTION>.
<C1SHOULD> ::= (THAT /<*NULL>) <ASSERTION>.
<NTHATS> ::= <NSTGO> <THATS>.
<TVO> ::= <TENSE> <SA> <VERB> <SA> <OBJECT> <SA-LAST>.
<VO> ::= <TENSE> <SA> <LVR> <SA> <OBJECT> <SA-LAST>.
<SVO> ::= <ASSERTION>.
— 8A. P STRINGS
<PD> ::= <*P> <LDR>.
<PN> ::= <LP> <*P> <NSTGO>.
<NPN> ::= <NSTGO> <PN>.
<PNTHATS> ::= <PN> <THATS>.
<PVINGO> ::= <*P> <VINGO>.
<PSVINGO> ::= <*P> <SVINGO>.
<NPVINGO> ::= <NSTGO> <SA> <PVINGO>.
<NPDOSE> ::= <NSTGO> <PDOSE>.
<PDOSE> ::= <*P> <*DS> (<*P> <*DS>/<*NULL>).
<P1> ::= <*P>.
— 8B. DP STRINGS
<DP1> ::= <*DP>.
<DP2> ::= <*DP> <NSTGO>.
<DP3> ::= <NSTGO> <*DP>.
<DP4> ::= <*DP> OF (<NSTGO> / <VINGO>).
<DP1PN> ::= <*DP> <PN>.
— 8D. NOMINALIZATION WITH ZEROED VERB BE
<NA> ::= <NSTGO> <ASTG>.
<NN> ::= <NSTGO> <NSTGO>.
<SOBJBE> ::= <SUBJECT> <OBJBE>.
<SVEN> ::= <SUBJECT> <VENPASS>.
<SASOBJBE> ::= <NSTG> AS <OBJBE>.
<ASOBJBE> ::= AS <OBJBE>.
— 9. SENTENCE ADJUNCT STRINGS
<SA> ::= <*NULL> / <SAOPTS> <SA>.
<SA-LAST> ::= <SAOPTS> <SA> / <*NULL>.
<SAOPTS> ::= <PAREN-SA> / <PDATE> / <SUB11> / <SUB9> / <SUB12> /
        <SUB3> / <PN> / <SUB6> / <SUB2> / <PD> / <SUB0> /
        <LDR> / <VENPASS> / <VINGO> / <NTIME> / <NSTGT> /
        <RNSUBJ> / <RSUBJ> / <SUB5> / <THATS> / <SUB1> /
        <SUB13> / <SUB8> / <TOVO> / <PVINGO> / <PWHERES>/
        <QN>.
<PAREN-SA> ::= '(' (<VO> / <SUB0>) ')'.
<PDATE> ::= (<*P> / <*NULL>) <LDATER>.
<LDATER> ::= <LDATE> <DATEVAR> <RDATE>.
<DATEVAR> ::= <*DT> '-' <*DT> / <*DT> / <T-DATE>.
<T-DATE> ::= THE <*Q>.
<NSTGT> ::= <NSTG>.
<RNSUBJ> ::= <WHS-N> / <PWHS> / <VENPASS> / <PAREN-RN> /
        <FORTOVO>/ <ADJINRN>.
<RSUBJ> ::= (<*PRO> / <*Q> / <*T>) (<PN> / <*D> / <*NULL>).
<SACONJ> ::= <SA>.
— 10. SUBORDINATE CONJUNCTION STRINGS
<SUB0> ::= <*CS0> <OBJBE>.
<SUB1> ::= <*CS1> <ASSERTION>.
<SUB2> ::= <*CS2> <VENPASS>.
<SUB3> ::= <*CS3> <VINGO>.
<SUB5> ::= <*CS5> <SVINGO>.
<SUB6> ::= <*CS6> <SOBJBE>.
<SVINGO> ::= <SUBJECT> <SA> <VINGO>.
<SUB8> ::= AS (WAS / WERE /DID) <SUBJECT>.
<SUB9> ::= <*CS9> <VO>.
<SUB11> ::= <TM-PHRASE> <ASSERTION>.
<TM-PHRASE> ::= FOLLOWING WHICH / DURING WHICH TIME / DURING WHICH
        / BEFORE WHICH / AFTER WHICH / AFTER WHICH TIME.
<SUB12> ::= SHOULD <SVO>.
<SUB13> ::= <SUB1-PHRASE> <ASSERTION>.
<SUB1-PHRASE> ::= IN THAT.
— 11. RN RIGHT ADJUNCTS OF N
<RN> ::= <RNOPTS> <RN> / <*NULL>.
<RNOPTS> ::= <PAREN-RN> / <TQVINGO> / <PDATE> / <BPART> / <VENPASS>
        / <ADJINRN> / <NTIME> / <NSTGT>
        / <*DS> / <QUANT> / <LDR> / <PQUANT> / <PDOSE>
        /<PVINGO> / <TOVO> / <PN> / <VINGO> / <THATS>
        / <WHERES> / <WHENS> / <WHETHS> / <PWHS> / <WHS-N>
        / <TOVO-N> / <WHOSES>/ <S-N>
        / <PAREN-NSTG> / <APPOS>.
<NTIME> ::= <*N>.
<TQVINGO> ::= <TQ> <VINGO>.
<TQ> ::= <*T> / <*Q>.
<S-N> ::= <ASSERTION>.
<PAREN-RN> ::= '(' <RNOPTS> <RN> ')'.
<PAREN-NSTG> ::= '(' <NSTG> / <VO> / <PERUNIT> ')'.
<ADJINRN> ::= <LAR>.
<BPART> ::= <LNR> / <*ADJ>.
<TOVO-N> ::= <LP> TO <LVR> <SA> <OBJECT> <SA-LAST>.
<APPOS> ::= <LNR>.
— 12. LN LEFT ADJUNCTS OF N
<LN> ::= <TPOS> <QPOS> <APOS> <NPOS>.
<TPOS> ::= <LTR> / <*NULL> / <LNS>.
<LTR> ::= <LT> <*T> <RT>.
<LNS> ::= <TPOS> <*NS>.
<QPOS> ::= <LQR> / <*NULL>.
<LQR> ::= <LQ> <QVAR> <RQ>.
<QVAR> ::= <*Q> X <*Q> / <RATIO> / <QPER> / <RANGE>
        / <*Q> OVER <*Q> / <*Q> '+' <*Q> / <*Q> OR <*Q>
        / <*Q> X <*Q> X <*Q> / <*Q> OF <*Q>
        / <*Q> 'OUT OF' <*Q> / <*Q> X NORMAL / <*Q>.
<RANGE> ::= <*Q> ('-'/TO) <*Q> ['/' <*Q> ('-'/TO) <*Q>].
<QPER> ::= <*Q> '/' <*N>.
<RATIO> ::= <*Q> '/' <*Q> (('/' <*Q>)/<*NULL>).
<APOS> ::= <ADJADJ> / <*NULL>.
<ADJADJ> ::= <LAR> / <QN-OF> / <QN> / <NQ>
        / <ADJADJ> (<LAR> / <QN> / <QPERUNIT> / <NQ>).
<LAR> ::= <LA> <AVAR> <RA>.
<AVAR> ::= <*ADJ> / <*VEN> /<*VING>.
<QN-OF> ::= <QN> OF.
<NPOS> ::= <NNN> / <*NULL>.
<NNN> ::= <*N> / <*DS> / POST <*N> / <*N> (<*ADJ>/<*VEN>)
        / <NNN> (<*N> / <*DS>).
— 13. RIGHT ADJUNCTS - OTHER THAN RN
<RT> ::= <*NULL>.
<RQ> ::= <*D> / <REG-ADJ> / NORMAL / TOTAL / <*NULL>.
<RA> ::= ENOUGH / <PAREN-ADJ> / <PDATE> / <PQUANT> /
        <FORTOVO> / <PN> <MORE-RA> / <PVINGO> / <TOVO> /
        <TOSTG> / <TOVO-N> / <THATS> / <ASSERTION> /
        <WHETHS> / <*NULL>.
<MORE-RA> ::= <THATS> / <WHETHS> / <*NULL>.
<PAREN-ADJ> ::= '(' <*ADJ> ')'.
<FORTOVO> ::= FOR <SUBJECT> <SA> <TOVO>.
<TOSTG> ::= TO <LAR>.
<RD> ::= <*NULL>.
<RV> ::= <PAREN-RV> / <FORTOVO> / <PVINGO> / <PDATE> / <PQUANT>
        / <PN> <MORE-RV> / <THATS> / <ASSERTION> / <C1SHOULD>
        / <LDR> <MORE-RV> / <TOVO>
        / <NSTGT> / <*NULL> / <QN>.
<MORE-RV> ::= <THATS> / <WHETHS> / <C1SHOULD> / <*NULL>.
<PAREN-RV> ::= '(' <PDATE> ')'.
<RW> ::= <LDR> / <*NULL>.
<RDATE> ::= <WHENS> / <PTIME> / <*NULL>.
<PTIME> ::= (<*P> / <*NULL>) (<*Q> ( AM / PM ) / THIS YEAR).
— 14. LEFT ADJUNCTS - OTHER THAN LN
<LT> ::= <*NULL> / <*Q> /<Q-OF> / <*D>.
<LA> ::= <*NULL> / THOUGH / <THIS-THAT> / <LDR> / <QN> / <*Q>.
<LQ> ::= BETWEEN / NUMBER / <*D> / <ADJPREQ> / <*NULL>.
<LV> ::= <LDR> / <*NULL>.
<LW> ::= <*D> / <*NULL>.
<LD> ::= <*NULL> / <*D>.
<LP> ::= THAN / <QN-TIME> / <NQ-TIME> / <LDR> / <*NULL>.
<LDATE> ::= <*NULL> / MID / EARLY / LATE / THE / <*D>.
<ADJPREQ> ::= <*ADJ>.
<QN-TIME> ::= <LQR> <*N>.
<NQ-TIME> ::= <*N> <LQR>.
<THIS-THAT> ::= THIS / THAT.
::= <*NULL> / <*D>.
— 15. WH-STRINGS
<WHS-N> ::= (WHO / WHOM / <Q-OF> WHICH <N-PRE-S> / THAT)
        <ASSERTION>.
<Q-OF> ::= <*NULL> / <*D> /<*Q> OF.
<N-PRE-S> ::= <*NULL> / <*N>.
<S-N> ::= <ASSERTION>.
<PWHS> ::= <*P> WHICH <ASSERTION>.
<WHENS> ::= <WHEN-PHRASE> <ASSERTION>.
<WHEN-PHRASE> ::= WHEN / AT WHICH TIME / AT WHICH POINT / AFTER WHICH
        /DURING WHICH / <*NULL>.
<WHATS-N> ::= WHAT <ASSERTION>.
<WHERES> ::= WHERE <ASSERTION>.
<PWHERES> ::= <*P> WHERE <ASSERTION>.
<WHOSES> ::= WHOSE <ASSERTION>.
<WHETHS> ::= (WHETHER [OR NOT] / [AS TO] WHETHER [OR NOT] / WHERE/
        WHEN / HOW / WHY / IF) ((<ASSERTION>/<TOVO>)[OR NOT]).
— 16. CONJUNCTION STRINGS
<ANDSTG> ::= (AND / '&') <SACONJ> <Q-CONJ> (EACH / <*NULL>).
<ORSTG> ::= OR <SACONJ> <Q-CONJ>.
<BUTSTG> ::= BUT <SACONJ> <Q-CONJ>.
<THANSTG> ::= THAN <Q-CONJ>.
<NORSTG> ::= NOR <Q-CONJ>.
<INCLUDINGSTG> ::= INCLUDING <Q-CONJ>.
<PLUSSTG> ::= PLUS <Q-CONJ>.
<COMMASTG> ::= ',' ( <SACONJ> <Q-CONJ> / <*NULL>).
<ANDORSTG> ::= 'AND / OR' <Q-CONJ>.
<ASWELLASSTG> ::= 'AS WELL AS' <Q-CONJ>.
<INADDITIONTOSTG> ::= 'IN ADDITION TO' <Q-CONJ>.
<PARTICULARLYSTG> ::= PARTICULARLY <Q-CONJ>.
<EGSTG> ::= 'E.G.' <Q-CONJ>.
<IESTG> ::= 'I.E.' <Q-CONJ>.
<Q-CONJ> ::= <*NULL>.
— ATTRIBUTE LISTS
— Attributes used in lexicon and parsing grammar.
— ENGLISH LEXICAL ATTRIBUTES
ATTRIBUTE =
        [* Attributes currently used in parsing grammar (emgrm) ]
        AASP, ACCUSATIVE, AFORTO, AGGREGATE, AINRN, ANYTHING, APREQ,
        ASCALE, ASENT1, ASENT3, ATHAT, AWH,
        BEREP,
        COMPARATIVE,
        DEF, DEVAL, DLA, DLD, DLOC1, DLOC2, DLOC3, DLP, DLQ, DLT,
        DLTPRO, DLV, DLW, DPRED, DPVAL, DRA, DRN, DRQ, DRV, DRW,
        DSA, DVERY,
        INDEF ['a', 'an'], INDEFINITE ['someone', 'nothing', etc.],
        MORPH,
        NAME, NHUMAN, NMONTH, NOMINATIVE, NONHUMAN, NOTNOBJ, NOTNSUBJ,
        NPREQ, NSCALE, NSENT1, NSENT2, NTH,
        OBJLIST,
        PLURAL, POBJLIST, PRESNT, PROSELF, PVAL,
        QAGE, QALL, QDATE, QHALF, QNUMBER, QROVING, QTENS, QTESTVAL,
        SINGULAR, SUPERLATIVE,
        TDEM, TIMETAG, TPOSS,
        VBE, VDO, VHAVE, VMOTION, VSENT1, VSENT2, VSENT3, VVERYVING,
        [* The following attributes are not currently used in the ]
        [* parsing grammar (emgrm). They are included here for possible ]
        [* use by following components or in future updates of emgrm. ]
        AINPA ['at' of 'at last', 'in' of 'in short', etc.], ASHOULD,
        BVAL [limits preds of 'be'-like verbs],
        DPERM [adverbs that support permutation],
        EACHEVRY ["each/every N and N" OK as subject of singular verb],
        FUT [future tense], FUTURE ['tomorrow', 'upcoming', etc.],
        NCOUNT1, NCOUNT2, NCOUNT3, NLETTER,
        NSENT3 [subject of sentential pred: 'solution', 'trouble'],
        NSENTP [PN host of sentential mod: 'of note', 'of interest'],
        NTITLE,
        PAST,
        QMANY ['many the time', 'such a result'],
        TQUAN ['any', 'each', 'either', 'some'].
— SUBLANGUAGE LEXICAL ATTRIBUTES
ATTRIBUTE =
        [* Sublanguage lexical attributes used in Selection *]
        [* as members of the list SUBLANGUAGE-ATTS. *]
        E-AX [EKG axis], E-EKGPROC [EKG test], E-LEAD [EKG leads],
        E-INTVL [EKG interval], E-WV [EKG wave],
        H-AGE, H-ALLERGY, H-AMT,
        H-BECONN,
        H-CHANGE, H-CHANGE-MORE, H-CHANGE-LESS, H-CHANGE-SAME,
        H-CHEM, H-CONN,
        H-DESCR, H-DEVMED, H-DIAG, H-DIET,
        H-ETHNIC, H-EVID,
        H-FAMILY,
        H-GEOGR [geography],
        H-INDIC, H-INST,
        H-MODAL,
        H-NEG, H-NORMAL, NTIME1, NTIME2, H-NULL, NUNIT,
        H-OBSERVE, H-ORG,
        H-POST, H-PT, H-PTAREA, H-PTDESCR, H-PTFUNC, H-PTLOC,
        H-PTMEAS, H-PTPART, H-PTSPEC, H-PTVERB,
        H-RECORD, H-RESP,
        H-SHOW,
        H-TESTVIEW, H-TMBEG, H-TMDUR, H-TMEND, H-TMLOC, H-TMPREP, H-TMREP,
        H-TRANSP, H-TTSURG, H-TTCOMP, H-TTGEN, H-TTMED, H-TTMODE,
        H-TXCLIN, H-TXPROC, H-TXRES, H-TXSPEC, H-TXVAR,
        H-UNDEF [undefined word],
        H-VTEST,
        [* Sublanguage lexical attributes used in parsing, *]
        [* not used in Selection. *]
        H-CARD-ARTERY, H-CARD-GRAFT,
        FEM,
        GENERIC,
        MASC,
        PAST,
        H-PTPALP,
        [* Non-lexical attribute (computed attribute) used *]
        [* in parsing grammar and in SELECTION. *]
        H-RESULT.
— NODE-ATTRIBUTES
ATTRIBUTE =
        COMPUTED-ATT,
        DEFERRED, DIDOMIT,
        LAST-NODE, LINKC, LN-TO-N-ATT,
        N-TO-LN-ATT, N-TO-RN-ATT, NOT-FREE,
        PLACE-HOLDER [for 'it' in 'it is clear that..', cf $SUBJIT],
        POSTCONJELEM, PRECONJELEM,
        RN-TO-N-ATT,
        SELECT-ATT,
        TRANSP.
— PHRASE-ATTRIBUTES used in parsing grammar (cf WPHRASE restrictions)
ATTRIBUTE = PHRASE-ATT,
        AGE-PHRASE, DATE-PHRASE, DOSE-PHRASE, GRAFT-PHRASE,
        INDIC-PHRASE, INFLUENCE-PHRASE, INST-PHRASE,
        QUANT-PHRASE, RADIATE-PHRASE, SOURCE-ATT, SOURCE-PHRASE,
        TESTENV-PHRASE, TIME-POST-PHRASE, TIME-PHRASE.
— GLOBAL LISTS

— GLOBAL STATEMENTS IN ROUTINES
GLOBAL = $ASCNT [df in CORE],
   $ASSIGN-PRECONJELEM [df in COEL1],
   $AT-LADJ [df in HOST-ELEMENT],
   $AT-RADJ [df in HOST-ELEMENT],
   $ATRNSUBJ [df in HOST-ELEMENT],
   $CORE-PATH [df in CORE-],
   $MINPAR [df in DMIN1],
   $RIGHT-TO-HOST [df in HOST-ELEMENT],
   $STACK-TEST [df in DOWN1].
— SUBLANGUAGE SELECTION LISTS
—       The following lists are used in sublanguage selection and
—       conjunction restrictions

— SUBLANGUAGE-ATTS
—       A list of all attributes involved in SELECTION; this includes all
—       sublanguage classes and those English classes which participate
—       in Selection (these are given at the beginning of the list).
—       Any class on this list can only conjoin to words of the same class
—       unless the class also appears on the list CONJ-EQUIV-CLASSES.
LIST SUBLANGUAGE-ATTS =
        [* ENGLISH CLASSES *]
        NTIME1, NTIME2, NUNIT,
        QNUMBER,
        VBE, VDO, VHAVE,
        [* SUBLANGUAGE CLASSES *]
        E-AX, E-EKGPROC, E-INTVL, E-WV, E-LEAD [cf EKGSTG],
        H-AGE, H-ALLERGY, H-AMT,
        H-BECONN,
        H-CHANGE, H-CHEM, H-CONN,
        H-CHANGE-MORE, H-CHANGE-LESS, H-CHANGE-SAME,
        H-DESCR, H-DEVMED, H-DIAG, H-DIET,
        H-ETHNIC, H-EVID,
        H-FAMILY,
        H-GEOGR,
        H-INDIC, H-INST,
        H-MODAL,
        H-NEG, H-NORMAL, H-NULL,
        H-OBSERVE, H-ORG,
        H-POST, H-PT, H-PTAREA, H-PTDESCR, H-PTFUNC, H-PTLOC,
        H-PTMEAS, H-PTPART, H-PTSPEC, H-PTVERB,
        H-RECORD, H-RESP, H-RESULT,
        H-SHOW,
        H-TMBEG, H-TMEND, H-TMLOC, H-TMDUR, H-TMPREP, H-TMREP,
        H-TTSURG, H-TTCOMP, H-TTGEN, H-TTMED, H-TTMODE,
        H-TXCLIN, H-TXPROC, H-TXRES, H-TXSPEC, H-TXVAR,
        H-TESTVIEW, H-TRANSP,
        H-VTEST,
        H-UNDEF.
— NOTE the following command line: *include emgrmtbl_101.txt.
— COMP-ATT lists and CONJ-EQUIV lists (the contents of emgrmtbl_100.txt)
— are inserted here during compilation of the grammar.

— Inclusion of emgrmtbl_100.txt at Thu Mar 16 13:59:19 2006
— CONJ-EQUIV-CLASSES
—       A list used by the parsing grammar (rules appearing in WCONJ9)
—       to determine sublanguage semantic compatibility of conjuncts
—       (two or more phrases joined by commas, "and", "or", nor",...).

—       The following assumptions apply:
—       A. An attribute is always conjunctionally equivalent
—       to itself (full list of attributes is found in
—       SUBLANGUAGE-ATTS list).
—       E.g. 'headache, fever and vomiting' each has identical
—       sublanguage attribute H-INDIC.
—       B. CONJ-EQUIV-CLASSES list is a list of all equivalence
—       classes appearing in sublists (shown below).
—       E.g. 'pain on upper surface and fingers'
—       (H-PTAREA and H-PTPART are conjunction equivalents
—       C. A computed attribute COMPUTED-ATT of a phrase is
—       used first to determine compatibility with its conjoined
—       phrase. For example, 'fever and stiff neck' are judged
—       CONJ-EQUIVALENT because 'stiff neck' has
—       COMPUTED-ATT = H-INDIC. The lists N-COMP-ATT-LN and
—       N-COMP-ATT-RN contain the word class combinations that
—       that constitute COMPUTED-ATTs.

LIST CONJ-EQUIV-CLASSES =
        (H-CHANGE, H-CHANGE-MORE, H-CHANGE-LESS, H-CHANGE-SAME,
        H-TXRES, H-RESULT
        [* creatinine increase H-CHANGE-MORE and MB of 12 H-RESULT *]),
        (H-CHEM, H-INDIC
        [* signs of black widow toxin and venomization *]),
        (H-TXRES, E-WV [* EKG revealed sinus rhythm with Q-waves *]),
        (H-TXRES, H-PTMEAS [* salt content and volume of water *]),
        (H-PTFUNC, H-PTPART [* sensory and motor exam *]),
        (H-PTFUNC, H-TTCOMP [* deficits in mobility and self-care *]),
        (H-PTFUNC, H-TXCLIN
        [* deep tendon reflexes, motor and sensory exam are intact *]),
        (H-PTPART, H-PTAREA, H-PTSPEC),
        (H-PT, H-RECORD),
        (H-PT, H-FAMILY [* according to the patient and his mother *]),
        (H-PTDESCR, H-FAMILY [* no change in Social Hx or Family Hx *]),
        (H-DIAG, H-PTDESCR, H-INDIC, H-RESULT, H-TXRES, H-ORG,
        H-RESP, H-DESCR, H-NORMAL
        [* normal left vein H-NORMAL but occlusion H-INDIC of distal RCA *]),
        (H-INDIC, H-PTLOC
        [* chest pain unassociated with SOB or radiation *]),
        (H-RESP, H-TTGEN, H-DIAG, H-TTMED
        [* pt's condition, instructions, diagnosis and medications *]),
        (H-INDIC, H-TXCLIN,
        H-RESULT [* pain profile, PE, normal lactate *]),
        (H-TTMED [* allergic to penicillin *], H-DIAG, H-CHEM, H-TXVAR,
        H-DIET
        [* denies reaction to bee stings, latex, iodine or shellfish *]),
        (H-DIAG, H-MODAL [* assessment and plan will be... *]),
        (H-DIAG, H-TTSURG [* status post MI, CABG *],
        H-RESULT [* including CABG and ejection fraction of 20 % *]),
        (H-VTEST, H-TXPROC [* blood sampling and biopsy *]),
        (H-TXCLIN, H-TXPROC [* ... exam and stress test *]),
        (H-TXCLIN, H-TTSURG [* refused surgery or workup *]),
        (H-TXCLIN, H-TTGEN [* examination and consult *]),
        (H-TMLOC, H-TXCLIN, H-TTGEN
        [* history, exam, and medical decision making *]),
        (H-TXPROC, H-RESP [* pleased with procedure and recuperation *]),
        (H-TXPROC, H-TXVAR [* no new ECG or enzyme changes *]),
        (H-TMLOC, H-TXPROC, H-TXRES
        [* his history, exercise tolerance test and EKG changes *]),
        (H-DEVMED, H-TXPROC [* his battery pack and leads *]),
        (H-DEVMED, H-TTGEN [* inhaler and peak flow self-monitoring *]),
        (H-DEVMED, H-TTMED [* IV steroids and nebulizers *]),
        (H-TXSPEC, H-TXVAR,H-TXPROC,H-PTSPEC,H-PTPART,H-ORG[,H-RESULT]),
        (H-TTCOMP, H-TTMED, H-TTSURG[, H-TTGEN, H-DEVMED]),
        (H-TTCOMP, H-TTGEN, H-TXPROC
        [* hospitalization, oxygenation, monitoring *]),
        (H-TTCOMP, H-TTSURG, H-DEVMED [* ...therapy, angioplasty, stent *]),
        (H-TTCOMP, H-INST [* physical therapy and nursing Home Health *]),
        (H-TTCOMP, H-DIET [* hydration and nutrition are adequate *]),
        (H-TTSURG, H-TXPROC
        [* coronary angiography and cardiac catheterization *]),
        (H-TTSURG, H-DIAG [* left hip arthroplasty and Perth's disease *]),
        (NTIME1, NTIME2 [* last week and again yesterday *]),
        (H-TMBEG, H-CHANGE, H-TMEND, H-TMLOC, H-POST,
        H-CHANGE-MORE, H-CHANGE-LESS, H-CHANGE-SAME),
        (H-TMREP, H-TMDUR [* prolonged and desynchronized *]),
        (H-AMT, H-DESCR [* in severity and frequency *]),
        (NSENT1, NSENT2, NSENT3),
        (NSENT1,
        H-INDIC [* In view of the chest pain and the fact that... *]),
        (H-TTMED, H-CHEM, H-PTFUNC,
        H-TTCOMP [* relieved by drugs and sleep *]),
        (H-TMLOC, H-TXPROC [* by history and electrocardiagrams *]),
        (H-DESCR, H-PTLOC [* nondermatomal and poorly localizing *]),
        (H-TXCLIN, H-TXVAR [french]).
— N-COMP-ATT-LN
—       A list whose members are attributes of a head Noun N which can
—       take an LN COMPUTED-ATTRIBUTE; the resultant attribute(s) created
—       by the procedure WCOMP-ATT-LN using the list N-COMP-ATT-LN are
—       assigned as attribute(s) of the head N. Each resultant attribute
—       will in turn have sub-attributes which are the classes in the
—       modifier (LN)> which cause the resultant COMPUTED-ATTRIBUTE.

—       The resultant attribute 'TRANSP' means that the COMPUTED
—       ATTRIBUTE IS "transparent": it takes on the class of the word in
—       the modifier causing the COMPUTED ATTRIBUTE. For example,
—       'H-PTPART' modified by 'H-INDIC' is "transparent", according to
—       the list N-COMP-ATT-LN, which has as a member
—       H-PTPART:(H-RESULT:(H-NEG, H-CHANGE),TRANSP:(H-INDIC, H-DIAG)).
—       For e.g. 'stiff neck' where 'stiff' is H-INDIC and 'neck'
—       is H-PTPART, the procedure will assign the COMPUTED-ATT = H-INDIC
—       to the head Noun 'neck' due to the H-INDIC modifier in LN.
—       Note the attribute H-RESULT, which is not a lexical attribute of
—       any word but is the resultant COMPUTED-ATTRIBUTE for certain
—       word class combinations, e.g. a PTPART word modified by H-NEG
—       or H-CHANGE, as in 'no stools' or 'change in lung'.
LIST N-COMP-ATT-LN =
H-PTMEAS:(H-RESULT:(H-AMT,H-EVID,H-NORMAL [* normal AP diameter *],
        NUNIT, H-CHANGE,
        H-CHANGE-MORE [* increased AP diameter *],
        H-CHANGE-LESS, H-CHANGE-SAME),
        H-INDIC:(H-INDIC), H-DIAG:(H-DIAG)),
H-PTFUNC:(H-RESULT:(H-AMT,H-EVID,H-DESCR,H-TXRES,H-CHANGE,
        H-CHANGE-MORE, H-CHANGE-LESS, H-CHANGE-SAME,
        NUNIT),
        H-INDIC:(H-NEG,H-INDIC,H-TMDUR [* rapid heart rate *],
        H-TMLOC [* delayed closure *]),
        H-NORMAL:(H-NORMAL),
        H-DIAG:(H-DIAG),
        H-TTSURG:(H-TTSURG)),
H-PTPART:(H-RESULT:(H-CHANGE,H-DESCR [* black stool *],
        QNUMBER [* 2+ carotids *],H-CHANGE-MORE,
        H-CHANGE-LESS [* decreased cartilage *],
        H-CHANGE-SAME, H-RESP ),
        H-NORMAL:(H-NORMAL),
        H-INDIC:(H-INDIC, H-TMDUR [* rapid heart *],
        H-NEG [* false lumen *],
        H-EVID [* true lumen *]),
        H-TXRES:(H-TXRES),
        H-DIAG:(H-DIAG)),
H-PTAREA:(H-RESULT:(H-CHANGE,H-RESP,
        H-CHANGE-MORE, H-CHANGE-LESS, H-CHANGE-SAME),
        H-PTPART:(H-PTPART), H-NORMAL:(H-NORMAL),H-INDIC:(H-INDIC),
        H-DIAG:(H-DIAG)),
H-PTSPEC:(H-TXRES:(H-TXRES)),
H-CHANGE:(H-RESULT:(H-PTFUNC,H-PTMEAS,H-TXCLIN,H-PT,H-FAMILY,
        H-NEG [* no change *], H-PTPART,H-PTAREA,H-PTLOC),
        TRANSP:(H-INDIC,H-DIAG, H-TTMED,H-TTCOMP,H-TTGEN,
        H-RESP)),
H-CHANGE-MORE:(H-RESULT:(H-PTFUNC,H-PTMEAS,H-TXCLIN,H-PT,H-FAMILY,
        H-NEG [* no increase *],[H-PTPART,]H-PTAREA,H-PTLOC),
        TRANSP:(H-INDIC,H-DIAG, H-TTMED,H-TTCOMP,H-TTGEN,
        H-RESP)),
H-CHANGE-LESS:(H-RESULT:(H-PTFUNC,H-PTMEAS,H-TXCLIN,H-PT,H-FAMILY,
        H-NEG [* no change *],[H-PTPART,]H-PTAREA,H-PTLOC),
        TRANSP:(H-INDIC,H-DIAG, H-TTMED,H-TTCOMP,H-TTGEN,
        H-RESP)),
H-CHANGE-SAME:(H-RESULT:(H-PTFUNC,H-PTMEAS,H-TXCLIN,H-PT,H-FAMILY,
        H-NEG [* no change *],[H-PTPART,]H-PTAREA,H-PTLOC),
        TRANSP:(H-INDIC,H-DIAG, H-TTMED,H-TTCOMP,H-TTGEN,
        H-RESP)),
NUNIT:(H-AMT:(H-CHANGE-LESS,H-CHANGE-MORE [* to a lesser degree *])),
H-EVID:(TRANSP),
H-INDIC:(H-INDIC:(H-NEG)[for ambiguous 'no growth' prefer H-INDIC],
        H-DIAG:(H-ORG [* herpes_viral infection 8/23/01 Dave *])),
H-ORG:(H-RESULT:(H-NORMAL [* normal flora *])),
H-DIET:(H-TTCOMP:(H-NEG [* no eggs in diet *])),
H-RESP:(H-RESP:(H-TMEND)),
H-TMEND:(H-RESULT:(H-PTMEAS,H-PTFUNC,H-TXCLIN),TRANSP),
H-TMLOC:(H-INDIC:(H-INDIC [* with prior smoking history *])),
[H-TMLOC:(H-RESULT:(H-NEG,H-NORMAL)),no significant medical history]
H-TMDUR:(H-RESULT:(H-PTFUNC),H-INDIC:(H-INDIC [* syncopal episode *]),
        H-TTMED:(H-TTMED)),
H-TRANSP:(TRANSP),
H-TTGEN:(H-TTSURG:(H-TTSURG [* surgical back_up *]),
        H-TXPROC:(H-TXPROC [* angiographic evaluation *])),
H-TXCLIN:(H-TMLOC:(H-TMLOC),
        H-RESULT:(H-NORMAL [* normal physical exam *])),
H-TXPROC:(H-RESULT:(QNUMBER), H-NORMAL:(H-NORMAL), H-INDIC:(H-INDIC)
        [H-TXRES:(H-TXRES) 'a 2d echo']),
H-TXSPEC:(H-RESULT:(H-ORG,QNUMBER,H-INDIC),
        H-TXRES:(H-TXRES)),
H-TXVAR:(H-RESULT:(H-TXRES,H-ORG,QNUMBER,H-NEG,H-AMT,H-CHANGE,H-NORMAL,
        H-CHANGE-MORE, H-CHANGE-LESS, H-CHANGE-SAME,
        NUNIT [* 1% eosinophils *]),
        H-INDIC:(H-INDIC)).
— N-COMP-ATT-NPOS
—       NPOS-N COMPUTED ATTRIBUTE MUST USE THIS LIST RATHER THAN GENERAL
—       N-COMP-ATT-LN. THIS LIST IS USED IN WCOMP-ATT-LN$NPOS.
LIST N-COMP-ATT-NPOS =
        H-TTSURG:(H-TTSURG:
        (H-DEVMED [* stent placement, defibrillator insertion *]
[* resolve H-TTSURG/H-PTAREA pacemaker insertion vs biceps insertion *])),
        H-TTCOMP:(H-TTMED:
        (H-TTMED [* oxygen therapy - resolve H-TTMED/H-TXVAR *])),
        H-TXSPEC:(H-TXSPEC:
        (H-PTPART [* blood culture - resolve H-PTPART/H-INDIC *])),
        H-PTFUNC:(H-INDIC:(H-INDIC [* plaque formation *])),
        H-INDIC:(H-DIAG:(H-ORG [* herpes infection 8/23/01 Dave *])),
        H-TMLOC:(H-DIAG:(H-DIAG [* hepatitis history rbhiv *])),
        H-CHANGE:(H-RESULT:(H-PTFUNC,H-PTMEAS,[H-PTPART,][ H-PT,]
        E-INTVL [* ST segment changes *],
        H-TXCLIN,[H-FAMILY,]H-PTAREA,H-PTLOC),
        TRANSP:(H-INDIC,H-DIAG,H-TTMED,H-TTCOMP,H-TTGEN, H-RESP)),
        H-CHANGE-MORE:(H-RESULT:(H-PTFUNC,H-PTMEAS,[H-PTPART,][ H-PT,]
        E-INTVL [* ST elevation *],
        H-TXCLIN, [H-FAMILY,]H-PTAREA,H-PTLOC),
        TRANSP:(H-INDIC,H-DIAG,H-TTMED,H-TTCOMP,H-TTGEN, H-RESP)),
        H-CHANGE-LESS:(H-RESULT:(H-PTFUNC,H-PTMEAS,[H-PTPART,][ H-PT,]
        E-INTVL [* ST depression *],
        H-TXCLIN,[H-FAMILY,]H-PTAREA,H-PTLOC),
        TRANSP:(H-INDIC,H-DIAG,H-TTMED,H-TTCOMP,H-TTGEN, H-RESP)),
        H-CHANGE-SAME:(H-RESULT:(H-PTFUNC,H-PTMEAS,[H-PTPART,][ H-PT,]
        H-TXCLIN,[H-FAMILY,]H-PTAREA,H-PTLOC),
        TRANSP:(H-INDIC,H-DIAG,H-TTMED,H-TTCOMP,H-TTGEN, H-RESP)),
        H-TRANSP:(TRANSP),
        H-TTMED:(H-TXVAR:(H-PTPART [* serum dilantin *])),
        H-TTCOMP:(H-TTMED:(H-TTMED [* heparin protocol *])),
        H-PTAREA:(H-PTPART:(H-PTPART)).
— N-COMP-ATT-RN
—       The RN COMPUTED ATTRIBUTE falls into two groups:
—       1. COMPUTED ATTRIBUTE
—       In the case of the RN COMPUTED ATTRIBUTE, the head noun
—       of the N + RN structure that may result in a COMPUTED
—       ATTRIBUTE appears first, followed by a ':', which is
—       followed in parentheses by the resultant; the resultant
—       in turn is followed by a ':' and in parentheses the
—       word classes such that, if one occurs as the core of the
—       RN adjunct, will cause the COMPUTED ATTRIBUTE to be created
—       with that word class as its value. For example, H-CHANGE in
—       the list N-COMP-ATT-RN has the entry
—       H-CHANGE:(H-RESULT:(H-PTAREA,H-PTFUNC,...))
—       which meanS that H-CHANGE combined with an RN with
—       H-PTAREA oR H-PTFUNC as head will give an H-RESULT LNR.
—       2. TRANSPARENT (abbreviated 'TRANSP')
—       A word having this subattribute takes on the attribute
—       of whatever head noun is in the right adjunct, provided
—       that head noun is on the 'TRANSP' list.
—       3. BOTH COMPUTED AND TRANSPARENT ATTRIBUTES
—       A word may have both COMPUTED ATTRIBUTEs for certain
—       RN's and be transparent with respect to the
—       remainging attributes on the TRANSP list; for example,
—       for H-CHANGE, the entry
—       H-CHANGE:(H-RESULT:(H-PTAREA,H-PTFUNC),TRANSP)
—       means that H-CHANGE with an H-PTAREA or H-PTFUNC word as
—       head noun of an RN adjunct would give an H-RESULT LNR,
—       but with (e.g.) H-TTGEN or H-TTCOMP comparably placed
—       would give an H-TTGEN or H-TTCOMP LNR.

LIST N-COMP-ATT-RN =
        H-AMT:(H-RESULT:(H-NORMAL,H-INDIC,H-DIAG,H-TTCOMP,H-PTFUNC,
        H-PTMEAS,H-TXVAR,H-TXRES)),
        H-CHANGE:(H-RESULT:(H-TXCLIN,H-TXVAR [* aucun movement enzymatique *]),
        H-INDIC:(H-PT, H-PTAREA,H-PTFUNC [* no change in vision *],
        H-PTLOC,H-PTMEAS,H-PTPART),
        TRANSP:(H-INDIC,H-DIAG,H-TTMED,H-TTCOMP,H-TTGEN,H-RESP)),
        H-CHANGE-MORE:(H-RESULT:(H-PT,
        H-PTAREA,H-PTFUNC,H-PTLOC,H-PTMEAS,H-PTPART,
        H-TXCLIN,H-TXVAR [* aucun movement enzymatique *]),
        TRANSP:(H-INDIC,H-DIAG,H-TTMED,
        H-TTCOMP,H-TTGEN,H-RESP)),
        H-CHANGE-LESS:(H-RESULT:(H-PT,
        H-PTAREA,H-PTFUNC,H-PTLOC,H-PTMEAS,H-PTPART,
        H-TXCLIN,H-TXVAR [* aucun movement enzymatique *]),
        TRANSP:(H-INDIC,H-DIAG,H-TTMED,
        H-TTCOMP,H-TTGEN,H-RESP)),
        H-CHANGE-SAME:(H-RESULT:(H-PT,
        H-PTAREA,H-PTFUNC,H-PTLOC,H-PTMEAS,H-PTPART,
        H-TXCLIN,H-TXVAR [* aucun movement enzymatique *]),
        TRANSP:(H-INDIC,H-DIAG,H-TTMED,
        H-TTCOMP,H-TTGEN,H-RESP)),
        H-EVID:(TRANSP:
        (H-INDIC [* evidence of bibasilar atelectasis *])),
        H-FAMILY:(H-DIAG:
        (H-DIAG [* denies family hx of CAD; family_hx=H-FAMILY *])),
        H-INST:(H-INST:(H-PTPART)),
        H-MODAL:(TRANSP),
        H-NEG:(H-RESULT:(H-NORMAL,H-INDIC,H-DIAG,H-PTFUNC,H-PTMEAS,H-RESULT),
        H-TTCOMP:(H-DIET [* elimination of eggs from diet *]),
        TRANSP),
        H-NORMAL:(H-RESULT:(H-PTPART [* vierge de toute cicatrice *])),
        H-NULL:(TRANSP:(H-INDIC)) [* signs of infection *],
        H-PTAREA:(H-DEVMED:(H-DEVMED),
        TRANSP:(H-INDIC,H-DIAG,H-RESP)),
        H-PTFUNC:(H-RESULT:(H-NORMAL,H-INDIC,
        H-CHANGE [* JVP raised *],NUNIT,H-AMT,
        H-CHANGE-MORE, H-CHANGE-LESS, H-CHANGE-SAME,
        QNUMBER [,NTIME1])),
        H-PTMEAS:(H-RESULT:(NUNIT,H-NORMAL,H-AMT)),
        H-PTPART:(H-RESULT:(H-DESCR,H-TTSURG,QNUMBER)
        [* arm with redness; knees post surgery; carotids 2+ *],
        TRANSP:(H-INDIC,H-DIAG,H-NORMAL,H-RESP)),
        H-PTSPEC:(TRANSP:(H-TXRES,H-ORG)),
        H-RECORD:(TRANSP:(H-INDIC,H-DIAG [* record of arrhythmia *])),
        H-TMBEG:(H-RESULT:(H-PTFUNC [* reprise du transit *]),
        TRANSP:(H-INDIC,H-DIAG,H-TTMED, H-TTSURG,
        H-TTCOMP,H-TTGEN,H-RESP)),
        H-TMEND:(H-INDIC:(H-PTFUNC),
        H-RESULT:(H-INDIC,H-DIAG [* disappearance of fever *]),
        TRANSP:(H-TTMED, H-TTSURG, H-TTCOMP,H-TTGEN,
        H-RESP)),
        H-TMLOC:(H-INDIC:(H-PTPART [* cardiac history *]),
        TRANSP:(H-TTMED,H-TTSURG,H-TTCOMP,
        H-ORG [* history of salmonella *],
        [H-TTGEN,morning after admission/=H-TTGEN 9/30/98]
        H-INDIC,H-DIAG,H-RESP)),
        H-TMDUR:(TRANSP:(H-INDIC,H-DIAG,H-TTGEN,H-RESP,H-TTMED, H-TTSURG,
        H-TTCOMP [* a course of irradiation *]),
        H-TTMED:( H-DEVMED [* a period of bronchodilators *]),
        H-TMLOC:(NTIME1 [* during the course of the day *])),
        H-TRANSP:(TRANSP),
        H-TTGEN:(H-TXPROC:(H-TXPROC [* review of chest xray *])),
        H-TXCLIN:(H-RESULT:(H-TXRES,H-NORMAL)),
        H-TXPROC:(H-RESULT:(H-TXRES,H-NORMAL,H-INDIC
        [* swallowing study markedly abnormal for solid foods *])),
        H-TXSPEC:(H-RESULT:(QNUMBER,H-AMT,NUNIT,H-NORMAL)),
        H-TXRES:(TRANSP:(H-INDIC [* image de lithiase *])),
        H-TXVAR:(H-RESULT:(QNUMBER,H-AMT,NUNIT,H-TXRES,H-ORG,H-NORMAL,
        H-CHANGE-MORE, H-CHANGE-LESS, H-CHANGE-SAME,
        H-INDIC, H-CHANGE)),
        H-AMT:(H-INDIC:(H-INDIC [* 2-3 ounces QN=H-AMT of alcohol H-INDIC *])),
        NUNIT:(H-INDIC:(H-INDIC [* moderate degree of hypoxia *]),
        H-TTMED:(H-TTMED)).
LIST MAJOR-EQUIV-CLASSES =
        [* Special list used in WCONJ4A and WCONJ9 (ljt)]
        H-CHEM, H-ORG,
        H-PT, H-PTAREA, H-PTLOC, H-PTMEAS, H-PTPART, H-PTFUNC, H-PTSPEC,
        H-DIAG, H-INDIC, H-RESP, H-DESCR, H-NORMAL,
        H-TTSURG, H-TTCOMP, H-TTGEN, H-TTMED, H-TTMODE,
        H-TXSPEC, H-TXVAR, H-TXPROC, H-TXRES, H-TXCLIN.
LIST WPOS18-PRED =
        [* Sublanguage classes allowed in predicate position. *]
        [* Used by WPOS18, WPOS18A and WPOS18B. *]
        H-INDIC, H-TXRES, H-NORMAL, H-DIAG, H-ORG, H-AMT, H-PTMEAS,
        H-RESULT, H-NEG, H-TTSURG, H-TTCOMP, H-TTMED, H-TTGEN,
        H-DESCR, H-RESP, H-MODAL, H-TXPROC [* test was Bruce_protocol *],
        H-PTDESCR, H-DEVMED [* Pacemaker/VVI for sinus bradycardia *],
        H-SHOW [* noteworthy for coronary artery disease *],
        H-INST [* Discharge Diagnosis: Consultants *],
        H-TESTVIEW [ * PA pelvis and lateral *],
        H-CHANGE,H-CHANGE-MORE,H-CHANGE-LESS,H-CHANGE-SAME [* unchanged *],
        H-PTFUNC [* reported as awake *],H-RECORD [* ng (= none given) *],
        H-TXSPEC, H-TXVAR, H-TXPROC [these TX are preds only in PLAN section],
        H-TMDUR [* acute *], H-TMLOC [* history *],
        E-WV, E-INTVL, E-AX [these E-xxx for EKGSTG].
LIST WCONJ21-ARTERY =
        [* Arteries to which grafts are made in CABG surgery. ]
        [* NOTE: This is the list of words with attrb H-CARD-ARTERY ]
        [* in the lexicon emlex. Used in WCONJ21. As words with this ]
        [* attribute are added to the lexicon, add them to this list.]
        'CORONARY ARTERY', 'CORONARY-ARTERY',
        'RCA','LAD','PDA','PL','RAMUS', 'RAMUS INTERMEDIUS',
        'OM' [* obtuse marginal *],'OM-1','OM-2','OM-3','OM-4','OM-5',
        'OM1', 'OM2', 'OM3', 'OM4', 'OM5', 'PROXIMAL',
        'CIRCUMFLEX MARGINAL ARTERY #1'.
LIST WCONJ21-GRAFT =
        [* Vesels used to construct grafts in CABG surgery ]
        [* NOTE: This is the list of words with attrb H-CARD-GRAFT ]
        [* in the lexicon emlex. Used in WCONJ21. As words with this ]
        [* attribute are added to the lexicon, add them to this list.]
        'SVG','LIMA','VG','RIMA', 'IMAG', 'LSVG', 'RSVG',
        'REVERSE SAPHENOUS VEIN GRAFT',
        'SAPHENOUS VEIN', 'SAPHENOUS VEIN GRAFT', 'VEIN GRAFT',
        'VEIN GRAFTS'.
LIST DOPT29-PREP =
        [* Prepositions in PDATE; used by DOPT29 and DPOS12]
        'BY','FOR','FROM','IN','ON','TO','OF','AROUND', 'BETWEEN',
        'THROUGH','THROUGHOUT','WITH'.
LIST PATIENT-LIST =
        [* PATIENT-LIST is used in WATT0-SELATT, WATT-PT. WPOS103 ]
        [* to partially resolve 'he', 'she' = H-PT/H-FAMILY. ]
        H-PT.
LIST NEG-LIST =
        [* Contains negative attribute H-NEG for COMPUTED-ATTRIBUTE]
        H-NEG.
LIST H-PTPART-LIST =
        [* Used in WPOS18B to restrict H-PTPART as predicate]
        H-PTPART.
— TYPE LISTS
—       ADJSET1 is the 'DON'T PASS THRU' argument of DESCEND; used in CORE.
—       NNN is in ADJSET1 so CORE routine does not descend through left
—       recursive NNN'S and thus reaches rightmost N in NNN in NPOS [WCONJ4A].
—       Same for ADJADJ in ADJSET1.
—       CONJ nodes are not in ADJSET1 (as in EG86M) since DCONJ5 in emgrm
—       permits CONJ nodes in LXR only after RX; thus CORE doing depth-first
—       DESCEND from LXR will not wrongly reach a CONJ node that intervenes
—       between X and RX because no such CONJ node is generated.
—       The list ADJSET1 accommodates either depth-first or breadth-first
—       search in the definition of the operator DESCEND.
TYPE ADJSET = LA, LD, LN, LP, LQ, LT, [LTIME,] LV, LW,
        RA, RD, RDATE, RLEAD, RN, RQ, RT, RV, RW, RWV,
        SA, SA-LAST.
TYPE ADJSET1 = LA, LD, LN, LP, LQ, LT, [LTIME,] LV, LW,
        ADJADJ, NNN, RA, RD, RLEAD, RN, RQ, RT, RV, RW, RWV.
TYPE RNOPTSET = ADJINRN, PDATE, PN, PQUANT, VENPASS, TOVO , TOVO-N,
        PWHS, LDR, [NPWHS,] DS, APPOS, [PERUNIT,] PDOSE,
        PVINGO, VINGO, WHS-N, WHENS, WHOSES, PAREN-RN, BPART.
TYPE CONJ-NODE = ANDSTG, ANDORSTG, ASWELLASSTG, BUTSTG, COMMASTG,
        INCLUDINGSTG, ORSTG, NORSTG, PARTICULARLYSTG,
        PLUSSTG, THANSTG, INADDITIONTOSTG.
—       TYPE SP-NODE (Special-Process node) is same list as CONJ-NODE in emgrm
—       because the scope-marking procedure has not been carried over from
—       the English parsing grammar to the medical parsing grammar. The
—       scope- marking words ('either' in 'either...or', 'neither' in
—       'neither...nor', 'both' in 'both...and)' are thus not defined in
—       emlex as SP words, and their corresponding nodes (EITHERSTG,
—       NEITHERSTG, BOTHSTG) do not appear on the list SP-NODE.
TYPE SP-NODE = ANDSTG, ANDORSTG, ASWELLASSTG, BUTSTG, COMMASTG,
        INCLUDINGSTG, ORSTG, NORSTG, PARTICULARLYSTG,
        PLUSSTG, THANSTG, INADDITIONTOSTG.
TYPE LADJSET = LA, LD, LN, LP, LQ, LT, [LTIME,] LW, LV.
TYPE LXR = LAR, LDATER, LDR, LNR, LQR, LTR, LVR, LVENR, LVINGR,
        VERB, LLEADR [ekg], LWVR [ekg].
TYPE MINLIST = PN, D, SUB1, NSTGT, PDATE, TOVO.
TYPE PSTRING = PN, PQUANT.
TYPE RADJSET = RA, RD, RDATE, RN, RNOPTS, RQ, RT, RV, RW, RWV [ekg],
        RWVOPTS [ekg], RLEAD [ekg].
TYPE RECURSIVE = TPOS, ADJADJ, NNN, RN, SA, LDR.
TYPE SEL-NODE = AVAR, IN-DIM, INTRODUCER, LD, LDR, LEADVAR, LT, LVENR,
        LVINGR, LVR, NNN, NPOS, NQ, NTIME, NVAR, PDOSE,
        PERUNIT, PN, QN, Q-OF, QVAR, RATIO, REG-ADJ, SCALESTG,
        SUB0, SUB1, SUB2, SUB3, SUB5, TENSE, TPOS, VVAR, WVVAR.
TYPE REPETITIVE = RN, RV.
TYPE STGSEG = ASSERTION, TOVO, VINGO, [QN,] SVO, VO.
TYPE STRING = ASSERTION, ADJINRN, APPOS, ASOBJBE, BPART, C1SHOULD,
        FORTOVO, FRAGMENT, IN-LEADS, LN,
        NA, NPDOSE, NPN, NPVINGO, NQ, NSTGT, NTOVO,
        OBES, PDATE, PDOSE, PN, [PNN,] PNTHATS, PQUANT,
        PSVINGO, PTIME, PVINGO, PWHERES, PWHS,
        Q-CONJ, QN-OF, QN, SASOBJBE, SENTENCE,
        SUB0, SUB1, SUB2, SUB3, SUB5, SUB6, SUB8, SUB9,
        SUB12, SUB11, SUB13, SVEN, SVO, S-N,
        THATS, TOVO, TOVO-N, TQVINGO, TSUBJVO,
        VENO, VENPASS, VINGO,
        WHATS-N, WHS-N, WHENS, WHERES, WHOSES,
        WHOSEG [6/19/97], WHETHS,
        [**** MEDICAL ****]
        ASTGF, BESHOW, NSTGF, ONESENT, [RBHIVSTG,] TVO, VO
        [**** FRENCH ****]
        [ENVINGO, FTIME, NPVO, NPWHS, NVINGO, PNPVO, PNVO,
        PVO , PVO-N]
.
TYPE VERBAL = LVR, LVENR, LVINGR, VERB.
— Routines are procedures used in restrictions to navigate the
— parse tree, based on Lingustic String Theory. The restrictions
— proper begin with DACONJ13 following the Routines.

— ************************************************** **********
—       *
—       ROUTINES *
—       *
— ************************************************** **********

ROUTINE COEL1-(X) LOCAL (X100, X500) =
        [* Given that X and Y are elements of some string. COEL1- starts]
        [* at Y and goes left or right to X. However, if X is in a string]
        [* segment, COEL1- will not go to X (the routine COELEMENT does ]
        [* it). In a situation X1Y1 CONJ X2Y2, COEL1 starting at Y2 will]
        [* go to X2. And in a situation XY1 CONJ Y2, COEL1- starting at ]
        [* Y2 will go to X.]
        EITHER $LEFT-OR-RIGHT
        OR ITERATE EITHER PRESENT-ELEMENT- HAS NODE ATTRIBUTE PRECONJELEM
        OR $ASSIGN-PRECONJELEM
        UNTIL $LEFT-OR-RIGHT SUCCEEDS.
   $LEFT-OR-RIGHT =
        EITHER DO L (X) OR DO R (X).
   $ASSIGN-PRECONJELEM =
        VERIFY $LOCATE-CONJNODE;
        VERIFY $ASSIGN-PRE-AND-POST;
        THE PRESENT-ELEMENT- HAS NODE ATTRIBUTE PRECONJELEM.
   $LOCATE-CONJNODE = ASCEND TO Q-CONJ; GO UP; STORE IN X100.
   $ASSIGN-PRE-AND-POST =
        STORE IN X500; STORE IN X0; GO TO X100;
        ITERATE $GO-LEFT UNTIL TEST FOR X500 SUCCEEDS;
        EITHER ITERATE PRESENT-ELEMENT- HAS NODE ATTRIBUTE POSTCONJELEM
        OR TRUE;
        ASSIGN PRESENT ELEMENT NODE ATTRIBUTE POSTCONJELEM;
        STORE IN X0; GO TO X500;
        ASSIGN PRESENT ELEMENT NODE ATTRIBUTE PRECONJELEM.
   $GO-LEFT =
        ITERATET $UPCONJ UNTIL GO LEFT SUCCEEDS;
        STORE IN X100.
   $UPCONJ = GO UP; TEST FOR Q-CONJ; GO UP.
ROUTINE COEL1(X) LOCAL (X100, X500, X200) =
        [* COEL1(X) is the stacking counterpart of COEL1-(X). In a situation ]
        [* (X1 CONJ X2)Y, starting at Y, COEL1 goes to X1 and stacks X2. In a]
        [* situation X1Y1 CONJ X2Y2, COEL1, starting at Y1 will go to X1 and ]
        [* will not stack X2. If the parse tree is X(Y1 CONJ Y2), starting at]
        [* either Y1 or Y2, COEL1 goes to X.]
        STORE IN X200; [** this is input to STACK-FOR-etc.]
        EITHER $LEFT-OR-RIGHT
        OR ITERATE EITHER PRESENT-ELEMENT- HAS NODE ATTRIBUTE PRECONJELEM
        OR $ASSIGN-PRECONJELEM
        UNTIL $LEFT-OR-RIGHT SUCCEEDS.
   $LEFT-OR-RIGHT =
        EITHER $LEFT-TO-X OR $RIGHT-TO-X.
   $LEFT-TO-X =
        DO L (X); DO STACK-FOR-LEFT(X200).
   $RIGHT-TO-X =
        DO R (X); DO STACK-FOR-RIGHT(X200).
ROUTINE COELEMENT-(X) =
        [* Given that X and Y are elements of some string, COELEMENT- ]
        [* starts at Y and goes to X. If X is in a string segment, ]
        [* COELEMENT- will go one level below the string segment to ]
        [* find X.]
        EITHER DO COEL1-(X) OR $STRING-SEGMENT.
   $STRING-SEGMENT = DO COEL1-(STGSEG); DO ELEMENT-(X).
ROUTINE COELEMENT(X) =
        [* The stacking counterpart of COELEMENT-. If X is in a string ]
        [* segment seg, COELEMENT will first go to seg and stack the ]
        [* conjuncts of seg if there are any. COELEMENT will then go ]
        [* to X one level below seg. If X has any conjuncts they wilL ]
        [* be stacked. If X is not in a string segment then COELEMENT ]
        [* is the same as COEL1.]
        EITHER DO COEL1(X) OR $STRING-SEGMENT.
   $STRING-SEGMENT = DO COEL1(STGSEG); DO ELEMENT(X).
ROUTINE CORE- =
        [* Looks for an atomic node or string node which is either the node ]
        [* currently being "looked at" or one that lies below this node. ]
        [* The descent does not pass through nodes on the LIST ADJSET1. ]
        [* 6/28/2000 Addition of $RIGHT-RECURSE. Without this change, CORE- ]
        [* lands on NULL under SA or RN to the right of SAOPTS or RNOPTS in ]
        [* the recursive case.]
        EITHER $RIGHT-RECURSE OR $OTHER.
   $RIGHT-RECURSE = PRESENT-ELEMENT- IS SA OR RN;
        DESCEND TO SAOPTS OR RNOPTS;
        DO $CORE-PATH.
   $OTHER = DO $CORE-PATH. (global)
   $CORE-PATH =
        ONE OF $AT-ATOM,
   $DESCEND-TO-ATOM,
   $DESCEND-TO-STRING IS TRUE.
   $AT-ATOM = TEST FOR ATOM.
   $DESCEND-TO-ATOM =
        IF BOTH PRESENT-ELEMENT- IS APOS OR NPOS
        [* see comment at TYPE ADJSET1]
        AND PRESENT-ELEMENT- IS NOT EMPTY
        THEN GO DOWN;
        DESCEND TO ATOM NOT PASSING THROUGH ADJSET1.
   $DESCEND-TO-STRING =
        IF BOTH PRESENT-ELEMENT- IS APOS OR NPOS
        [* see comment at TYPE ADJSET1]
        AND PRESENT-ELEMENT- IS NOT EMPTY
        THEN GO DOWN; [11/1/99 add APOS clause to reach string QN]
        DESCEND TO STRING NOT PASSING THROUGH ADJSET1;
        IF TEST FOR LN
        THEN $RIGHT-TO-CORE.
   $RIGHT-TO-CORE =
        ITERATE GO RIGHT UNTIL TEST FOR CONJ-NODE FAILS;
        DO CORE-.
ROUTINE CORE LOCAL(XX-CORE) =
        [* The CORE routine is the stacking counterpart of CORE-. ]
        [* The CORE may have several values because of conjunction.]
        [* If an element X1 of an LXR-type definition has conjuncts]
        [* X2, X3, then the CORE of X2, X3, etc. is "stacked", to ]
        [* be called upon in place of the CORE of X1 in the ]
        [* re-execution of the restriction. ]
        [DO $CORE-PATH - in CORE-;]
        DO CORE- [7/10/2000; revised because revised CORE- ];
        VERIFY $TO-X-POS-IN-LXR.
   $TO-X-POS-IN-LXR =
        EITHER $ASCNT OR TRUE;
        DO $STACK-CORE-TEST.
   $ASCNT = GO UP;
        TEST FOR AVAR OR NVAR OR QVAR OR VVAR OR WVVAR
        OR LEADVAR OR DATEVAR.
   $STACK-CORE-TEST =
        IF PRESENT-ELEMENT- HAS NODE ATTRIBUTE POSTCONJELEM
        THEN $STACK-CONJUNCTS.
   $STACK-CONJUNCTS = VERIFY ITERATE $STACK-CORES.
   $STACK-CORES =
        PRESENT-ELEMENT- HAS NODE ATTRIBUTE POSTCONJELEM;
        STORE IN XX-CORE;
        DO $CORE-PATH [in CORE-];
        STACK;
        GO TO XX-CORE.
ROUTINE DOWN1-(X) =
        [* Tests whether X is an element which is one level below ]
        [* the node the program is currently "looking at". ]
        GO DOWN;
        ITERATET GO RIGHT UNTIL TEST FOR X SUCCEEDS.
ROUTINE DOWN1(X) =
        [* DOWN1 is the stacking counterpart of DOWN1-. If X has ]
        [* conjuncts they are placed on a re-execution stack. ]
        DO DOWN1-(X); DO $STACK-TEST.
   $STACK-TEST = IF PRESENT-ELEMENT- HAS NODE ATTRIBUTE POSTCONJELEM
        THEN $STACK-CONJUNCTS.
   $STACK-CONJUNCTS = VERIFY ITERATE $STACK-X.
   $STACK-X = PRESENT-ELEMENT- HAS NODE ATTRIBUTE POSTCONJELEM; STACK.
ROUTINE ELEMENT-(X) =
        [* Tests whether X is an element one level below the node ]
        [* the program is currently "looking at". If not, and a ]
        [* string segment is one level below the current node, the]
        [* search continues one level below the string segment ]
        [* node. ]
        EITHER DO DOWN1-(X) OR $STRING-SEGMENT.
   $STRING-SEGMENT = DO DOWN1-(STGSEG); DO DOWN1-(X).
ROUTINE ELEMENT(X) =
        [* ELEMENT(X) is the stacking counterpart of ELEMENT-(X). ]
        [* If ELEMENT X goes to X1, and X1 has conjuncts X2, X3, ]
        [* etc., then X2, X3, etc. are placed on the re-execution ]
        [* stack. If X1 is in a string segment S, and S has ]
        [* conjuncts, then they are placed on the re-execution ]
        [* stack. ]
        EITHER DO DOWN1(X) OR $STRING-SEGMENT.
   $STRING-SEGMENT = DO DOWN1(STGSEG); DO DOWN1(X).
ROUTINE FOLLOWING-ELEMENT- =
        [* goes right to the first node which is not SP-NODE.]
        DO $RIGHT-TO-HOST [df in HOST-ELEMENT].
ROUTINE FOLLOWING-ELEMENT LOCAL(X200) =
        [* FOLLOWING-ELEMENT is the stacking counterpart of ]
        [* FOLLOWING-ELEMENT-. It goes to the FOLLOWING-ELEMENT- ]
        [* and stacks it's conjuncts. ]
        STORE IN X200;
        DO $RIGHT-TO-HOST [global, in HOST-ELEMENT];
        DO STACK-FOR-RIGHT(X200).
ROUTINE HOST- =
        [* goes to the CORE of HOST-ELEMENT.]
        CORE- OF HOST-ELEMENT EXISTS.
ROUTINE HOST =
        EITHER TEST FOR ADJSET OR ASCEND TO ADJSET;
        ONE OF $IN-LADJSET, $IN-RADJSET, $IN-RNSUBJ;
        DO $CORE-PATH [in CORE-].
   $IN-LADJSET =
        DO $AT-LADJ [global, in HOST-ELEMENT];
        DO STACK-FOR-RIGHT(X200).
   $IN-RADJSET =
        DO $AT-RADJ [global, in HOST-ELEMENT];
        DO STACK-FOR-LEFT(X200).
   $IN-RNSUBJ =
        DO $ATRNSUBJ[HOST-ELEMENT];
        DO $STACK-TEST [global, in STARTAT].
ROUTINE HOST-ELEMENT =
        [* Starts at or ascends to LADJSET or RADJSET or RNSUBJ Y. ]
        [* If Y is of type RADJSET or LADJSET it goes to the CORE X]
        [* of the LXR type node containing the LADJSET or RADJSET. ]
        [* If Y is RNSUBJ it ascends to SA-LAST, then goes to ]
        [* COELEMENT SUBJECT. *** FRENCH: change in $AT-RADJ *** ]
        EITHER TEST FOR ADJSET OR EITHER ASCEND TO ADJSET OR $PASS-RNOPTS;
        ONE OF $AT-LADJ, $AT-RADJ, $ATRNSUBJ IS TRUE.
   $PASS-RNOPTS =
        EITHER TEST FOR RNOPTSET OR ASCEND TO RNOPTSET;
        IF IMMEDIATE-NODE IS RN OR RNOPTS
        THEN ASCEND TO RN.
   $AT-LADJ =
        TEST FOR LADJSET;
        STORE IN X200;
        DO $RIGHT-TO-HOST.
   $RIGHT-TO-HOST =
        EITHER $GO-RIGHT-PAST-C
        OR ITERATE EITHER PRESENT-ELEMENT- HAS NODE ATTRIBUTE PRECONJELEM
        OR $ASSIGN-PRECONJELEM
        [global;df COEL1-,uses X100,X500]
        UNTIL $GO-RIGHT-PAST-C SUCCEEDS.
   $GO-RIGHT-PAST-C = ITERATE GO RIGHT UNTIL TEST FOR SP-NODE FAILS.
   $AT-RADJ =
        EITHER $IN-RN OR $IN-OTHERS;
        STORE IN X200;
        EITHER $RV-TEST OR $LEFT-TO-HOST.
   $IN-RN =
        TEST FOR RN;
        STORE IN X100;
        GO LEFT;
        IF PRESENT-ELEMENT- IS RNOPTS THEN [DO] $1;
        GO TO X100.
   $1 = GO UP; DO $IN-RN.
   $IN-OTHERS = TEST FOR RADJSET.
   $RV-TEST =
        TEST FOR RV;
        STORE IN X100; [** ljt: never used]
        ONE OF $VVAR, $VEN, $VING, $V.
   $VVAR = DO L(VVAR).
   $VEN = DO L(VEN).
   $VING = DO L(VING).
   $V = DO L(V).
   $LEFT-TO-HOST =
        EITHER $LEFT-PAST-C
        OR ITERATE EITHER PRESENT-ELEMENT- HAS NODE ATTRIBUTE PRECONJELEM
        OR $ASSIGN-PRECONJELEM
        [global;df COEL1-,uses X100,X500]
        UNTIL $LEFT-PAST-C SUCCEEDS.
   $LEFT-PAST-C = ITERATE GO LEFT UNTIL TEST FOR SP-NODE FAILS.
   $ATRNSUBJ =
        BOTH VALUE OF SAOPTS OF PRESENT-ELEMENT- [SA-LAST] IS RNSUBJ
        AND BOTH EITHER PRESENT-ELEMENT- IS SA-LAST
        OR ITERATE ASCEND TO SA-LAST@
        AND EITHER PRESENT-ELEMENT- X-SA HAS COELEMENT- SUBJECT
        OR EITHER ASCEND TO SUBJECT PASSING THROUGH VENPASS OR VINGO
        ['Pain radiating to the arms , relieved by nitroglycerine']
        [where 'relieved by ...' is in RNSUBJ in SA-LAST in VINGO ]
        [in RN in SUBJECT 4/27/99]
        OR AT X-SA ASCEND TO OBJECT PASSING THROUGH VENPASS OR VINGO
        WHERE PRESENT-ELEMENT- HAS COELEMENT- SUBJECT
        [for the () in 'Serum theophylline level was 38 umol / l]
        [( below the adult therapeutic range)'; the () modifies ]
        ['Serum theophylline level' via PAREN-RN in RNSUBJ.].
ROUTINE IMMEDIATE (X) =
        EITHER ASCEND TO X
        OR ITERATE $UP-CONJ UNTIL ASCEND TO X SUCCEEDS.
   $UP-CONJ = ASCEND TO Q-CONJ;
        [$UP-CONJ = IMMEDIATE-NODE- IS Q-CONJ;]
        [5/21/2002 change IMMEDIATE-NODE- to ASCEND; see DPOS28; ]
        [IMMEDIATE-NODE- blocks ascent from RV to Q-CONJ in VENPASS]
        GO UP [will be at CONJ-NODE].
ROUTINE IMMEDIATE-NODE- = GO UP.
ROUTINE IMMEDIATE-NODE =
        EITHER ITERATE $UP-CONJ OR TRUE;
        GO UP.
   $UP-CONJ = IMMEDIATE-NODE- IS Q-CONJ;
        GO UP [will be at CONJ-NODE].
ROUTINE IMMEDIATE-STRING =
        ASCEND TO STRING ;
        IF PRESENT-ELEMENT- IS Q-CONJ THEN DO IMMEDIATE-STRING.
ROUTINE INITIALRT =
        [* Tests that there is no node to the left of the node the program]
        [* is currently "looking at".]
        VERIFY NOT DO PREVIOUS-ELEMENT-.
ROUTINE IT- = PRESENT-ELEMENT- EXISTS.
ROUTINE IT = PRESENT-ELEMENT EXISTS.
ROUTINE L (X) = ITERATE GO LEFT UNTIL TEST FOR X SUCCEEDS.
ROUTINE LAST-ELEMENT- =
        [* Goes to level below the node the program is currently "looking at"]
        [* and goes to the rightmost node on that level. C-NODES are ignored.]
        GO DOWN;
        EITHER ITERATE GO RIGHT OR TRUE;
        ITERATET GO LEFT UNTIL TEST FOR SP-NODE FAILS.
ROUTINE LAST-ELEMENT =
        [* LAST-ELEMENT is the stacking counterpart of LAST-ELEMENT-. ]
        [* It goes to the LAST-ELEMENT- and STACKS it's conjuncts. ]
        DO LAST-ELEMENT-;
        DO $STACK-TEST [DOWN1].
ROUTINE LEFT-ADJUNCT =
        EITHER $ASCNT [IN CORE] OR TRUE;
        EITHER $LEFT-TO-LADJ OR $UP-AND-LEFT.
   $LEFT-TO-LADJ =
        DO L (LADJSET); EITHER TEST FOR LN OR DO CORE.
   $UP-AND-LEFT =
        ITERATET $UP-CONJ UNTIL $LEFT-TO-LADJ SUCCEEDS [GO UP TO CONJUNCTION
        AND TRY TO GO LEFT]
.
   $UP-CONJ = IMMEDIATE-NODE- IS Q-CONJ;
        GO UP [will be at CONJ-NODE].
ROUTINE LEFT-ADJUNCT-POS LOCAL(X100, X500) =
        [* Starts at the core node X of an LXR type node, or at an element ]
        [* XVAR in an LXR type node (AVAR, QVAR, NVAR, VVAR, etc.). It then ]
        [* goes left until it finds a node which is on the LADJSET list. ]
        EITHER $ASCNT [CORE] OR TRUE;
        STORE IN X200;
        EITHER DO L(LADJSET)
        OR ITERATE EITHER PRESENT-ELEMENT- HAS NODE ATTRIBUTE PRECONJELEM
        OR $ASSIGN-PRECONJELEM
        [global;df COEL1-,uses X100,X500]
        UNTIL DO L(LADJSET) SUCCEEDS.
ROUTINE LOOKAHEAD(X) =
        GO TO CURRENT WORD;
        ITERATET GO TO THE NEXT WORD UNTIL DO X SUCCEEDS.
ROUTINE NELEMRT =
        [* Called after an operator has gone to the nth element of a string ]
        [* (ignoring SPECIAL PROCESS nodes). It stacks the conjuncts of that]
        [* element.]
        DO $STACK-TEST [DOWN1].
ROUTINE NONSEG-IMMSTG =
        DO IMMEDIATE-STRING;
        EITHER $UP-THRU-SEG OR TRUE.
   $UP-THRU-SEG = TEST FOR STGSEG; STORE IN X-SEG;
        DO IMMEDIATE-NODE; TEST FOR STRING; STORE IN X-STRING.
ROUTINE PRESENT-ELEMENT =
        ITERATET $HOST-OF-CONJ UNTIL TEST FOR Q-CONJ FAILS.
   $HOST-OF-CONJ =
        GO UP [to CONJ-NODE];
        GO UP [to HOST of CONJ-NODE].
ROUTINE PRESENT-ELEMENT- = TRUE.
ROUTINE PREVIOUS-ELEMENT- =
        [* PREVIOUS-ELEMENT- is simplified the PREVIOUS-ELEMENT- in mdpar6]
        GO LEFT.
ROUTINE R (X) = ITERATE GO RIGHT UNTIL TEST FOR X SUCCEEDS.
ROUTINE RIGHT-ADJUNCT =
        EITHER $ASCNT [global, in CORE] OR TRUE;
        EITHER $RIGHT-TO-RADJ OR $UP-AND-RIGHT.
   $RIGHT-TO-RADJ=
        DO R(RADJSET); STORE IN X-RADJ; EITHER $RA OR DO CORE.
   $RA = X-RADJ IS RA; GO DOWN
        [this avoids the CORE routine's landing on <MORE-RA>]
        [in the option <PN> <MORE-RA>].
   $UP-AND-RIGHT =
        ITERATE $UP-CONJ [global, in LEFT-ADJUNCT ]
        UNTIL $RIGHT-TO-RADJ SUCCEEDS.
   $UP-CONJ = IMMEDIATE-NODE- IS Q-CONJ;
        GO UP [will be at CONJ-NODE].
ROUTINE RIGHT-ADJUNCT-POS LOCAL(X100, X500) =
        [* Similar to ROUTINE LEFT-ADJUNCT-POS except it goes right until it]
        [* finds a node which is on the list RADJSET.]
        EITHER $ASCNT [global, in CORE] OR TRUE;
        [STORE IN X200;]
        EITHER DO R (RADJSET)
        OR ITERATE EITHER PRESENT-ELEMENT- HAS NODE ATTRIBUTE PRECONJELEM
        OR $ASSIGN-PRECONJELEM
        [global;df COEL1-,local X100,X500]
        UNTIL DO R (RADJSET) SUCCEEDS.
ROUTINE STACK-FOR-LEFT(X) =
        [* STACK-FOR-LEFT goes from one element of a string to ]
        [* another element of the string by going left and calls ]
        [* STACK-FOR-LEFT to handle stacking. Given that X and Y ]
        [* are elements of a string, STACK-FOR-LEFT is assumed to]
        [* start at X after the routine which called it goes from]
        [* Y to X. In a situation (X1 CONJ X2) Y, STACK-FOR-LEFT ]
        [* will stack X2. In a situation X1 Y1 CONJ X2 Y2, ]
        [* STACK-FOR-LEFT will not stack X2. ]
        IF PRESENT-ELEMENT- HAS NODE ATTRIBUTE POSTCONJELEM
        THEN VERIFY $STACK-IF-NO-Y-RGHT.
   $STACK-IF-NO-Y-RGHT =
        IF PRESENT-ELEMENT- HAS NODE ATTRIBUTE POSTCONJELEM
        @THEN EITHER ALL OF $NO-Y-TO-RIGHT,
   $DO-STACK,
   $STACK-IF-NO-Y-RGHT
        OR TRUE.
   $NO-Y-TO-RIGHT =
        NOT ITERATE GO RIGHT UNTIL TEST FOR X SUCCEEDS.
   $DO-STACK = STACK.
ROUTINE STACK-FOR-RIGHT(X) =
        [* STACK-FOR-RIGHT goes from one element of a string to ]
        [* another element of the string by going right and calls ]
        [* STACK-FOR-RIGHT to handle stacking. Given that X and Y ]
        [* are elements of a string, STACK-FOR-RIGHT is assumed to]
        [* start at Y after the routine which called it goes from ]
        [* X to Y. In a situation X1 (Y1 CONJ Y2), STACK-FOR-RIGHT]
        [* starting at Y1 will stack Y2. In a situation ]
        [* X1 Y1 CONJ X2 Y2, STACK-FOR-RIGHT will not stack Y2. ]
        IF PRESENT-ELEMENT- HAS NODE ATTRIBUTE POSTCONJELEM
        THEN VERIFY $STACK-IF-NO-Y-LEFT.
   $STACK-IF-NO-Y-LEFT =
        IF PRESENT-ELEMENT- HAS NODE ATTRIBUTE POSTCONJELEM
        @THEN EITHER ALL OF $NO-Y-TO-LEFT,
   $DO-STACK,
   $STACK-IF-NO-Y-LEFT
        OR TRUE.
   $NO-Y-TO-LEFT =
        NOT ITERATE GO LEFT UNTIL TEST FOR X SUCCEEDS.
   $DO-STACK = STACK.
ROUTINE STARTAT (X) = EITHER TEST FOR X
        OR DO DOWN1-(X)[** ljt: this is slow].
ROUTINE SUBSUMERT(X) LOCAL(X150) =
        [* Searches for a word of given class (and subclass) which is ]
        [* matched to any atomic node on the subtree below the node ]
        [* that the program is currently "looking at", i. e. which is ]
        [* subsumed by the current node.]
        VERIFY $2;
        GO TO THE WORD STARTING THE PRESENT NODE; STORE IN X-START;
        NOT TEST FOR X150;
        ITERATET $1 UNTIL DO X SUCCEEDS.
   $1 = GO TO THE NEXT WORD; STORE IN X-NEXT; NOT TEST FOR X150.
   $2 = GO TO THE WORD FOLLOWING THE PRESENT NODE; STORE IN X150.
— ********** **************************************** **********
—       *
—       EXTENDED SCOPE ROUTINES *
—       *
— ********** **************************************** **********

ROUTINE EXTENDED-CORE- LOCAL(X5) =
        [* Goes to the CORE. If the CORE is NULLWH, this routine goes up]
        [* to the RN and from there to the host noun. Simplified version]
        [* of the same routine in the MDPAR6]
        DO CORE-;
        IF BOTH PRESENT-ELEMENT- IS NULLWH
        AND $PATH-WWH1 [WWH1; X5=WHS-N]
        THEN AT X5 DO HOST-.
   $PATH-WWH1 = EITHER NONSEG-IMMSTG X5 IS WHS-N
        OR $NESTED.
   $NESTED = NONSEG-IMMSTG IS THATS OR TOVO OR ASSERTION
        OR VENO OR VENPASS; DO $PATH-WWH1.
ROUTINE DEEPEST-COPRED LOCAL(X5) =
        ONE OF $DEEPBE, $ZEROBE, $PASSOBJBE IS TRUE.
   $DEEPBE =
        CORE OF THE DEEPEST-COVERB- X5 IS VBE OR BEREP;
        X5 HAS A COELEMENT OBJECT;
        DESCEND TO OBJBE.
   $ZEROBE = THE PRESENT-ELEMENT- HAS COELEMENT OBJBE.
   $PASSOBJBE =
        X5 IS OCCURRING IN VENPASS;
        X5 HAS A COELEMENT PASSOBJ;
        DESCEND TO OBJBE PASSING THROUGH ASOBJBE.
— DEEPEST-COVERB-:
—       Motivation for "DEEPEST" routines: Because in this grammar the
—       main verb of an ASSERTION is the first verb of a group (e.g.
—       'was' in 'stent was placed') it is necessary to "look through"
—       this verb (or a series of such intervening verbs, as in 'stent
—       was thought to have been placed') to reach the verb that is
—       constrained selectionaly by the subject; for example,
—       to test the different use of 'placed' in 'Stent was placed' vs.
—       'Patient was placed [in convalescent home]'. The former is a
—       surgical act (H-TTSURG) and the latter is an act of general
—       medical management (H-TTGEN). See WATT-PLACED, also WATT-COME
—       and other WATT (Wellformed ATTribute) restrictions.
—       DEEPEST-COVERB- starts at any element except the verb of a
—       verb-containing string (usually at SUBJECT) and goes first
—       to the verb in the string. If that verb has a verb-containing
—       object (or a predicate consisting of an AASP+TOVO) then it
—       goes to the verb in that object (or TOVO), where it repeats
—       the test for a verb-containing object. The iteration ends on the
—       verb which doesn't have a verb-containing object (or predicate).
—       USER BEWARE: Shift of subject-object relation in the passive
—       must be handled by the restriction using the routine.
ROUTINE DEEPEST-COVERB- LOCAL(X7,XX-COVERB) =
        ITERATE $NEXT-VERB UNTIL $OBJ-HAS-VERB FAILS.
   $NEXT-VERB = PRESENT-ELEMENT- HAS COELEMENT- VERB OR LVINGR
        OR LVENR OR LVR
        [OR VERB1 X7 this is for question strings].
   $OBJ-HAS-VERB = BOTH $VERBAL-NO-STACK
        @AND PRESENT-ELEMENT- HAS ELEMENT- PASSOBJ OR OBJECT.
   $VERBAL-NO-STACK =
        PRESENT-ELEMENT- HAS COELEMENT- OBJECT OR PASSOBJ;
        EITHER CORE- X-OBJSTG IS VO OR VINGO OR TOVO [OR TOBE]
        OR VENO OR VENPASS
        [WHERE X-OBJSTG IS NOT OCCURRING IN SN,]
        OR AT X-OBJSTG BOTH PRESENT-ELEMENT- IS ADJ:AASP
        AND RIGHT-ADJUNCT IS TOVO.
ROUTINE ULTIMATE-SUBJECT =
        [* Similar motivation as DEEPEST-COVERB- but ascends to SUBJECT ]
        [* rather than descends to verb. ]
        [* Iteratively ascends to OBJECT or PASSOBJ passing through ]
        [* verb-containing object strings until it finds an object that ]
        [* has a COELEMENT SUBJECT. It also ascends past predicate nouns ]
        [* and adjectives and their adjuncts as long as the adjuncts do ]
        [* not contain the node SUBJECT. ]
        [* Note that the DEEPEST-COVERB- descends more narrowly than the ]
        [* ULTIMATE-SUBJECT, passing through verb-containing object ]
        [* strings and TOVO as adjunct of AASP, but not through other ]
        [* predicates or adjuncts. Use DEEPEST-COVERB in selectional ]
        [* restrictions (not ULTIMATE-SUBJECT) because 'it' is the ]
        [* ULTIMATE SUBJECT of e.g. 'swim' in both 'It likes to swim' and]
        [* 'It is fun to swim'. ]
        EITHER $COELSUBJ
        OR ITERATET $UP-TO-OBJ UNTIL $COELSUBJ SUCCEEDS.
   $UP-TO-OBJ =
        EITHER ASCEND TO OBJECT OR PASSOBJ PASSING THROUGH VENO OR
        VINGO OR VENPASS OR TOVO OR VO OR Q-CONJ,
        OR ASCEND TO OBJBE PASSING THROUGH VENO OR VENPASS OR TOVO OR
        VO OR Q-CONJ.
   $COELSUBJ = THE PRESENT-ELEMENT- HAS COELEMENT- SUBJECT [OR TPOS].
ROUTINE VERB-COELEMENT- = PRESENT-ELEMENT- HAS COELEMENT- VERB OR
        LVINGR OR LVENR OR LVR.
ROUTINE VERB-COELEMENT = PRESENT-ELEMENT- HAS COELEMENT VERB OR
        LVINGR OR LVENR OR LVR.
ROUTINE ULTIMATE-HOST =
        ITERATET $UP-TO-OBJ UNTIL $RNHOST SUCCEEDS.
   $UP-TO-OBJ =
        ASCEND TO OBJECT OR PASSOBJ PASSING THROUGH VENO OR
        VINGO OR VENPASS OR TOVO OR VO OR Q-CONJ.
   $RNHOST =
        PRESENT-ELEMENT- IS OCCURRING IN VINGO OR VENPASS
        WHERE HOST- OF IMMEDIATE RNOPTS EXISTS.
— ********** **************************************** **********
—       *
—       CONJUNCTION ROUTINES *
—       *
— ********** **************************************** **********

ROUTINE CO-CONJ(X) LOCAL(X300, X200) =
        STORE IN X200;
        EITHER $COELEMENT OR $STRING-SEGMENT.
   $COELEMENT = DO COEL1-(X); DO $NOT-XY-CONJ-XY.
   $NOT-XY-CONJ-XY =
        ITERATE BOTH PRESENT-ELEMENT- HAS NODE ATTRIBUTE POSTCONJELEM
        @AND NEITHER $Y-TO-RIGHT NOR $Y-TO-LEFT.
   $Y-TO-RIGHT= ITERATE GO RIGHT UNTIL TEST FOR X200 SUCCEEDS.
   $Y-TO-LEFT= ITERATE GO LEFT UNTIL TEST FOR X200 SUCCEEDS.
   $STRING-SEGMENT =
        BOTH $GO-THRU-SEG-TO-X
        @AND EITHER IT HAS NODE ATTRIBUTE POSTCONJELEM
        OR AT X300 $NOT-XY-CONJ-XY IS TRUE.
   $GO-THRU-SEG-TO-X =
        DO COEL1-(STGSEG);
        STORE IN X300;
        DO ELEMENT-(X).
ROUTINE CONJELEM- LOCAL(X200) =
        [* Similar to CONJELEM except starting node must be directly below]
        [* Q-CONJ.]
        STORE IN X200;
        ITERATE $UP-2-IF-CONJ UNTIL $FIND-X200 SUCCEEDS.
   $UP-2-IF-CONJ = IMMEDIATE-NODE- IS Q-CONJ; GO UP.
   $FIND-X200 = ITERATE GO LEFT UNTIL TEST FOR X200 SUCCEEDS.
ROUTINE CONJELEM LOCAL(X100,X500,X200,X600) =
        [* CONJELEM: Inverse of CORE-CONJUNCT. Starts at the conjunct of X ]
        [* and goes to X. In a situation X1Y1 CONJ X2Y2, starting at X2, ]
        [* CONJELEM will go to X1. ]
        EITHER $ATQ OR $UPQ;
        EITHER PRESENT-ELEMENT- HAS NODE ATTRIBUTE PRECONJELEM
        OR $ASSIGN-PRECONJELEM;
        [global;df COEL1-,local X100,X500]
        EITHER TEST FOR X600 OR DESCEND TO X600.
   $ATQ =
        TEST FOR Q-CONJ;
        GO DOWN;
        STORE IN X600;
        STORE IN X200.
   $UPQ =
        STORE IN X600;
        STORE IN X200;
        GO UP;
        ITERATET $UPQ1 UNTIL TEST FOR Q-CONJ SUCCEEDS;
        GO TO X200.
   $UPQ1 =
        STORE IN X200;
        NOT TEST FOR STRING;
        GO UP.
ROUTINE CORE-CONJUNCT =
        [* Starting at the given node, CORE-CONJUNCT descends to the core]
        [* and then goes to its conjunct. ]
        DO $CORE-PATH [CORE-];
        EITHER $ASCNT [CORE] OR TRUE;
        PRESENT-ELEMENT- HAS NODE ATTRIBUTE POSTCONJELEM;
        DO $CORE-PATH.
ROUTINE PRE-POST-CONJELEM LOCAL(X100,X500) =
        [* Routine must start at a CONJ-NODE, 1 node above Q-CONJ. ]
        [* Given that string Q-CONJ has elements F1 F2 ... Fn which are ]
        [* in corresponding positions to the elements E1 E2 ... En of the ]
        [* pre-conjunction string, i.e. the nodes to the left of the ]
        [* SPECIAL PROCESS NODE one level above Q-CONJ, then to each Fi ]
        [* this routine assigns the node attribute PRECONJELEM with value ]
        [* Ei and to each Ei the node attribute POSTCONJELEM with value Fi.]
        STORE IN X100;
        DO ELEMENT- (Q-CONJ); DO LAST-ELEMENT-;
        ITERATE VERIFY $ASSIGN-TEST UNTIL GO LEFT FAILS.
$ASSIGN-TEST =
        EITHER TEST FOR SP-NODE
        OR EITHER PRESENT-ELEMENT- HAS NODE ATTRIBUTE PRECONJELEM
        OR $ASSIGN-PRE-AND-POST.
   $ASSIGN-PRE-AND-POST =
        [* same code appears in COEL1- ]
        STORE IN X500; STORE IN X0; GO TO X100;
        ITERATE $GO-LEFT UNTIL TEST FOR X500 SUCCEEDS;
        EITHER ITERATE PRESENT-ELEMENT- HAS NODE ATTRIBUTE POSTCONJELEM
        OR TRUE;
        ASSIGN PRESENT ELEMENT NODE ATTRIBUTE POSTCONJELEM;
        STORE IN X0;
        AT X500 ASSIGN PRESENT ELEMENT NODE ATTRIBUTE PRECONJELEM.
   $GO-LEFT =
        ITERATET $UPCONJ UNTIL GO LEFT SUCCEEDS;
        STORE IN X100.
   $UPCONJ = GO UP; TEST FOR Q-CONJ; GO UP.
— ********** **************************************** **********
—       *
—       ROUTINES FOR SELECTION *
—       *
— ********** **************************************** **********

ROUTINE COMPLEMENT =
[* Takes the complement of list stored in register X-SUBLIST. the ]
[* complete list is assumed to be present location. COMPLEMENT creates]
[* a list stored in X-COMPLEMENT which consists of all those elements ]
[* on current list that are not on X-SUBLIST. ]
        X-CURRENTLIST:= PRESENT-ELEMENT-;
        X-COMPLEMENT:= NIL;
        ITERATE BOTH X-HEAD2:= HEAD OF X-CURRENTLIST
        AND IF X-SUBLIST DOES NOT HAVE MEMBER X-HEAD2
        THEN $ADD-TO-COMP
        UNTIL X-CURRENTLIST:= SUCCESSORS OF X-CURRENTLIST WHERE
        X-CURRENTLIST IS NIL SUCCEEDS;
        GO TO X-COMPLEMENT.
   $ADD-TO-COMP =
        IF X-ATTL := ATTRIBUTE-LIST OF X-CURRENTLIST
        THEN PREFIX X-HEAD2:X-ATTL TO X-COMPLEMENT
        ELSE PREFIX X-HEAD2 TO X-COMPLEMENT.
ROUTINE CORE-ATT =
[* Returns an attribute list for its present location, looking for ]
[* an attribute list in the following order ]
[* 1. computed attribute list, stored as value of node attribute ]
[* 'COMPUTED-ATT'; ]
[* 2. selectional attribute list, stored as value of node attribute]
[* 'SELECT-ATT'; ]
[* 3. attribute list of word, pruned to contain only selectionally ]
[* relevant classes, as defined by the list SUBLANGUAGE-ATTS ]
[* (uses intersect, to obtain intersection of SUBLANGUAGE-ATTS ]
[* and ATTRIBUTE list). ]
        EITHER PRESENT-ELEMENT- HAS NODE ATTRIBUTE COMPUTED-ATT
        OR EITHER PRESENT-ELEMENT- HAS NODE ATTRIBUTE SELECT-ATT
        OR ATTRIBUTE-LIST X-NEWLIST EXISTS
        WHERE BOTH X-SUBLANGUAGE-ATTS := LIST SUBLANGUAGE-ATTS
        AND INTERSECT OF X-SUBLANGUAGE-ATTS IS NOT NIL.
ROUTINE CORE-SELATT =
[* Returns an attribute list for its present location, looking for an]
[* attribute list in the following order ]
[* 1. select attribute list, store as value of node attribute ]
[* 'SELECT-ATT'. ]
[* 2. attribute list of word, pruned to contain only selectionally ]
[* relevant classes, as defined by the list SUBLANGUAGE-ATTS (uses ]
[* routine intersect to obtain intersection of SUBLANGUAGE-ATTS and ]
[* ATTRIBUTE list. ]
        EITHER PRESENT-ELEMENT- HAS NODE ATTRIBUTE SELECT-ATT
        OR ATTRIBUTE-LIST X-NEWLIST EXISTS WHERE
        BOTH X-SUBLANGUAGE-ATTS:= LIST SUBLANGUAGE-ATTS
        AND INTERSECT OF X-SUBLANGUAGE-ATTS IS NOT NIL.
ROUTINE INTERSECT =
[* Takes intersection of list in current location with list stored ]
[* in register X-NEWLIST, and creates the list representing the ]
[* intersection (including attribute lists of the intersecting ]
[* elements). the new list representing the intersection is stored ]
[* in register X-INTERSECTION; the routine finishes located at this]
[* list (X-INTERSECTION). ]
[* ** note that it is the list stored in x-newlist whose members ]
[* ** (and possible attribute lists) are copied. ]
[* ]
[*** warning ]
[* if register X-NEWLIST does not point to a list, the routine ]
[* will fail; if the routine does not start at an atom or a list,]
[* the intersection will be empty. ]
        X-CURRENTLIST:= PRESENT-ELEMENT-;
INTERSECT X-NEWLIST WITH X-CURRENTLIST INTO X-INTERSECTION.
ROUTINE UNION =
[* computes the set-theoretic union of two sets;]
[* one set is passed in ]
[* stored in the register X-UNION; ]
[* the routine must begin from the ]
[* second list (set); it checks that ]
[* each element from the current list ]
[* (stored in X-ADD-TO-UNION) is either ]
[* already on list X-UNION or if ]
[* not, it is prefixed to X-UNION. ]
[* the union is returned in register ]
[* X-UNION, which is also where the ]
[* routine leaves you. if the initial ]
[* list is nil (empty), union will ]
[* return whatever list is stored ]
[* in X-UNION. ]
        IF PRESENT-ELEMENT- IS NOT NIL
        THEN $ADD-TO-UNION
        ELSE GO TO X-UNION.
   $ADD-TO-UNION =
        X-ADD-TO-UNION := PRESENT-ELEMENT-;
        ITERATE BOTH X-ADD-EL-TO-UNION := HEAD OF X-ADD-TO-UNION
        AND IF X-UNION DOES NOT HAVE MEMBER X-ADD-EL-TO-UNION
        THEN IF ATTRIBUTE-LIST X-ATTRB-UNION OF X-ADD-TO-UNION
        EXISTS
        THEN PREFIX X-ADD-EL-TO-UNION: X-ATTRB-UNION TO
        X-UNION
        ELSE PREFIX X-ADD-EL-TO-UNION TO X-UNION
        UNTIL SUCCESSORS X-ADD-TO-UNION OF X-ADD-TO-UNION IS NIL SUCCEEDS;
        GO TO X-UNION.
— ********** **************************************** **********
— ********** **************************************** **********
—       *
—       RESTRICTIONS *
—       *
— ************************************************************
— Restrictions are organized into the following sections:
— EDIT RESTRICTIONS
— AGREEMENT RESTRICTIONS
— ATTRIBUTE ASSIGNMENT RESTRICTIONS
— COMMA RESTRICTIONS
— COMPUTED ATTRIBUTE RESTRICTIONS
— CONJUNCTION RESTRICTIONS
— EKG RESTRICTIONS
— MIN-WORD RESTRICTIONS
— NOUN PHRASE RESTRICTIONS
— NULLC RESTRICTIONS
—       DNULLC-INDEX
— OPTIMIZATION RESTRICTIONS
— PAREN RESTRICTIONS
— POSITION RESTRICTIONS
—       DPOSINDEX
—       WPOSINDEX
— SELECTION RESTRICTIONS
— SENTENCE NOMINALIZATION (SN) RESTRICTIONS
— WH-STRING RESTRICTIONS
— ZEROING RESTRICTIONS
— PHRASE-MARKING RESTRICTIONS WPHRASE-XXX

— *************************************************************
— EDIT RESTRICTIONS
— An EDIT restriction must be the first restriction to be executed
— on the node where it is housed. Because restrictions housed on a
— node are executed in alphabetic order, a Disqualify restriction
— Dxxx that contains an EDIT command is renamed DAxxx to ensure it
— is executed first. E.g. DVC1 -> DAVC1.

DACONJ13 =
        [* Restricts which options of RNOPTS can be conjoined. ]
        [* For example, only a dose string DS can conjoin a ]
        [* dose string DS ($SET1 below); only a VENPASS or VINGO ]
        [* can conjoin a VENPASS or VINGO ($SET2 below: OK 'the ]
        [* patient seen in the ER and being admitted'; *'the ]
        [* patient seen in the ER and resolutely'). ]
        [* RNOPTS is starting point where options will be edited. ]
        [* X2 is RN immediately above starting RNOPTS, below Q-CONJ.]
        [* CONJELEM of X2 is upper RN; its value is RNOPTS (in X-RNOPTS).]
        [* X3 is value of X-RNOPTS to be compared with current options. ]
        IN RNOPTS:
        IF BOTH IMMEDIATE-NODE- X1 OF IMMEDIATE-NODE- IS Q-CONJ
        [starting at RNOPTS up to RN then up to Q-CONJ]
        AND VALUE X2 OF X1 IS RN
        [back down to RN from Q-CONJ]
        WHERE IT IS NOT THE CASE THAT COELEMENT- NVAR EXISTS
        [have RN CONJ RN structure]
        THEN BOTH AT CONJELEM OF X2
        BOTH $NEST-RN
        @AND VALUE X3 OF X-RNOPTS EXISTS
        AND ONE OF $SET1, $SET2, $SET3, $SET4, $SET5.
   $NEST-RN =
        ELEMENT- RNOPTS X-RNOPTS EXISTS;
        IF COELEMENT- RN IS NOT EMPTY
        @THEN $NEST-RN.
   $SET1 = X3 IS DS;
        EDIT BY $SET1-TEST.
   $SET1-TEST = TEST FOR DS.
   $SET2 = X3 IS VENPASS OR VINGO;
        EDIT BY $SET2-TEST.
   $SET2-TEST = TEST FOR VENPASS OR VINGO
        [OR ADJINRN 2/10/00].
   $SET3 = X3 IS PN;
        EDIT BY $SET3-TEST.
   $SET3-TEST = TEST FOR PDATE OR PN OR ADJINRN OR QUANT OR PQUANT
        [OR VENPASS not "of steroids and advised to.."].
   $SET4 = X3 IS BPART;
        EDIT BY $SET4-TEST.
   $SET4-TEST = TEST FOR BPART.
   $SET5 = X3 IS PQUANT;
        EDIT BY $SET5-TEST.
   $SET5-TEST = TEST FOR PQUANT OR QUANT
        [X3 IS PDATE OR QUANT OR LDR OR TOVO OR PQUANT OR WHS-N OR]
        [TOVO-N OR WHENS. ??].
DACONJ14 =
        [* Compatible values of RV in 'RV CONJ RV'. Edit the options ]
        [* of lower RV using "TEST FOR ..." according to the value of]
        [* the upper RV which is stored in X3. ]
        IN RV:
        IF BOTH IMMEDIATE-NODE- X1 IS Q-CONJ
        AND NOT $VERB-EXISTS
        [have RV conj RV]
        THEN AT PRESENT-ELEMENT- X2
        IF CONJELEM OF X2 [upper RV] IS NOT EMPTY
        THEN AT VALUE X3 [test for compatible CONJ]
        ONE OF $SET1, $SET2, $SET3, $SET4, $SET5, $SET6, $SET7.
   $VERB-EXISTS =
        GO LEFT;
        TEST FOR VING OR V OR VEN OR VVAR.
   $SET1 = X3 IS QN OR PQUANT;
        EDIT BY $SET1-TEST.
   $SET1-TEST = TEST FOR QN OR PQUANT.
   $SET2 = X3 IS PN;
        EDIT BY $SET2-TEST.
   $SET2-TEST = TEST FOR PN.
   $SET22 = X3 IS LDR
        [not '..to the back and there (was)..LDR=there];
        EDIT BY $SET22-TEST.
   $SET22-TEST = TEST FOR LDR.
   $SET3 = X3 IS PDATE OR NSTGT;
        EDIT BY $SET3-TEST.
   $SET3-TEST = TEST FOR PDATE OR NSTGT.
   $SET4 = X3 IS THATS OR ASSERTION;
        EDIT BY $SET4-TEST.
   $SET4-TEST = X3 IS THATS OR ASSERTION.
   $SET5 = X3 IS PN OR PQUANT;
        EDIT BY $SET5-TEST.
   $SET5-TEST = TEST FOR PN OR PQUANT.
   $SET6 = X3 IS C1SHOULD;
        EDIT BY $SET6-TEST.
   $SET6-TEST = TEST FOR C1SHOULD.
   $SET7 = X3 IS TOVO;
        EDIT BY $SET7-TEST.
   $SET7-TEST = TEST FOR TOVO.
DACONJ15 =
        [* Compatible values of SAOPTS in conjoined SA-LASTs, i.e. ]
        [* in 'SA-LAST CONJ SA-LAST'. Edit the options of SAOPTS in ]
        [* lower SA-LAST using "TEST FOR ..." according to the value]
        [* of SAOPTS in the upper SA-LAST which is stored in X3. ]
        [* E.g. reject LDR CONJ VENPASS ('there and returned to the ]
        [* ACU in stable condition' in the sentence 'The patient ]
        [* underwent the procedure there and returned to the ACU in ]
        [* stable condition'. ]
        IN SAOPTS:
        IF IMMEDIATE-NODE- OF PRESENT-ELEMENT- X2 IS SA-LAST X1
        WHERE BOTH IMMEDIATE-NODE- IS Q-CONJ
        AND AT X1 NOT VERB-COELEMENT- EXISTS
        [have conjoined SA-LASTs]
        THEN AT X2 [lower SAOPTS, starting point of restriction ]
        [where EDIT is done to ensure compatible CONJ]
        BOTH AT CONJELEM OF X2 VALUE X3 EXISTS
        AND ONE OF $SET0, $SET1, $SET2, $SET3, $SET4.
   $SET0 = X3 IS NULL;
        EDIT BY $SET0-TEST.
   $SET0-TEST = TEST FOR NULL.
   $SET1 = X3 IS PVINGO;
        EDIT BY $SET1-TEST.
   $SET1-TEST = TEST FOR PVINGO.
   $SET2 = X3 IS PN;
        EDIT BY $SET2-TEST.
   $SET2-TEST = TEST FOR PN.
   $SET22 = X3 IS LDR;
        EDIT BY $SET22-TEST.
   $SET22-TEST = TEST FOR LDR.
   $SET3 = X3 IS PDATE OR NSTGT;
        EDIT BY $SET3-TEST.
   $SET3-TEST = TEST FOR PDATE OR NSTGT.
   $SET4 = X3 IS TOVO;
        EDIT BY $SET7-TEST.
   $SET4-TEST = TEST FOR TOVO
        [Aspirin was given to relieve pain and to bring down fever].
DAOPT8 =
        [* set LN=0 when current word is PRO, but exempt TPOS because ]
        [* LE, LA are both PRO and T (French), and exempt PRO that is ]
        [* also Q (English "one"); also set LN=0 at '.' or ';' or '#' ]
        [* or '('. ]
        IN QPOS, APOS:
        IF EITHER CURRENT WORD IS '.' OR ';' OR '#' OR '('
        OR BOTH CURRENT WORD IS PRO
        AND CURRENT WORD IS NOT Q OR ADJ
        THEN EDIT BY $1.
   $1 = TEST FOR NULL.
DAOPT9 =
        [* set RN=0 in LNR in BPART:'AP pelvis' but not 'AP pelvis centered]
        [* over pubis' as BPART; 'centered over pubis' here belongs to 'AP']
        IN RN:
        IF PRESENT-ELEMENT- IS OCCURRING IN BPART
        THEN EDIT BY $1.
   $1 = TEST FOR NULL.
DAPOS13 =
        [* A subset of SA can occur after a conjunction ('and as a rule..')]
        IN SAOPTS RE OPTION 1:
        IF PRESENT-ELEMENT- IS OCCURRING IN SACONJ
        THEN EDIT BY $1.
   $1 = TEST FOR LDR OR PN.
DAPOS22 =
        [* Restrict RNOPTS in LNR in INTRODUCER to LDR ('problems now'), ]
        [* PDATE ('findings 00/00/00'), QUANT ('problem 1'), ADJINRN ]
        [* ('symptoms present'), PN ('history of present illness'). ]
        IN RNOPTS RE OPTION 1:
        IF IMMEDIATE INTRODUCER EXISTS
        THEN EDIT BY $1.
   $1 = TEST FOR ADJINRN OR LDR OR QUANT OR PDATE OR PN.
DAVC1 =
        [* Allow only options of OBJECT that are on the OBJLIST of governing ]
        [* verb; rejects 'Results mean.' ('mean' requires object). ]
        IN OBJECT RE OPTION 1:
        ONE OF $NULLFRAG, $NULLC, $OBJECT-STRING.
   $NULLFRAG = VALUE X-VAL OF COELEMENT- VERB X-VERB IS NULLFRAG;
        EDIT BY $NULLFRAG-ONLY.
   $NULLFRAG-ONLY = TEST FOR NULLFRAG.
   $NULLC =
        X-VAL IS NULLC; EDIT BY $NULLC-ONLY.
   $NULLC-ONLY = TEST FOR NULLC.
   $OBJECT-STRING [conj test added 5/6/96] =
        X3 := PRESENT-ELEMENT;
        CORE OF VERB-COELEMENT X-VERBAL HAS ATTRIBUTE OBJLIST X10;
        X10 HAS ATTRIBUTE ANYTHING X20;
        AT X3 BOTH $COMBINE-IF-CONJ ['persists and was...']
        AND EDIT BY $1.
   $1 = TEST FOR X20; VERIFY $P-OBJECT; VERIFY $WCOM4.
   $COMBINE-IF-CONJ =
        IF AT X-VERBAL ELEMENT- CONJ-NODE EXISTS
        WHERE AT ELEMENT- Q-CONJ CORE- IS V OR TV OR VING OR VEN
        [* not RV CONJ RV]
        THEN ITERATET $COMBINE UNTIL $HAS-CONJUNCT FAILS.
   $HAS-CONJUNCT =
        AT X-VERBAL
        ELEMENT- CONJ-NODE EXISTS;
        ELEMENT- Q-CONJ X-VERBAL EXISTS.
   $COMBINE =
        GO DOWN;
        ITERATET GO RIGHT UNTIL TEST FOR VVAR OR V OR VEN OR VING SUCCEEDS;
        CORE- HAS ATTRIBUTE OBJLIST X10;
        X10 HAS ATTRIBUTE ANYTHING X30;
        INTERSECT X20 WITH X30 INTO X20;
        STORE IN X20 [this line to see X20 in trace].
   $P-OBJECT = IF PRESENT-ELEMENT- IS PN OR NPN OR NPVINGO OR PVINGO
        OR PSVINGO OR PNTHATS X11
        THEN AT X3 $PROPER-P-AHD IS TRUE.
   $PROPER-P-AHD = X10 HAS ATTRIBUTE X11: PVAL X2;
        GO TO CURRENT WORD;
        ITERATET GO TO NEXT WORD UNTIL $P-WORD SUCCEEDS.
   $P-WORD = TEST FOR P; STORE IN X12;
        LISTS X2 AND X12 HAVE A COMMON ATTRIBUTE.
   $WCOM4 =
        IF AT X3, WORD PRECEDING THE PRESENT NODE IS ','
        THEN EITHER $NULLOBJ-TEST
        OR AT X3, ONE OF $INCONJSTG, $PREVSA.
   $NULLOBJ-TEST =
        TEST FOR NULLOBJ.
   $PREVSA =
        BOTH PREVIOUS-ELEMENT- X1 IS SA OR SACONJ, AND X1 IS NOT EMPTY.
   $INCONJSTG = IMMEDIATE-NODE- IS Q-CONJ.
DAVC2 =
        [* Allow options of PASSOBJ that are on POBJLIST of VEN in LVENR.]
        IN PASSOBJ RE OPTION 1:
        X3 := PRESENT-ELEMENT-;
        CORE- OF COELEMENT- LVENR X-LVENR HAS ATTRIBUTE POBJLIST X10;
        X10 HAS ATTRIBUTE ANYTHING X20;
        AT X3 BOTH $COMBINE-IF-CONJ
        AND EDIT BY $1.
   $1 = TEST FOR X20; VERIFY $WCOM4.
   $COMBINE-IF-CONJ =
        ITERATET $COMBINE UNTIL $HAS-CONJUNCT FAILS.
   $HAS-CONJUNCT =
        AT X-LVENR
        ELEMENT- CONJ-NODE EXISTS;
        ELEMENT- Q-CONJ X-LVENR EXISTS.
   $COMBINE =
        GO DOWN;
        ITERATET GO RIGHT UNTIL TEST FOR VEN SUCCEEDS;
        CORE- HAS ATTRIBUTE POBJLIST X10;
        X10 HAS ATTRIBUTE ANYTHING X30;
        INTERSECT X20 WITH X30 INTO X20;
        STORE IN X20 [this line to see X20 in trace].
   $WCOM4 =
        IF AT X3, WORD PRECEDING THE PRESENT NODE IS ','
        THEN EITHER $NULLOBJ-TEST
        OR AT X3, ONE OF $INCONJSTG, $PREVSA.
   $NULLOBJ-TEST =
        TEST FOR NULLOBJ.
   $PREVSA =
        BOTH PREVIOUS-ELEMENT- X1 IS SA OR SACONJ, AND X1 IS NOT EMPTY.
   $INCONJSTG = IMMEDIATE-NODE- IS Q-CONJ.
— AGREEMENT RESTRICTIONS

WAGREE =
        [* SUBJECT and VERB agree in number. This rules out *'Cats eats']
        [* and *'The cat eat'.]
        IN ASSERTION AFTER VERB:
        BOTH $SET-UP
        AND EITHER $VERB-BE
        OR BOTH $SINGAGREE AND $PLURAGREE.
   $SET-UP = CORE- X1 OF ELEMENT- VERB X-VERB EXISTS;
        CORE- X2 OF COELEMENT- SUBJECT X-SUBJ OF X-VERB EXISTS;
        STORE IN X20;
        [* get to a non-null subject above using LINKC jumps ]
        [* when value of SUBJECT is NULLC, assigned in WZERO6]
        ITERATET STORE IN X2 UNTIL $LINKC FAILS.
   $LINKC = PRESENT-ELEMENT- HAS NODE ATTRIBUTE LINKC.
   $VERB-BE = BOTH X1 IS TV:VBE
        [* When the singular subject of tensed verb BE (e.g. 'graft']
        [* in the follwing example) is followed by an adjunct or ]
        [* adjuncts containing a conjunction, subject-verb number ]
        [* agreement may not be respected: 'Saphenous vein graft ]
        [* to the left anterior descending and right coronary artery]
        [* were 100 % stenotic']
        AND IF X1 IS SINGULAR
        THEN EITHER X-SUBJ SUBSUMES SPWORD
        OR X2 IS 'ADJUSTMENTS' [expand as needed]
        [* Adjustments of her Synthroid was felt to be unadvisable].
   $SINGAGREE =
        IF X1 IS SINGULAR
        THEN EITHER X2 IS 'IMPRESSIONS' [impressions of myself..is; MGH]
        OR $SUBJNOTPLUR.
   $SUBJNOTPLUR = AT X2
        EITHER [analysis of 'N and N-sing were/which were ...']
        BOTH EXTENDED-CORE- X2 IS NOT PLURAL
        [* 'fever which was..', *'fever which were..' ]
        [* if core- is NULLWH, EXTENDED-CORE- stores HOST- in X2]
        AND NEITHER $Q-CONJ-BELOW NOR $Q-CONJ-ABOVE
        OR BOTH X20 IS NULLWH
        AND EXTENDED-CORE- X2 IS NOT PLURAL
        [* just lower N-sing gets WH]
        [* analysis of 'N and N-sing which was ...'].
   $Q-CONJ-BELOW = X20 IS NOT NULLWH;
        [* go to CORE- of deepest conjunct; ]
        [* check if is pluralizing conjstring ]
        [* 'Fever and nausea were the symptoms'. ]
        AT X2
        ITERATE CORE-CONJUNCT EXISTS;
        ASCEND TO Q-CONJ;
        IMMEDIATE-NODE- IS ANDSTG OR PLUSSTG OR COMMASTG OR
        ASWELLASSTG OR INADDITIONTOSTG.
   $Q-CONJ-ABOVE = X20 IS NULLWH;
        [* In 'fever and nausea which was secondary', X2 = N 'nausea';]
        [* X2 is in a Q-CONJ in ANDSTG 'and nausea', so $SUBJNOTPLUR ]
        [* will fail since AND confers plurality. Parser will back up ]
        [* and rebuild tree with SUBJECT='fever' (no ANDSTRING); VERB ]
        [* and OBJECT will be satisfied by NULLFRAGs, and the whole ]
        [* will have a similar conjunct with SUBJECT='nausea which was]
        [* secondary' & VERB=NULLFRAG. This is grammatically correct: ]
        [* singular subject 'fever' agrees with singular verb 'was'. ]
        [* Medically, probably, 'fever and nausea' were meant to be ]
        [* taken as a unit, as the joint subject of 'was secondary' ]
        [* - a case where usage trumps syntax, but hard to capture in ]
        [* a procedure.]
        AT X2
        ASCEND TO Q-CONJ;
        IMMEDIATE-NODE- IS ANDSTG OR PLUSSTG OR COMMASTG OR ASWELLASSTG
        OR INADDITIONTOSTG.
   $PLURAGREE =
        IF X1 IS PLURAL
        THEN $SUBJNOTSING.
   $SUBJNOTSING = AT X2
        ONE OF $ATT-NOT-SING, $Q-CONJ-BELOW, $Q-CONJ-ABOVE,
   $ATT-AGG, $LITERAL.
        [* In 'fever and nausea which were associated with...' ]
        [* X20=NULLWH AND X2=N 'nausea'; ]
        [* if X2 is in a Q-CONJ in ANDSTG 'fever and nausea' then ]
        [* the subject of 'were' is plural and WAGREE$SUBJNOTSING ]
        [* should succeed ($Q-CONJ-ABOVE). In 'fever and nausea were ]
        [* associated with...' $Q-CONJ-BELOW should succeed. ]
   $ATT-NOT-SING = EXTENDED-CORE- X2 IS NOT SINGULAR.
   $ATT-AGG = X2 IS AGGREGATE OR H-INST.
   $LITERAL = EITHER X2 IS 'I'
        OR BOTH X2 IS 'NUMBER' OR 'NATURE'
        AND AT X2 WORD FOLLOWING PRESENT NODE IS 'OF'.
WAGREE-BESHOW =
        IN OBJBE AFTER OPTION ASTG, NSTG:
        IF CORE- X1 OF COELEMENT BESUBJ IS NOT EMPTY
        THEN EITHER CORE- [of ASTG/NSTG] X2 IS H-TXVAR OR H-TXRES
        OR H-TTMED OR H-INDIC
        OR ALL OF $SING, $PLUR.
   $SING =
        IF BOTH X2 [CORE- OF ASTG/NSTG] IS SINGULAR
        AND NOT $Q-CONJ-OBJBE
        THEN BOTH X1 [CORE- OF BESUBJ] IS NOT PLURAL
        AND NOT $Q-CONJ-BESUBJ.
   $Q-CONJ-OBJBE = AT X2 ITERATE CORE-CONJUNCT EXISTS;
        ASCEND TO Q-CONJ;
        IMMEDIATE-NODE- IS ANDSTG.
   $Q-CONJ-BESUBJ = AT X1 ITERATE CORE-CONJUNCT EXISTS;
        ASCEND TO Q-CONJ;
        IMMEDIATE-NODE- IS ANDSTG.
   $PLUR =
        IF EITHER X2 IS PLURAL [treatment at discharge : inhalers]
        OR $Q-CONJ-OBJBE [therapy : uniphyllin and sudafed]
        THEN EITHER X1 IS NOT SINGULAR
        OR $Q-CONJ-BESUBJ.
WAGREE-LN =
        [* A noun (or any core of LNR) agrees in number with its left ]
        [* adjuncts. This rules out 'a pains', 'few pain' etc. ]
        [* Much simplified WAGREE4 (cf Sager '81 NLIP), likely too simple. ]
        [* Takes account of expanded QVAR in med-grammars. ]
        [* 6/23/2001 Exception for NVAR='range'/'level':'in the 154 range.']
        IN LNR AFTER NVAR:
        EITHER $AGREE OR $EXCEPTION.
   $AGREE = BOTH CORE- X1 EXISTS
        AND IN LN BOTH CORE- X2 OF TPOS EXISTS WHERE $T-AGREE IS TRUE
        AND CORE- X3 OF QPOS EXISTS WHERE $Q-AGREE IS TRUE.
   $T-AGREE = BOTH $TSING AND $TPLUR.
   $TSING = IF X1 IS SINGULAR
        THEN X2 IS NOT PLURAL.
   $TPLUR = IF X1 IS PLURAL
        THEN X2 IS NOT SINGULAR.
   $Q-AGREE = BOTH $QSING AND $QPLUR.
   $QSING = IF X1 IS SINGULAR
        THEN EITHER X3 IS NOT PLURAL [NOTE: 'both' = Q:PLURAL]
        OR EITHER THERE IS AN 'AND' AHEAD
        [* 'Both he and his wife report that ...']
        [* Don't reject LN + NVAR = 'Both he' ]
        OR IF NOT $MORE-Q [one to two...]
        THEN EITHER X1 IS H-INDIC
        [* 5 flexion_contracture]
        OR X1 IS 'SYSTOLIC' OR 'DIASTOLIC'
        [* BP is 120 systolic].
   $MORE-Q = GO RIGHT.
   $QPLUR = IF X1 IS PLURAL
        THEN X3 IS NOT SINGULAR.
   $EXCEPTION = EITHER X1 IS H-TXVAR [140 sodium]
        OR X1 IS 'RANGE' OR 'LEVEL'.
WAGREE-PREP =
        [* The object of P=among/between is not singular: *'between it']
        IN PN:
        IF ELEMENT P X20 IS 'BETWEEN' OR 'AMONG'
        THEN AT X20
        BOTH THE CORE- X2 OF COELEMENT- NSTGO EXISTS
        AND EITHER X2 IS NOT SINGULAR
        OR $Q-CONJ-PREP.
   $Q-CONJ-PREP = AT X2 ITERATE CORE-CONJUNCT EXISTS;
        ASCEND TO Q-CONJ;
        IMMEDIATE-NODE- IS ANDSTG OR PLUSSTG.
WAGREE-VO =
        [* Checks number agreement of VERB and NSTG in OBJBE: ]
        [* 'there is a book'; *'there are a book'. Some exceptions, ]
        [* e.g. 'Three days are structured cardiac rehab'. ]
        IN OBJBE:
        IF NSTG X1 EXISTS
        THEN BOTH $SINGAGREE AND $PLURAGREE ARE TRUE.
   $SINGAGREE =
        IF THE CORE X4 OF COELEMENT- VERB OF IMMEDIATE OBJECT IS SINGULAR
        THEN EITHER THE CORE- OF COELEMENT- SUBJECT OF IMMEDIATE OBJECT
        IS 'THERE'
        [there was 2+ carotids without bruits]
        [there is tender retroauricular nodes on the right]
        OR EITHER $OBJNOTPLURAL
        OR CORE- X-CORE OF X1 IS
        H-TTMED [therapy is inhalers]
        OR H-TMDUR [problem is episodes of sundowning]
        OR H-INDIC
        [The other issue was complaints of foot pain]
        OR H-DIAG
        [He says it feels_like his typical migraines].
   $OBJNOTPLURAL =
        BOTH THE CORE- X2 OF X1 IS NOT PLURAL
        AND NOT $Q-CONJ [GLOBAL IN WAGREE].
   $PLURAGREE = IF X4 IS PLURAL
        THEN $OBJNOTSING.
   $OBJNOTSING = EITHER BOTH $CORENOTSING
        AND X2 IS NOT OF TYPE STRING
        OR AT EXTENDED-CORE- X50 OF COELEMENT- SUBJECT OF
        IMMEDIATE OBJECT $EXCEPTIONS IS TRUE.
   $EXCEPTIONS = ONE OF $SUBJ-PRO, $SUBJ-DIAG, $SUBJ-OTHER.
   $SUBJ-PRO = X50 IS PRO:TDEM
        [These are her most common seizure].
   $SUBJ-DIAG = X50 IS N:H-DIAG OR H-INDIC
        [Key impressions are osteoarthritis].
   $SUBJ-OTHER = EITHER X50 IS 'TYPES' OR 'LABS'
        [The most common types are <only one type stated>]
        [Labs to be followed are <only one type stated>]
        OR X50 IS QN
        [Three days are structured cardiac rehab].
   $CORENOTSING =
        EITHER CORE- X2 OF X1 IS NOT SINGULAR
        OR EITHER X2 IS H-TTMED
        OR EITHER X2 IS 'TYPE' [they are a tonic clonic type]
        OR 'ISSUE'[financial considerations are the issue]
        OR $Q-CONJ.
   $Q-CONJ = AT X2
        [go to core- of deepest conjunct; CONJ is pluralizer]
        ITERATE CORE-CONJUNCT EXISTS;
        ASCEND TO Q-CONJ;
        IMMEDIATE-NODE- IS ANDSTG OR PLUSSTG OR COMMASTG.
— ATTRIBUTE ASSIGNMENT RESTRICTIONS
— Word-specific constraints on sublanguage attribute assignment

WATT0-SELATT =
        [* Assign SELECT-ATT to specified atomic nodes. This ]
        [* assigns to the node the sublanguage attribute(s) that ]
        [* the word carries in the lexicon (or "dictionary"). It ]
        [* must precede all other WATT restrictions, which aim to]
        [* eliminate alternate attributes that are inappropriate ]
        [* in the given context. If this WATT restriction were to]
        [* be executed after such editing took place, it would ]
        [* undo that work by overwriting the WATT assignment ]
        [* with the initial dictionary attributes. ]
        IN SEL-NODE:
        IF PRESENT-ELEMENT- X3 IS NOT EMPTY
        THEN IF BOTH ALL OF $SCALESTG, $IN-DIM, $QN, $PN, $SUB, $WVVAR,
   $LEADVAR, $OTHERS
        AND BOTH X1 DOES NOT HAVE NODE ATTRIBUTE SELECT-ATT
        AND AT X1 ONE OF $CHECK-GENDER, $HAVE-SEL-ATTR,
   $CREATE-H-AMT, $CREATE-H-NULL
        THEN BOTH AT X1 ASSIGN PRESENT ELEMENT NODE ATTRIBUTE
        SELECT-ATT WITH VALUE X-SELECT-N
        AND IF X-SELECT-N HAS MEMBER H-NEG
        [* to write out negative attribute for checking]
        THEN DO $WRITE-NEGS.
   $SCALESTG =
        IF X3 IS SCALESTG
        THEN AT X3 EITHER ELEMENT- ADJ X1 EXISTS
        OR ELEMENT- D X1 EXISTS.
   $IN-DIM =
        IF X3 IS IN-DIM
        THEN AT X3 ELEMENT- N X1 EXISTS.
   $QN =
        IF X3 IS QN
        THEN AT X3 ELEMENT- N X1 EXISTS.
   $PN =
        IF X3 IS PN
        THEN AT X3 ELEMENT- P X1 EXISTS.
   $SUB =
        IF X3 IS SUB0 OR SUB1 OR SUB2 OR SUB3 OR SUB5
        THEN X3 HAS ELEMENT- CS0 OR CS1 OR CS2 OR CS3 OR CS5 X1.
   $WVVAR =
        IF X3 IS WVVAR
        THEN X3 HAS ELEMENT- N X1.
   $LEADVAR =
        IF X3 IS LEADVAR
        THEN X3 HAS ELEMENT- N X1.
   $OTHERS = CORE X1 EXISTS;
        X1 IS OF TYPE ATOM.
   $HAVE-SEL-ATTR =
        CORE-SELATT X-SELECT-N EXISTS.
   $CREATE-H-AMT =
        X1 IS DS;
        X-SELECT-N := NIL;
        X-AMT := SYMBOL H-AMT;
        PREFIX X-AMT TO X-SELECT-N.
   $CREATE-H-NULL =
        X1 IS NOT P;
        X-SELECT-N := NIL;
        X-NULL := SYMBOL H-NULL;
        PREFIX X-NULL TO X-SELECT-N.
   $CHECK-GENDER =
        X1 IS MASC OR FEM;
        STORE IN X-DICTGENDER;
        AT X1
        ITERATE GO UP UNTIL PRESENT-ELEMENT- IS ONESENT SUCCEEDS;
        ELEMENT- SECT-NAME OF ELEMENT- SECTION EXISTS;
        THIRD ELEMENT IS 'MALE' OR 'FEMALE';
        STORE IN X-PTGENDER;
        DO $CROSS-CHECK.
   $CROSS-CHECK =
        BOTH EITHER BOTH X-DICTGENDER HAS MEMBER MASC
        AND X-PTGENDER IS 'FEMALE'
        OR BOTH X-DICTGENDER HAS MEMBER FEM
        AND X-PTGENDER IS 'MALE'
        AND DO $NOT-H-PT.
   $NOT-H-PT = X-SUBLIST := LIST PATIENT-LIST;
        X-SEL-ATT := CORE-SELATT OF X1;
        X-SELECT-N := COMPLEMENT OF X-SEL-ATT.
   $WRITE-NEGS =
        WRITE ON INFO IDENTIFICATION;
        WRITE ON INFO ' - '; AT X1 WRITE ON INFO WORDS SUBSUMED;
        WRITE ON INFO END OF LINE.
WATT-APPEAR =
        [* Resolve sublanguage ambiguity of 'appear','appeared', 'appears' ]
        [* as between H-MODAL (patient appeared pale) and H-TMBEG (a rash ]
        [* appeared).]
        [* In the case where the SUBJECT is H-PT, the verb (usually) is ]
        [* H-MODAL: 'The patient appeared pale' (ignoring possible ]
        [* 'Patient appeared in my office'). Also H-MODAL if both SUBJECT ]
        [* is 'it' and next word is an ADJ that is ASENT1: 'It appeared ]
        [* incumbent to demonstrate...' ]
        IN ASSERTION AFTER VERB:
        IF BOTH CORE- X1 OF ELEMENT- VERB IS 'APPEAR' OR 'APPEARS' OR 'APPEARED'
        AND EITHER CORE- X2 OF ELEMENT- SUBJECT IS H-PT
        OR BOTH X2 IS 'IT'
        AND CURRENT WORD IS ADJ:ASENT1
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-MODAL := SYMBOL H-MODAL;
        X-VERBMODAL := NIL;
        PREFIX X-MODAL TO X-VERBMODAL;
        X-NEWATT := INTERSECT OF X-VERBMODAL;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-AXIS =
        [* Resolve ambiguity of 'axis' H-PTAREA/E-AX in WVVAR/NNN.]
        [* In 'normal intervals and axis' the word 'axis' is E-AX.]
        [* Same in 'left axis deviation, other intervals normal'. ]
        IN WVVAR, NNN AFTER N:
        IF N X1 IS 'AXIS'
        THEN IF EITHER IMMEDIATE WVVAR EXISTS
        OR BOTH IMMEDIATE LN EXISTS@
        AND IMMEDIATE LWVR EXISTS
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-AX := SYMBOL E-AX;
        X-NAX := NIL;
        PREFIX X-AX TO X-NAX;
        X-NEWATT := INTERSECT OF X-NAX;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-BM =
        [* Resolve homograph ambiguity of 'BM' H-PTPART (bone marrow)]
        [* vs 'BM' H-PTFUNC (bowel movement). In NNN position. ]
        IN NNN:
        IF BOTH ELEMENT- N X1 IS 'BM'
        AND AT X1 WORD FOLLOWING PRESENT NODE IS N:H-TXPROC OR H-TTSURG
        [BM biopsy; BM transplant]
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-PTPART := SYMBOL H-PTPART;
        X-NPTPART := NIL;
        PREFIX X-PTPART TO X-NPTPART;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NPTPART.
WATT-CAN =
        [* Distinguish the MODAL sense of 'can' i.e. possible, as in ]
        [* 'Dr YYY can follow-up on the patient's thyroid status if it]
        [* is felt to be necessary at a later time', from the sense of]
        [* asserted ability, as in 'Patient can walk unassisted'. ]
        [* In the latter case, we assign H-PTFUNC to 'can'. ]
        IN VVAR:
        IF BOTH CORE- IS V: H-PTFUNC
        AND CORE- X1 OF COELEMENT- TENSE OF IMMEDIATE VERB X-VERB
        IS 'CAN'
        THEN IF CORE-ATT OF CORE- OF COELEMENT- SUBJECT OF X-VERB
        HAS MEMBER H-PT
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-PTFUNC := SYMBOL H-PTFUNC;
        X-NPTFUNC := NIL;
        PREFIX X-PTFUNC TO X-NPTFUNC;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NPTFUNC.
WATT-NUNIT =
        [* Resolve homograph ambiguity of NUNIT word in QN. If NUNIT ]
        [* word is also in another class, then parsed as the unit in QN ]
        [* resolves the ambiguity. For example, WATT-NUNIT resolves the ]
        [* homograph ambiguity of 'CC' NUNIT (cubic centimeters) versus ]
        [* 'CC' H-TTSURG (cardiac catheterization). If QN succeeds with ]
        [* N = 'CC', then eliminate the H-TTSURG attribute; assign ]
        [* SELATT = NUNIT.]
        IN QN:
        IF ELEMENT- N X1 IS NUNIT
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NUNIT := SYMBOL NUNIT;
        X-NNUNIT := NIL;
        PREFIX X-NUNIT TO X-NNUNIT;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NNUNIT.
WATT-CLEARANCE =
        [* Resolve ambiguity of 'clearance' H-TTGEN/H-PTFUNC,]
        [* H-TTGEN in 'Discharged after cardiology clearance']
        [* H-PTFUNC in 'diminished clearance due to renal ]
        [* dysfunction'. ]
        IN NVAR AFTER N:
        IF N X1 IS 'CLEARANCE'
        THEN IF IN COELEMENT- LN X-LN CORE- X2 OF NPOS IS H-INST
        [cardiology clearance]
        THEN DO $ASSIGN-SEL
        ELSE IF IN X-LN
        EITHER CORE- OF APOS IS H-PTPART [renal clearance]
        OR H-CHANGE-LESS [diminished clearance due to ...]
        OR CORE- OF NPOS IS H-TXVAR [creatinine clearance]
        THEN DO $ASSIGN-SEL2.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-TTGEN := SYMBOL H-TTGEN;
        X-NTTGEN := NIL;
        PREFIX X-TTGEN TO X-NTTGEN;
        X-NEWATT := INTERSECT OF X-NTTGEN;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-PTFUNC := SYMBOL H-PTFUNC;
        X-NPTFUNC := NIL;
        PREFIX X-PTFUNC TO X-NPTFUNC;
        X-NEWATT := INTERSECT OF X-NPTFUNC;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-COME =
        [* Resolve sublanguage ambiguity of 'come', as between H-TTGEN, ]
        [* as in 'She was asked to come into the doctor's office', ]
        [* and H-TTMBEG as in 'It comes on with either rest or exertion'.]
        [* In the case where SUBJECT is H-PT ('Patient came to clinic', ]
        [* 'Patient was asked to come to clinic'), then the class is ]
        [* H-TTGEN; otherwise it is (usually) H-TMBEG. ]
        IN ASSERTION AFTER OBJECT:
        IF AT ELEMENT- SUBJECT X10
        BOTH CORE- X1 OF DEEPEST-COVERB- IS 'COME' OR 'COMES'
        OR 'COMING' OR 'CAME'
        AND CORE- [of SUBJECT] IS H-PT
        THEN AT X1 DO $ASSIGN-SEL
        ELSE IF X1 IS 'COME' OR 'COMES' OR 'COMING' OR 'CAME'
        THEN AT X1 DO $ASSIGN-SEL2.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-TTGEN := SYMBOL H-TTGEN;
        X-VERBTTGEN := NIL;
        PREFIX X-TTGEN TO X-VERBTTGEN;
        X-NEWATT := INTERSECT OF X-VERBTTGEN;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-TMBEG := SYMBOL H-TMBEG;
        X-VERBTMBEG := NIL;
        PREFIX X-TMBEG TO X-VERBTMBEG;
        X-NEWATT := INTERSECT OF X-VERBTMBEG;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-CORONARY =
        [* Resolve ambiguity of 'CORONARY' H-DIAG/H-PTPART in NVAR]
        [* 'Pt had a coronary' 'Pt had an acute coronary' H-DIAG, ]
        [* vs. 'in the coronary vessel' H-PTPART.]
        IN NVAR AFTER N:
        IF N X1 IS 'CORONARY'
        THEN IF IN COELEMENT- LN CORE- X2 OF TPOS IS 'A' OR 'AN'
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-DIAG := SYMBOL H-DIAG;
        X-NDIAG := NIL;
        PREFIX X-DIAG TO X-NDIAG;
        X-NEWATT := INTERSECT OF X-NDIAG;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-CUFF =
        [* Resolve ambiguity of 'CUFF' H-PTPART/H-DEVMED. It is]
        [* H-PTPART in 'Vaginal cuff is healing well'. It is ]
        [* H-DEVMED in 'BP was elevated with a regular cuff but]
        [* WNL with a large cuff'. ]
        IN NVAR AFTER N:
        IF N X1 IS 'CUFF'
        THEN IF IN COELEMENT- LN CORE- OF APOS IS 'LARGE' OR 'REGULAR'
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-DEVMED := SYMBOL H-DEVMED;
        X-NDEVMED := NIL;
        PREFIX X-DEVMED TO X-NDEVMED;
        X-NEWATT := INTERSECT OF X-NDEVMED;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-CVA =
        [* Resolve ambiguity of noun 'CVA' H-PTPART/H-DIAG: ]
        [* H-PTPART 'costovertebral angle', ]
        [* H-DIAG 'cerebrovascular accident'. ]
        [* CVA as H-PTPART does not usually occur as head noun, ]
        [* i.e. in NVAR; rather it occurs as left modifier, i.e.]
        [* in NNN, as in 'CVA tenderness'. CVA as H-DIAG is ]
        [* often in NVAR: 'history of CVA', 'left-sided CVA' etc]
        IN NVAR:
        IF CORE- X1 IS 'CVA'
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-DIAG := SYMBOL H-DIAG;
        X-NDIAG := NIL;
        PREFIX X-DIAG TO X-NDIAG;
        X-NEWATT := INTERSECT OF X-NDIAG;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-CVA2 =
        [* Resolve ambiguity of noun 'CVA' H-PTPART/H-DIAG: ]
        [* H-PTPART 'costovertebral angle', ]
        [* H-DIAG 'cerebrovascular accident'. ]
        [* CVA as H-PTPART does not usually occur as head noun, ]
        [* i.e. in NVAR; rather it occurs as left modifier, i.e.]
        [* in NNN, as in 'CVA tenderness'. CVA as H-DIAG in NNN ]
        [* can occur as modifier of H-INDIC, GENERIC, as in ]
        [* 'CVA problems', 'CVA symptoms'. Another occurrence: ]
        [* 'from a CVA standpoint'; 'standpoint is H-TRANSP. ]
        [* Also: 'a CVA patient'. These are exceptions to CVA in]
        [* NNN being exclusively CVA=H-PTPART 'costovertebral ]
        [* angle'.]
        IN NNN AFTER N:
        IF BOTH ELEMENT- N X1 IS 'CVA'
        AND AT X1
        NEITHER WORD FOLLOWING PRESENT NODE X-NEXT IS
        N:H-TRANSP OR H-PT
        [CVA standpoint][CVA patient]
        NOR BOTH X-NEXT IS N: H-INDIC
        AND X-NEXT IS N: GENERIC
        [CVA symptoms]
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-PTPART := SYMBOL H-PTPART;
        X-NPTPART := NIL;
        PREFIX X-PTPART TO X-NPTPART;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NPTPART.
WATT-DEPRESSION =
        [* Resolve ambiguity of 'DEPRESSION' H-DIAG/H-CHANGE-LESS ]
        [* in WVVAR: 'suffering from depression' vs 'ST depression'.]
        [* 2/20/01 For e.g. 'ST depression' (EKG finding) ensure ]
        [* that 'depression' is H-CHANGE-LESS. ]
        IN WVVAR AFTER N:
        IF N X1 IS 'DEPRESSION' OR 'DEPRESSIONS'
        THEN IF IN COELEMENT- LN CORE- X2 OF NPOS IS E-WV
        OR E-INTVL [ST depression]
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-CHANGE := SYMBOL H-CHANGE-LESS;
        X-NCHANGE := NIL;
        PREFIX X-CHANGE TO X-NCHANGE;
        X-NEWATT := INTERSECT OF X-NCHANGE;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-DEPRESSION2 =
        [* Resolve ambiguity of 'depression' H-INDIC/H-CHANGE-LESS ]
        [* in NVAR: 'suffering from depression' vs 'ST depression'.]
        [* in NVAR]
        [* 2/20/01 For e.g. 'ST depression' (EKG finding) ensure ]
        [* that 'depression' is H-CHANGE-LESS.]
        IN NVAR AFTER N:
        IF N X1 IS 'DEPRESSION' OR 'DEPRESSIONS'
        THEN IF IN COELEMENT- LN CORE- X2 OF NPOS IS E-WV
        OR E-INTVL [ST depression]
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-CHANGE := SYMBOL H-CHANGE-LESS;
        X-NCHANGE := NIL;
        PREFIX X-CHANGE TO X-NCHANGE;
        X-NEWATT := INTERSECT OF X-NCHANGE;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-DEVELOPED =
        [* Resolve sublanguage ambiguity of 'developed' in TV occurrence. ]
        [* 'Developed' = H-PTFUNC, H-TMBEG. In 'Pt developed normally' it ]
        [* is H-PTFUNC; in 'Pt developed rash' it is H-TMBEG. ]
        [* If OBJECT = N:(H-INDIC) in ASSERTION then 'developed' is H-TMBEG.]
        [* This could not be done in Selection because V-S-O allows' the ]
        [* pattern PTFUNC-PT-INDIC for 'Pt drinks alcohol'. ]
        IN ASSERTION AFTER OBJECT:
        IN OBJECT X3
        IF BOTH CORE- X1 OF COELEMENT- VERB IS 'DEVELOPED'
        AND CORE-ATT OF CORE- X5 OF X3 HAS MEMBER H-INDIC [rash, limping]
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-TMBEG := SYMBOL H-TMBEG;
        X-VERBTMBEG := NIL;
        PREFIX X-TMBEG TO X-VERBTMBEG;
        X-NEWATT := INTERSECT OF X-VERBTMBEG;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-DIP =
        [* Resolve ambiguity of noun 'DIP' H-PTPART/H-DIAG: ]
        [* H-PTPART 'distal interphalangeal joint', ]
        [* H-DIAG 'desquamative interstitial pneumonia'. ]
        [* There is also (not covered yet) an MLP class of 'DIP']
        [* H-CHANGE-LESS 'a dip in temperature readings' ]
        IN NVAR:
        IF BOTH CORE- X1 IS 'DIP'
        AND X1 IS OCCURRING IN PN X2
        WHERE EITHER P IS 'IN' OR 'WITHIN'
        OR BOTH P IS 'TO'
        AND HOST- OF X2 IS H-PTPART OR H-PTAREA
        [laceration on the index finger just distal to the DIP]
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-PTPART := SYMBOL H-PTPART;
        X-NPTPART := NIL;
        PREFIX X-PTPART TO X-NPTPART;
        X-NEWATT := INTERSECT OF X-NPTPART;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-DISCHARGE =
        [* Resolve ambiguity of 'DISCHARGE' H-INDIC/H-TTGEN ]
        [* 'discharge from nose' vs. 'discharge from hospital']
        IN LNR:
        IF IN ELEMENT- NVAR X10 ELEMENT- N X1 IS 'DISCHARGE'
        THEN IF AT X10 IN COELEMENT- LN CORE- X2 OF APOS IS 'H-PTPART'
        THEN DO $ASSIGN-SEL
        ['vaginal discharge'->'discharge" is H-INDIC, not H-TTGEN]
        ELSE IF EITHER RIGHT-ADJUNCT X11 OF X10 IS PDATE
        ['discharge on 03/25/1998'->'discharge" is H-TTGEN, not H-INDIC]
        [Need WATT-DISCHARGE because other H-INDIC are OK with date]
        OR X10 IS OCCURRING IN PN
        WHERE P IS 'AT' OR 'ON' OR 'OF'
        ['at/on discharge'->'discharge" is H-TTGEN, not H-INDIC]
        ['day of discharge'->'discharge" is H-TTGEN, not H-INDIC]
        THEN DO $ASSIGN-SEL2.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-INDIC := SYMBOL H-INDIC;
        X-NINDIC := NIL;
        PREFIX X-INDIC TO X-NINDIC;
        X-NEWATT := INTERSECT OF X-NINDIC;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-TTGEN := SYMBOL H-TTGEN;
        X-NTTGEN := NIL;
        PREFIX X-TTGEN TO X-NTTGEN;
        X-NEWATT := INTERSECT OF X-NTTGEN;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-DISCHARGE2 =
        [* Resolve ambiguity of 'DISCHARGE' H-INDIC/H-TTGEN ]
        [* when 'discharge' is in NPOS. In 'discharge status' ]
        [* 'discharge' is H-TTGEN, not H-INDIC.]
        IN NPOS:
        IF ELEMENT- N X1 OF ELEMENT- NNN IS 'DISCHARGE'
        THEN IF EITHER CURRENT WORD IS 'STATUS' OR 'MEDICATIONS'
        OR CURRENT WORD IS H-TXPROC [discharge EKG]
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-TTGEN := SYMBOL H-TTGEN;
        X-NTTGEN := NIL;
        PREFIX X-TTGEN TO X-NTTGEN;
        X-NEWATT := INTERSECT OF X-NTTGEN;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-DISTANT =
        [* Resolve ambiguity of 'DISTANT ' H-TMLOC/H-DESCR; Depends on host.]
        [* Use NEXT WORD to obtain correct SELECT-ATT before reaching host. ]
        [* 'Distant' is H-TMLOC with HOST=H-TMLOC: 'Distant history of 'MI' ]
        [* 'Distant' is H-TMLOC with HOST=H-TMLOC: 'in the distant past' ]
        [* 'Distant' is H-DESCR with HOST=H-PTFUNC 'Distant heart sounds' ]
        IN AVAR AFTER ADJ:
        IF ADJ X1 IS 'DISTANT'
        THEN IF CURRENT WORD X3 IS N:H-TMLOC [history]
        THEN AT X1 DO $ASSIGN-SEL
        ELSE IF X3 IS N:H-PTFUNC [heart_sounds]
        THEN DO $ASSIGN-SEL2.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-TMLOC := SYMBOL H-TMLOC;
        X-ATMLOC := NIL;
        PREFIX X-TMLOC TO X-ATMLOC;
        X-NEWATT := INTERSECT OF X-ATMLOC;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-DESCR := SYMBOL H-DESCR;
        X-ADESCR := NIL;
        PREFIX X-DESCR TO X-ADESCR;
        X-NEWATT := INTERSECT OF X-ADESCR;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-DIURESE =
        [* Resolve sublanguage ambiguity of 'DIURESE','DIURESED'' as between ]
        [* H-RESP (patient diuresed rapidly) and H-TTCOMP (She was diuresed). ]
        [* In the case where the SUBJECT is H-PT and the VERB is not passive ]
        [* then the class is H-RESP; if the verb is passive then the class is]
        [* H-TTCOMP. Use DEEPEST-VERB for e.g. 'She had diuresed' (H-RESP). ]
        IN ASSERTION AFTER OBJECT:
        IF AT ELEMENT- SUBJECT X10
        BOTH CORE- IS H-PT
        AND CORE- X1 OF DEEPEST-COVERB- X3 IS 'DIURESE'OR 'DIURESED'
        THEN IF X3 IS NOT OCCURRING IN VENPASS
        THEN DO $ASSIGN-SEL
        ELSE IF X3 IS OCCURRING IN VENPASS
        [only possibly true for DEEPEST-COVERB- = 'diuresed']
        THEN DO $ASSIGN-SEL2.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-RESP := SYMBOL H-RESP;
        X-VERBRESP := NIL;
        PREFIX X-RESP TO X-VERBRESP;
        X-NEWATT := INTERSECT OF X-VERBRESP;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-TTCOMP := SYMBOL H-TTCOMP;
        X-VERBTTCOMP := NIL;
        PREFIX X-TTCOMP TO X-VERBTTCOMP;
        X-NEWATT := INTERSECT OF X-VERBTTCOMP;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-ELEVATED =
        [* Resolve ambiguity of passive 'ELEVATED' H-TTCOMP/H-CHANGE-MORE.]
        [* H-TTCOMP is less frequent: 'head of bed elevated', 'keep foot]
        [* elevated'; whereas H-CHANGE-MORE in lab and other measurements ]
        [* are frequent: 'LDH and CK were markedly elevated'. ]
        [* 4/12/01 'ELEVATED' is H-CHANGE-MORE if in VENPASS RN of E-INTVL]
        [* 'ST elevated in V4'. ]
        IN LVENR AFTER VEN:
        IF BOTH IMMEDIATE VENPASS X10 EXISTS
        AND CORE- X1 [OF LVENR] IS 'ELEVATED'
        THEN ALL OF $RN-CHANGE, $PRED-CHANGE, $RN-TTCOMP.
   $RN-CHANGE = IF HOST- X2 OF X10 IS N:H-PTFUNC [e.g.JVP elevated]
        OR H-TXVAR [e.g.WBC slightly elevated]
        OR E-INTVL [e.g.ST slightly elevated in lead V4]
        THEN DO $ASSIGN-SEL.
   $PRED-CHANGE = IF X10 IS OCCURRING IN OBJECTBE X4
        WHERE AT IMMEDIATE-NODE OF X4
        EITHER COELEMENT SUBJECT X3 EXISTS
        OR ULTIMATE-SUBJECT X3 EXISTS
        [QTC was also noted to be elevated at 0.6]
        THEN IF CORE- OF X3 IS N:H-PTFUNC
        [JVP was slightly elevated]
        OR H-TXVAR
        [LDH and CK were markedly elevated]
        OR E-INTVL
        [ST segment was markedly elevated]
        THEN DO $ASSIGN-SEL.
   $RN-TTCOMP = IF X10 IS OCCURRING IN RN
        WHERE HOST- IS H-PTPART OR H-DEVMED
        [She sleeps with foot elevated]
        [She sleeps with head_of_the_bed elevated]
        THEN DO $ASSIGN-SEL2.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-CHANGE := SYMBOL H-CHANGE-MORE;
        X-VENCHANGE := NIL;
        PREFIX X-CHANGE TO X-VENCHANGE;
        X-NEWATT := INTERSECT OF X-VENCHANGE;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-TTCOMP := SYMBOL H-TTCOMP;
        X-VENTTCOMP := NIL;
        PREFIX X-TTCOMP TO X-VENTTCOMP;
        X-NEWATT := INTERSECT OF X-VENTTCOMP;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-ELEVATION =
        [* Resolve ambiguity of 'elevation' H-TTCOMP/H-CHANGE-MORE ]
        [* 2/20/01 Add for e.g. 'ST elevation' (EKG finding) that ]
        [* 'elevation is H-CHANGE-MORE. ]
        [* ll/4/01 Note 'ST' is ambiguous: 'ST' is ekg wave, and ]
        [* 'ST' is abbreviation for 'subtalar'. Need special clause]
        [* in restriction. ]
        IN NVAR AFTER N:
        IF N X1 IS 'ELEVATION' OR 'ELEVATIONS'
        THEN IF IN COELEMENT- LN CORE- X2 OF NPOS IS H-PTPART
        [* 'leg elevation']
        THEN DO $ASSIGN-SEL
        [* 'leg elevation' -> 'elevation" is H-TTCOMP]
        ELSE IF X2 IS H-TXVAR [* 'LDH elevation']
        OR E-WV OR E-INTVL
        [* 'LDH elevation' -> 'elevation" is H-CHANGE-MORE]
        [* 'ST elevation'; this should fall into LWVR, ]
        [* but if it should happen to be in LNR, then ]
        [* assign attrb H-CHANGE-MORE. ]
        THEN DO $ASSIGN-SEL2.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-TTCOMP := SYMBOL H-TTCOMP;
        X-NTTCOMP := NIL;
        PREFIX X-TTCOMP TO X-NTTCOMP;
        X-NEWATT := INTERSECT OF X-NTTCOMP;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-CHANGE := SYMBOL H-CHANGE-MORE;
        X-NCHANGE := NIL;
        PREFIX X-CHANGE TO X-NCHANGE;
        X-NEWATT := INTERSECT OF X-NCHANGE;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-ELEVATION2 =
        [* Resolve ambiguity of 'elevation' H-PTFUNC/H-TTCOMP/H-CHANGE-MORE]
        [* in case where 'elevation' is EKG finding e.g. 'ST elevation'. ]
        [* In this case 'elevation' is H-CHANGE-MORE.]
        IN WVVAR AFTER N:
        IF N X1 IS 'ELEVATION' OR 'ELEVATIONS'
        THEN IF IN COELEMENT- LN CORE- X2 OF NPOS IS E-INTVL [ST elevation]
        THEN DO $ASSIGN-SEL2
        ['ST elevation' -> 'elevation" is H-CHANGE-MORE].
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-CHANGE := SYMBOL H-CHANGE-MORE;
        X-NCHANGE := NIL;
        PREFIX X-CHANGE TO X-NCHANGE;
        X-NEWATT := INTERSECT OF X-NCHANGE;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-END =
        [* Resolve ambiguity of 'END' H-TMEND/H-PTAREA in NVAR]
        [* 'at the end of the visit' H-TMEND; 'at the proximal]
        [* end' H-PTAREA.]
        IN NVAR AFTER N:
        IF N X1 IS 'END'
        THEN IF IN COELEMENT- LN CORE- OF APOS IS H-PTAREA OR H-PTPART
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-PTAREA := SYMBOL H-PTAREA;
        X-NPTAREA := NIL;
        PREFIX X-PTAREA TO X-NPTAREA;
        X-NEWATT := INTERSECT OF X-NPTAREA;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-ETHNIC-ADJ =
        [* Distinguish H-ETHNIC occurrence from H-GEOGR occurrence. ]
        [* E.g. 'African' is H-ETHNIC in '26 year old African male'; ]
        [* 'African' is H-GEOGR in 'African green monkeys' (MEDCIN). ]
        [* Similarly, 'Mexican' is H-ETHNIC in 'Mexican woman' and is ]
        [* H-GEOGR in 'Mexican clinic'. ]
        IN AVAR:
        IF BOTH ELEMENT- ADJ X1 IS H-ETHNIC
        AND CURRENT WORD IS N:NHUMAN [e.g. male]
        [26 year old African male]
        THEN DO $ASSIGN-SEL
        ELSE IF ELEMENT- ADJ X1 IS H-GEOGR
        THEN DO $ASSIGN-SEL2.
   $ASSIGN-SEL = X-ETHNIC := SYMBOL H-ETHNIC;
        X-NETHNIC := NIL;
        PREFIX X-ETHNIC TO X-NETHNIC;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-GEOGR := SYMBOL H-GEOGR;
        X-NGEOGR := NIL;
        PREFIX X-GEOGR TO X-NGEOGR;
        AT X1 DO $ASSIGN2.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NETHNIC.
   $ASSIGN2 = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NGEOGR.
WATT-ER =
        [* Resolve homograph ambiguity of 'ER' H-INST (Emergency Room)]
        [* vs 'ER' H-TXVAR (Estrogen Receptor). In NNN position. ]
        IN NNN:
        IF BOTH ELEMENT- N X1 IS 'ER'
        AND AT X1 WORD FOLLOWING PRESENT NODE IS 'POSITIVE' OR 'NEGATIVE'
        [small ER positive breast cancer]
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-TXVAR := SYMBOL H-TXVAR;
        X-NTXVAR := NIL;
        PREFIX X-TXVAR TO X-NTXVAR;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NTXVAR.
WATT-F =
        [* Resolve homograph ambiguity of 'F' H-PT (Female) ]
        [* vs 'F' ASCALE (Fahrenheit), in NVAR position. ]
        [* Ex: '40 yo F'; 'F' is not 'Fahrenheit' in NVAR. ]
        [* Rather it is H-PT ('female'). ]
        IN NVAR:
        IF BOTH CORE- X1 IS 'F'
        AND WORD PRECEDING PRESENT NODE X-PREV IS N:H-AGE
        [e.g. 'yo' in '40 yo F']
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-PT := SYMBOL H-PT;
        X-NPT := NIL;
        PREFIX X-PT TO X-NPT;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NPT.
WATT-FALL =
        [* Resolve ambiguity of 'FALL' H-INDIC/H-CHANGE-LESS/H-TMLOC in NVAR]
        [* First step. 'Fall' is H-TMLOC in 'early fall', 'late fall'. ]
        [* 'Fall' is H-INDIC in 'his fall', 'her fall', 'a fall'. ]
        IN NVAR AFTER N:
        IF N X1 IS 'FALL'
        THEN BOTH IF EITHER IN COELEMENT- LN X2
        CORE- OF APOS IS 'LATE' OR 'EARLY'
        [in late fall, in early fall]
        OR BOTH CURRENT WORD IS 'OF'
        AND NEXT WORD IS DT [fall of 00.00/2001]
        THEN DO $ASSIGN-SEL
        AND IF IN X2
        CORE- OF TPOS IS 'HIS' OR 'HER' OR 'A'
        THEN DO $ASSIGN-SEL2.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-TMLOC := SYMBOL H-TMLOC;
        X-NTMLOC := NIL;
        PREFIX X-TMLOC TO X-NTMLOC;
        X-NEWATT := INTERSECT OF X-NTMLOC;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-INDIC := SYMBOL H-INDIC;
        X-NINDIC := NIL;
        PREFIX X-INDIC TO X-NINDIC;
        X-NEWATT := INTERSECT OF X-NINDIC;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-FEEL =
        [* Resolve sublanguage ambiguity of 'feel','felt, 'feels' as ]
        [* between H-MODAL (Dr. YYY feels CABG is desirable) and H-PTFUNC ]
        [* (Patient felt well today). Note use of EXTENDED-CORE- for e.g. ]
        [* 'Dr YYY863 of thoracic surgery service was consulted who felt ]
        [* that bypass grafting for the patient's two vessel disease would]
        [* be high risk given his previous thoracic surgery'. ]
        IN ASSERTION AFTER VERB:
        IF CORE- X1 OF ELEMENT- VERB IS 'FEEL' OR 'FELT' OR 'FEELS'
        THEN IF EXTENDED-CORE- X2 OF ELEMENT- SUBJECT IS H-INST [Dr. YYY]
        THEN DO $ASSIGN-SEL
        ELSE IF EXTENDED-CORE- X2 OF ELEMENT- SUBJECT IS H-PT
        THEN DO $ASSIGN-SEL2.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-MODAL := SYMBOL H-MODAL;
        X-VERBMODAL := NIL;
        PREFIX X-MODAL TO X-VERBMODAL;
        X-NEWATT := INTERSECT OF X-VERBMODAL;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-PTFUNC := SYMBOL H-PTFUNC;
        X-VERBPTFUNC := NIL;
        PREFIX X-PTFUNC TO X-VERBPTFUNC;
        X-NEWATT := INTERSECT OF X-VERBPTFUNC;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-FOLLOWED-BY =
        [* Resolve ambiguity of 'FOLLOWED_BY' H-TMLOC/H-TTGEN]
        IN PN:
        IF ELEMENT- P X1 IS 'FOLLOWED'_'BY'
        THEN IF CORE-ATT X10 OF CORE- OF ELEMENT- NSTGO HAS MEMBER H-INST
        ['pt followed by local MD'->'followed by" is H-TTGEN,]
        [ not H-TMLOC]
        THEN DO $ASSIGN-SEL
        ELSE IF X10 HAS MEMBER H-INDIC OR H-DIAG OR H-TXPROC OR H-TTSURG
        OR H-TTCOMP
        THEN DO $ASSIGN-SEL2
        ['fever followed by nausea'->'followed by" is H-TMLOC,]
        [ not H-TTGEN; also H-TMLOC in 'CABG followed by PTCA'].
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-TTGEN := SYMBOL H-TTGEN;
        X-NTTGEN := NIL;
        PREFIX X-TTGEN TO X-NTTGEN;
        X-NEWATT := INTERSECT OF X-NTTGEN;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-TMLOC := SYMBOL H-TMLOC;
        X-NTMLOC := NIL;
        PREFIX X-TMLOC TO X-NTMLOC;
        X-NEWATT := INTERSECT OF X-NTMLOC;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-FOLLOWING =
        [* Resolve ambiguity of 'FOLLOWING ' as H-TTGEN: 'we are following ]
        [* this patient in Hematology Clinic'; vs. 'FOLLOWING' as H-TMLOC ]
        [* as in 'the following morning'. ]
        IN AVAR:
        IF BOTH CORE- X1 IS 'FOLLOWING'
        AND CURRENT WORD X3 IS N: NTIME1 [day, year, morning,etc.]
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-TMLOC := SYMBOL H-TMLOC;
        X-NTMLOC := NIL;
        PREFIX X-TMLOC TO X-NTMLOC;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NTMLOC.
WATT-GROWTH =
        [* Resolve ambiguity of 'growth' H-INDIC/H-PTFUNC]
        IN NVAR AFTER N:
        IF N X1 IS 'GROWTH'
        THEN IF IN COELEMENT- LN CORE- X2 OF APOS IS 'HEAVY'
        THEN DO $ASSIGN-SEL
        ['heavy growth' -> 'growth" is H-INDIC, not H-PTFUNC]
        ELSE IF X2 IS 'NORMAL'
        THEN DO $ASSIGN-SEL2
        ['normal growth' -> 'growth" is H-PTFUNC, not H-INDIC].
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-INDIC := SYMBOL H-INDIC;
        X-NINDIC := NIL;
        PREFIX X-INDIC TO X-NINDIC;
        X-NEWATT := INTERSECT OF X-NINDIC;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-PTFUNC := SYMBOL H-PTFUNC;
        X-NPTFUNC := NIL;
        PREFIX X-PTFUNC TO X-NPTFUNC;
        X-NEWATT := INTERSECT OF X-NPTFUNC;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-HE-SHE =
        [* Resolve ambiguity of pronouns 'he' and 'she' H-PT/H-FAMILY/H-INST]
        [* to be H-PT if SECT-NAME = HOSPITAL COURSE, and to be H-INST in ]
        [* the special case of the sentence 'He agreed to see the patient ]
        [* in followup as an outpatient'. ]
        IN ASSERTION AFTER OBJECT:
        IF COELEMENT SUBJECT X-SUBJ OF ELEMENT- OBJECT EXISTS
        THEN IF CORE X1 OF X-SUBJ IS 'HE' OR 'SHE'
        THEN BOTH $PT AND $INST.
   $PT = IF BOTH IMMEDIATE-STRING IS OCCURRING IN ONESENT
        WHERE ELEMENT- SECTION EXISTS@
        AND THE SECOND ELEMENT OF SECT-NAME IS 'HOSPITAL-COURSE'
        THEN DO $ASSIGN-SEL-PT.
   $INST = IF EITHER BOTH CORE- X10 OF DEEPEST-COVERB- X11 IS H-TTGEN
        [see, admit]
        AND AT X11 CORE-ATT OF CORE- X2 OF COELEMENT- OBJECT
        HAS MEMBER H-PT
        [will see patient]
        OR BOTH X10 IS H-TXPROC [she will perform endoscopy]
        OR H-TTSURG [he will do a papillotomy]
        AND X11 IS NOT H-PTVERB
        [he underwent catheterization; he=H-PT]
        THEN DO $ASSIGN-SEL-INST.
   $ASSIGN-SEL-PT =
        X-NEWATT := NIL;
        X-NOW := SYMBOL H-PT;
        PREFIX X-NOW TO X-NEWATT;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL-INST =
        X-NEWATT := NIL;
        X-NOW := SYMBOL H-INST;
        PREFIX X-NOW TO X-NEWATT;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-HIS-HER =
        [* Resolve ambiguity of adjectival possessive pronouns 'his'/'her' ]
        [* H-PT/H-FAMILY. If not in Section FAMILY-HISTORY, then if core of]
        [* TPOS is 'his'/'her' and host is in one of the listed subclasses ]
        [* then assign H-PT. If in Section FAMILY-HISTORY, then do nothing.]
        IN NVAR AFTER N:
        PRESENT-ELEMENT- [NVAR] X3 EXISTS;
        IF BOTH CORE- X1 OF ELEMENT- TPOS OF COELEMENT- LN IS 'HIS' OR 'HER'
        AND IF IMMEDIATE-STRING IS OCCURRING IN ONESENT
        WHERE ELEMENT- SECTION EXISTS@
        THEN THE SECOND ELEMENT OF SECT-NAME IS NOT 'FAMILY-HISTORY'
        THEN IF CORE-ATT OF CORE- OF X3 HAS MEMBER H-PTFUNC [his output]
        OR H-PTPART [* blood in his stool]
        OR H-TXVAR [* trying to drop her cholerterol]
        OR H-INST [* consult her private physician]
        OR H-INDIC [* his chest pain]
        OR H-FAMILY [* according to his mother]
        OR H-TTMED [* forgets to take her isordil]
        OR H-RESP [* his improvement]
        OR H-DEVMED [* adjust his pacemaker]
        OR H-TTGEN [* at her discharge]
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-PT := SYMBOL H-PT;
        X-NPT := NIL;
        PREFIX X-PT TO X-NPT;
        X-NEWATT := INTERSECT OF X-NPT;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-HEARD =
        [* Resolve ambiguity of passive 'heard' H-TXCLIN/H-PTFUNC.]
        [* In 'crackles were heard','heard' is H-TXCLIN. ]
        [* In 'Patient heard no sound', 'heard' is H-PTFUNC. ]
        IN LVENR AFTER VEN:
        IF BOTH IMMEDIATE VENPASS X10 EXISTS
        AND CORE- X1 [OF LVENR] IS 'HEARD'
        THEN BOTH $RN-TXCLIN AND $PRED-TXCLIN.
   $RN-TXCLIN = IF HOST- X2 IS N:H-PTFUNC [* 'heart sounds']
        OR H-INDIC [*' crackles']
        THEN DO $ASSIGN-SEL
        [* 'heart sounds/crackles were heard']
        [* 'heard' is H-TXCLIN not H-PTFUNC in this case].
   $PRED-TXCLIN = IF X10 IS OCCURRING IN OBJECTBE X4
        WHERE AT IMMEDIATE-NODE OF X4
        COELEMENT SUBJECT X3 EXISTS
        THEN IF CORE- OF X3 IS N:H-PTFUNC [* heart sounds]
        OR H-INDIC [* crackles]
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-TXCLIN := SYMBOL H-TXCLIN;
        X-VENTXCLIN := NIL;
        PREFIX X-TXCLIN TO X-VENTXCLIN;
        X-NEWATT := INTERSECT OF X-VENTXCLIN;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-HR =
        [* Resolve ambiguity of 'HR' H-PTFUNC = 'heart rate']
        [* vs 'HR' NTIME1 = 'hour.': 'HR 96 regular' vs 'every hr'.]
        IN NVAR AFTER N:
        IF BOTH VALUE X1 IS 'HR'
        AND CURRENT WORD IS Q [* 'HR 96']
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-PTFUNC := SYMBOL H-PTFUNC;
        X-NPTFUNC := NIL;
        PREFIX X-PTFUNC TO X-NPTFUNC;
        X-NEWATT := INTERSECT OF X-NPTFUNC;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-INTERVAL =
        [* Resolve ambiguity of 'interval' H-TMDUR/E-INTVL based on EKG ]
        [* context. 'Interval' is not E-INTVL in 'The femoral component ]
        [* is in place with cement and shows no interval change'. If there]
        [* are no other EKG words in the sentence, then 'interval' is ]
        [* probably H-TMDUR. If there are E-words, then assign E-INTVL. ]
        [* If there are no E-words, but the words are 'Intervals were ...']
        [* then this could be an EKG sentence. But do not assume so; leave]
        [* both attributes E-INTVL and H-TMDUR. ]
        [* Strategy: look to the right for any E-word; if none found, go ]
        [* to start of sentence and step through looking for any E-word ]
        [* except E-INTVL (so as not to use word itself to decide class). ]
        IN NVAR, NNN, WVVAR:
        IF BOTH VALUE X1 IS 'INTERVAL' OR 'INTERVALS'
        AND X-FOUND := NIL
        THEN BOTH BOTH $E-TO-RIGHT
        AND $E-TO-LEFT
        AND IF X-FOUND IS NOT NIL
        THEN DO $ASSIGN-SEL
        ELSE EITHER BOTH X1 IS 'INTERVALS'
        AND CURRENT WORD IS 'WERE'
        OR DO $ASSIGN-SEL2
        ELSE TRUE.
   $E-TO-RIGHT = IF $EWORD
        THEN IF X-EWORD EXISTS
        THEN X-FOUND := X-EWORD.
   $EWORD = THERE IS AN N OR ADJ: E-AX OR E-EKGPROC OR E-LEAD OR
        E-INTVL OR E-WV AHEAD;
        STORE IN X-EWORD.
   $E-TO-LEFT = IF BOTH $TO-FIRST-WORD
        AND AT X-WORD DO $EWORD2
        THEN IF X-EWORD EXISTS
        THEN X-FOUND := X-EWORD.
   $TO-FIRST-WORD = GO TO CURRENT WORD;
        GO TO PRECEDING WORD ['interval'];
        STORE IN X-WORD;
        EITHER ITERATE $PREV-WORD
        OR TRUE;
        STORE IN X-WORD.
   $PREV-WORD = AT X-WORD
        GO TO PRECEDING WORD;
        STORE IN X-WORD.
   $EWORD2 = ITERATE $TEST-WORD UNTIL $NEXT-WORD FAILS.
   $TEST-WORD = AT X-WORD
        IF PRESENT-ELEMENT- IS N OR ADJ:
        E-AX OR E-EKGPROC OR E-LEAD OR E-WV
        @THEN STORE IN X-EWORD.
   $NEXT-WORD = GO TO X-WORD;
        GO TO NEXT WORD;
        STORE IN X-WORD.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-EINTVL := SYMBOL E-INTVL;
        X-NEINTVL := NIL;
        PREFIX X-EINTVL TO X-NEINTVL;
        X-NEWATT := INTERSECT OF X-NEINTVL;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-TMDUR := SYMBOL H-TMDUR;
        X-NTMDUR := NIL;
        PREFIX X-TMDUR TO X-NTMDUR;
        X-NEWATT := INTERSECT OF X-NTMDUR;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-L =
        [* Resolve ambiguity of 'L' H-PTAREA/E-LEAD in EKG context.]
        [* 'L' is E-LEAD in 'T wave inversions in L'. It should be ]
        [* the value N of LEADVAR in such occurrences. ]
        IN LEADVAR:
        IF VALUE X1 IS 'L'
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-ELEAD := SYMBOL E-LEAD;
        X-NELEAD := NIL;
        PREFIX X-ELEAD TO X-NELEAD;
        X-NEWATT := INTERSECT OF X-NELEAD;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-LAD =
        [* Resolve ambiguity of noun 'LAD' H-PTPART/H-TXVAR. In ]
        [* 'Runoff to the LAD' -> 'LAD'= H-PTPART='left anterior ]
        [* descending'. Also, 'LAD' = H-PTPART in 'LAD 95 % with ]
        [* patent LIMA to LAD'. Strategy to establish 'LAD' as ]
        [* H-PTPART: First Test P of PN. If not decisive, look at ]
        [* all sentence words to left and right of 'LAD'. If there]
        [* is a word on the list H-CARD-ARTERY or H-CARD-GRAFT, ]
        [* then assign SEL-ATT = H-PTPART. ]
        [* LAD H-TXVAR is lactic acid dehydrogenous. ]
        [* There is also (not covered yet) an EKG abbreviation ]
        [* LAD=left axis deviation. This is first cut. ]
        IN NVAR, NNN:
        IF BOTH VALUE X1 IS 'LAD'
        AND ONE OF $PN, $VESSEL-TO-RIGHT, $VESSEL-TO-LEFT
        THEN DO $ASSIGN-SEL.
   $PN = X1 IS OCCURRING IN PN
        WHERE P IS 'IN' OR 'TO' OR 'WITHIN' OR 'THROUGH' OR 'OF' OR 'AT'
        [* 'PTCA of LAD'][* '95% stenosis at the mid LAD'].
   $VESSEL-TO-RIGHT =
        THERE IS AN N:H-CARD-ARTERY OR H-CARD-GRAFT AHEAD.
   $VESSEL-TO-LEFT =
        BOTH $TO-FIRST-WORD
        AND BOTH AT X-WORD DO $VWORD
        AND X-VWORD EXISTS.
   $TO-FIRST-WORD =
        GO TO WORD STARTING PRESENT NODE;
        STORE IN X-STOP;
        STORE IN X-WORD;
        EITHER ITERATE $PREV-WORD
        OR TRUE;
        STORE IN X-WORD.
   $PREV-WORD = AT X-WORD
        GO TO PRECEDING WORD;
        STORE IN X-WORD.
   $VWORD = X-WORD IS NOT X-STOP;
        ITERATE $TEST-WORD UNTIL $NEXT-WORD FAILS.
   $TEST-WORD = AT X-WORD
        IF PRESENT-ELEMENT- IS N:H-CARD-ARTERY OR H-CARD-GRAFT
        THEN STORE IN X-VWORD.
   $NEXT-WORD = GO TO X-WORD;
        GO TO NEXT WORD;
        STORE IN X-WORD;
        X-WORD IS NOT X-STOP.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-PTPART := SYMBOL H-PTPART;
        X-NPTPART := NIL;
        PREFIX X-PTPART TO X-NPTPART;
        X-NEWATT := INTERSECT OF X-NPTPART;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-LEAD =
        [* Resolve ambiguity of 'LEAD' H-DEVMED/E-LEAD based on EKG ]
        [* context. 'LEAD' is not E-LEAD in 'The atrial lead was ]
        [* positioned in the right atrium'. If there are no other ]
        [* EKG words in the sentence, then 'LEAD' is probably H-DEVMED. ]
        [* If there are E-words, then assign E-LEAD. ]
        [* If there are no E-words, but the words are 'LEADs were ...' ]
        [* then this could be an EKG sentence. But do not assume so; leave]
        [* both attributes E-LEAD and H-DEVMED. 'Lead' H-CHEM not treated.]
        [* Strategy: look to the right for any E-word; if none found, go ]
        [* to start of sentence and step through looking for any E-word ]
        [* except E-LEAD (so as not to use word itself to decide class). ]
        IN NVAR, NNN, WVVAR:
        IF BOTH VALUE X1 IS 'LEAD' OR 'LEADS'
        AND X-FOUND := NIL
        THEN BOTH BOTH $E-TO-RIGHT
        AND $E-TO-LEFT
        AND IF X-FOUND IS NOT NIL
        THEN DO $ASSIGN-SEL
        ELSE EITHER BOTH X1 IS 'LEADS'
        AND CURRENT WORD IS 'WERE'
        OR DO $ASSIGN-SEL2
        ELSE TRUE.
   $E-TO-RIGHT = IF $EWORD
        THEN IF X-EWORD EXISTS
        THEN X-FOUND := X-EWORD.
   $EWORD = THERE IS AN N OR ADJ: E-AX OR E-EKGPROC OR E-LEAD OR
        E-INTVL OR E-WV AHEAD;
        STORE IN X-EWORD.
   $E-TO-LEFT = IF BOTH $TO-FIRST-WORD
        AND AT X-WORD DO $EWORD2
        THEN IF X-EWORD EXISTS
        THEN X-FOUND := X-EWORD.
   $TO-FIRST-WORD = GO TO CURRENT WORD;
        GO TO PRECEDING WORD ['LEAD'];
        STORE IN X-WORD;
        EITHER ITERATE $PREV-WORD
        OR TRUE;
        STORE IN X-WORD.
   $PREV-WORD = AT X-WORD
        GO TO PRECEDING WORD;
        STORE IN X-WORD.
   $EWORD2 = ITERATE $TEST-WORD UNTIL $NEXT-WORD FAILS.
   $TEST-WORD = AT X-WORD
        IF PRESENT-ELEMENT- IS N OR ADJ:
        E-AX OR E-EKGPROC OR E-INTVL OR E-WV
        @THEN STORE IN X-EWORD.
   $NEXT-WORD = GO TO X-WORD;
        GO TO NEXT WORD;
        STORE IN X-WORD.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-ELEAD := SYMBOL E-LEAD;
        X-NELEAD := NIL;
        PREFIX X-ELEAD TO X-NELEAD;
        X-NEWATT := INTERSECT OF X-NELEAD;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-DEVMED := SYMBOL H-DEVMED;
        X-NDEVMED := NIL;
        PREFIX X-DEVMED TO X-NDEVMED;
        X-NEWATT := INTERSECT OF X-NDEVMED;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-LEVEL =
        [* Resolve ambiguity of H-TXVAR/H-TTMED words before 'level', ]
        [* e.g. 'insulin' H-TXVAR/H-TTMED is H-TXVAR in 'insulin level']
        [* but is H-TTMED in 'being treated with insulin'. ]
        IN NVAR:
        IF BOTH CORE- IS 'LEVEL'
        AND IN CORE- X1 OF ELEMENT- NPOS OF COELEMENT- LN
        BOTH WORD STARTING PRESENT NODE IS N: H-TTMED [insulin]
        AND WORD STARTING PRESENT NODE IS N: H-TXVAR [insulin]
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-TXVAR := SYMBOL H-TXVAR;
        X-NTXVAR := NIL;
        PREFIX X-TXVAR TO X-NTXVAR;
        X-NEWATT := INTERSECT OF X-NTXVAR;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-LOCAL =
        [* Resolve ambiguity of 'local ' H-NULL/H-PTAREA.]
        [* 'Local' is H-NULL in 'local clinic'. ]
        [* 'Local' is H-PTAREA in 'local pathology' and ]
        [* 'local anesthesia'. ]
        IN AVAR:
        IF BOTH CORE- X1 IS 'LOCAL'
        AND EITHER CURRENT WORD X3 IS N: H-INDIC OR H-TTCOMP [anesthesia]
        OR H-TMREP [recurrence]
        OR X3 IS ADJ OR VING: H-INDIC OR H-TMREP [local recurring rash]
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-PTAREA := SYMBOL H-PTAREA;
        X-APTAREA := NIL;
        PREFIX X-PTAREA TO X-APTAREA;
        X-NEWATT := INTERSECT OF X-APTAREA;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-LONG =
        [* Resolve ambiguity of 'LONG ' H-TMDUR/H-DESCR; Depends on host. ]
        [* 'Long' is H-TMDUR with HOST=H-TMLOC: 'Long history of headaches']
        [* 'Long' is H-TMDUR with HOST=H-TTGEN: 'long initial visit'. ]
        [* 'Long' is H-TMDUR with HOST=H-MODAL: 'long discussion with pt'. ]
        [* 'Long' is H-TMDUR with HOST=H-PTFUNC:'She takes long walks' ]
        [* 'Long' is H-DESCR with HOST=H-DEVMED: 'long leg cast', ]
        [* 'Long' is H-DESCR with HOST=H-PTPART: 'long leg' ]
        [* 'Long' is H-DESCR with HOST=H-INDIC, 'long 90+ % stenosis', ]
        [* but is H-TMDUR with some HOST= H-INDIC: 'long illness'; ]
        [* stenosis/illness H-INDIC. So no rule for HOST=H-INDIC. ]
        [* Add rule for ADJ in SCALESTG: '2 yrs long' vs. '2 cm long'. ]
        IN NVAR AFTER N:
        IF IN COELEMENT- LN
        CORE- X1 OF APOS IS 'LONG'
        THEN IF ELEMENT- N X3 IS H-TMLOC [history] OR H-TTGEN [session, visit]
        OR H-MODAL [discussion] OR H-PTFUNC [walks]
        THEN AT X1 DO $ASSIGN-SEL
        ELSE IF X3 IS [H-INDIC OR H-DIAG OR] H-DEVMED OR H-PTPART
        THEN DO $ASSIGN-SEL2.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-TMDUR := SYMBOL H-TMDUR;
        X-ATMDUR := NIL;
        PREFIX X-TMDUR TO X-ATMDUR;
        X-NEWATT := INTERSECT OF X-ATMDUR;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-DESCR := SYMBOL H-DESCR;
        X-ADESCR := NIL;
        PREFIX X-DESCR TO X-ADESCR;
        X-NEWATT := INTERSECT OF X-ADESCR;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-LOWER =
        [* Resolve ambiguity of 'lower' H-CHANGE-LESS/H-PTAREA: ]
        [* 'lower abdoman', 'lower left chest' -> 'lower'= H-PTAREA.]
        [* Resolve ambiguity of 'low' H-AMT/H-PTAREA: ]
        [* 'pain in the low back' -> 'low'= H-PTAREA. ]
        [* Must test for NPOS->'back' in 'low back surgery'. ]
        IN NVAR:
        IF BOTH CORE- IS H-PTPART [chest, back]
        AND IN APOS OF COELEMENT- LN
        EITHER ADJADJ X-ADJ HAS VALUE LAR
        WHERE CORE- X1 IS 'LOWER' [lower abdomen]
        OR 'LOW' [low back]
        OR AT X-ADJ ELEMENT- ADJADJ EXISTS
        WHERE EITHER CORE- X1 IS 'LOWER' [lower left chest]
        OR $NEXT-ADJ IS TRUE [left lower extremity]
        THEN DO $ASSIGN-SEL
        ['lower left chest' -> Assign 'lower'= H-PTAREA.].
   $NEXT-ADJ = GO RIGHT; TEST FOR LAR; CORE X1 IS 'LOWER'.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-PTAREA := SYMBOL H-PTAREA;
        X-APTAREA := NIL;
        PREFIX X-PTAREA TO X-APTAREA;
        X-NEWATT := INTERSECT OF X-APTAREA;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-MR =
        [* Resolve homograph ambiguity of 'MR' H-PT (Mr XPT-P12345)]
        [* vs 'MR' H-INDIC (mitral regurgitation). In NNN position.]
        IN NNN:
        VALUE X1 EXISTS;
        IF X1 IS 'MR'
        THEN IF AT X1 WORD FOLLOWING PRESENT NODE IS N:H-PT
        THEN DO $ASSIGN-SEL
        ELSE DO $ASSIGN-SEL2.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-PT := SYMBOL H-PT;
        X-NPT := NIL;
        PREFIX X-PT TO X-NPT;
        X-NEWATT := INTERSECT OF X-NPT;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-INDIC := SYMBOL H-INDIC;
        X-NINDIC := NIL;
        PREFIX X-INDIC TO X-NINDIC;
        X-NEWATT := INTERSECT OF X-NINDIC;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-NEGATIVE =
        [* Resolve ambiguity of 'negative ' H-NEG/H-TXRES. ]
        [* 'negative' is H-NEG before 'for': 'negative for hearing loss']
        [* 'negative' is H-TXRES l elsewhere: 'Abdomen: negative'. ]
        IN AVAR:
        IF CORE- X1 IS 'NEGATIVE'
        THEN IF CURRENT WORD IS 'FOR'
        THEN DO $ASSIGN-SEL
        ELSE DO $ASSIGN-SEL2.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-NEG := SYMBOL H-NEG;
        X-ANEG := NIL;
        PREFIX X-NEG TO X-ANEG;
        X-NEWATT := INTERSECT OF X-ANEG;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-TXRES := SYMBOL H-TXRES;
        X-ATXRES := NIL;
        PREFIX X-TXRES TO X-ATXRES;
        X-NEWATT := INTERSECT OF X-ATXRES;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-NODES =
        [* Resolve ambiguity of 'nodes' H-PTPART/H-INDIC]
        [* 'at the axillary nodes' -> 'nodes'= H-PTPART.]
        [* 'no nodes or thyromegaly' -> 'nodes'= H-INDIC.]
        IN NVAR:
        IF CORE- X1 IS 'NODES'
        THEN IF IN TPOS OF COELEMENT- LN
        CORE- IS 'NO'
        THEN DO $ASSIGN-SEL
        ELSE DO $ASSIGN-SEL2.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-INDIC := SYMBOL H-INDIC;
        X-NINDIC := NIL;
        PREFIX X-INDIC TO X-NINDIC;
        X-NEWATT := INTERSECT OF X-NINDIC;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-PTPART := SYMBOL H-PTPART;
        X-NPTPART := NIL;
        PREFIX X-PTPART TO X-NPTPART;
        X-NEWATT := INTERSECT OF X-NPTPART;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-NORMALLY =
        [* Resolve ambiguity of 'NORMALLY' H-TMDUR/H-NORMAL; ]
        [* 'he normally takes Ventolin' -> 'NORMALLY'= H-TMDUR.]
        [* 'Patient speaks normally' -> 'NORMALLY'= H-NORMAL. ]
        IN LDR:
        IF CORE- X1 IS 'NORMALLY'
        THEN IF EITHER IMMEDIATE SAOPTS EXISTS
        OR IMMEDIATE LV EXISTS
        ['he takes Ventolin normally']
        ['he normally takes Ventolin']
        THEN DO $ASSIGN-SEL
        ELSE IF IMMEDIATE RV EXISTS
        ['Patient speaks normally']
        THEN DO $ASSIGN-SEL2
        ELSE TRUE.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-TMDUR := SYMBOL H-TMDUR;
        X-NTMDUR := NIL;
        PREFIX X-TMDUR TO X-NTMDUR;
        X-NEWATT := INTERSECT OF X-NTMDUR;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-NORMAL := SYMBOL H-NORMAL;
        X-NNORMAL := NIL;
        PREFIX X-NORMAL TO X-NNORMAL;
        X-NEWATT := INTERSECT OF X-NNORMAL;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-PATIENT =
        [* Distinguish the patient subject of the document = H-PT ]
        [* from "another patient" = H-FAMILY (family-friend-others]
        [* Important for further processing and retrieval. ]
        [* Ex: 'On the following day in the pulmonary function test ]
        [* laboratory, she saw another patient with slate-colored skin]
        [* secondary to amiodarone.']
        IN NVAR:
        IF CORE- X1 IS 'PATIENT'
        THEN IF IN APOS OF COELEMENT- LN
        CORE- IS 'ANOTHER'
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-FAMILY := SYMBOL H-FAMILY;
        X-NFAMILY := NIL;
        PREFIX X-FAMILY TO X-NFAMILY;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NFAMILY.
WATT-PLACED =
        [* Resolve sublanguage ambiguity of 'PLACED', as between H-TTSURG ]
        [* (stent was placed) and H-TTGEN (patient was placed on aspirin). ]
        [* In ASSERTION if the SUBJECT is H-PT and 'PLACED' is in VENPASS ]
        [* occurring in OBJECT (usually as object of the verb 'be'), then ]
        [* the class is H-TTGEN; if the SUBJECT is H-DEVMED then the class ]
        [* is H-TTSURG. ]
        IN ASSERTION AFTER OBJECT:
        BOTH
        IF AT ELEMENT- SUBJECT X10
        BOTH CORE- X1 OF DEEPEST-COVERB- X3 IS 'PLACED'
        WHERE X3 IS OCCURRING IN VENPASS
        AND CORE- [of SUBJECT] IS H-PT [patient was placed on aspirin]
        THEN DO $ASSIGN-SEL
        AND
        IF AT X10
        BOTH CORE- X1 OF DEEPEST-COVERB- X3 IS 'PLACED'
        WHERE X3 IS OCCURRING IN VENPASS
        AND CORE- [of SUBJECT] IS H-DEVMED [stent was placed]
        THEN DO $ASSIGN-SEL2.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-TTGEN := SYMBOL H-TTGEN;
        X-VERBTTGEN := NIL;
        PREFIX X-TTGEN TO X-VERBTTGEN;
        X-NEWATT := INTERSECT OF X-VERBTTGEN;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-TTSURG := SYMBOL H-TTSURG;
        X-VERBTTSURG := NIL;
        PREFIX X-TTSURG TO X-VERBTTSURG;
        X-NEWATT := INTERSECT OF X-VERBTTSURG;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-PLACED2 =
        [* WATT-PLACED adapted for VENPASS as adjunct of HOST noun. ]
        [* Resolve sublanguage ambiguity of 'PLACED', as between H-TTSURG ]
        [* (stent placed last January) and H-TTGEN (patient recently placed ]
        [* in nursing home was admitted for pneumonia) occurring in VENPASS ]
        [* in RNOPTS. In the case where the HOST is H-PT then the class is ]
        [* H-TTGEN; if the HOST is H-DEVMED then the class is H-TTSURG. ]
        IN LVENR AFTER VEN:
        IF BOTH IMMEDIATE VENPASS X10 EXISTS
        WHERE CORE- X1 [OF LVENR] IS 'PLACED'
        AND HOST X11 OF X10 EXISTS
        THEN IF X11 IS N:H-PT
        THEN DO $ASSIGN-SEL
        ELSE IF X11 IS N:H-DEVMED
        THEN DO $ASSIGN-SEL2
        ELSE TRUE
        ELSE TRUE.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-TTGEN := SYMBOL H-TTGEN;
        X-VERBTTGEN := NIL;
        PREFIX X-TTGEN TO X-VERBTTGEN;
        X-NEWATT := INTERSECT OF X-VERBTTGEN;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-TTSURG := SYMBOL H-TTSURG;
        X-VERBTTSURG := NIL;
        PREFIX X-TTSURG TO X-VERBTTSURG;
        X-NEWATT := INTERSECT OF X-VERBTTSURG;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-PRESSURE =
        [* Resolve ambiguity of 'pressure' H-PTFUNC/H-INDIC]
        [* 'venous pressure' -> 'pressure'= H-PTFUNC.]
        [* 'pressure on the chest' -> 'pressure'= H-INDIC.]
        IN NVAR:
        IF BOTH CORE- X1 IS 'PRESSURE'
        AND IN COELEMENT- LN
        EITHER CORE- OF NPOS IS H-PTPART [pulse pressure]
        OR CORE- OF APOS IS H-PTPART [venous pressure]
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-PTFUNC := SYMBOL H-PTFUNC;
        X-NPTFUNC := NIL;
        PREFIX X-PTFUNC TO X-NPTFUNC;
        X-NEWATT := INTERSECT OF X-NPTFUNC;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-PT =
        [* Partially resolve 'PT' = H-PT/H-TXVAR/H-TTCOMP, i.e. ]
        [* H-PT is H-TXVAR when it stands for Prothrombin Time. ]
        [* In 'Pt with a hx of CAD', 'Pt' is the patient, H-PT. ]
        IN NVAR:
        IF CORE- X1 IS 'PT'
        THEN IF CURRENT WORD IS 'WITH' OR 'WHO'
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NPATIENT := LIST PATIENT-LIST;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NPATIENT.
WATT-PTLOC =
        [* Resolve sublanguage ambiguity of H-PTLOC in verb occurrence.]
        [* E.g. 'enters' = H-PTLOC, H-TMBEG, in 'She will use a spacer ]
        [* so that no drug enters her eyes' the vb 'enters' is H-PTLOC.]
        [* If OBJECT = N:(H-PTPART) in ASSERTION (could be generalized)]
        [* then 'enters' (and others like it) must be H-PTLOC. ]
        IN ASSERTION AFTER OBJECT:
        IN OBJECT X3
        IF BOTH CORE-ATT OF CORE- HAS MEMBER H-PTPART
        AND BOTH AT X3 CORE- X1 OF COELEMENT VERB IS H-PTLOC
        AND X1 IS NOT [also] H-PTFUNC [for 'extend' and 'pronate']
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-PTLOC := SYMBOL H-PTLOC;
        X-VERBPTLOC := NIL;
        PREFIX X-PTLOC TO X-VERBPTLOC;
        X-NEWATT := INTERSECT OF X-VERBPTLOC;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-RADIATION =
        [* Resolve ambiguity of 'RADIATION' H-PTLOC vs. H-TTCOMP.]
        [* 'RADIATION' is H-PTLOC in 'with radiation to the base ]
        [* of the neck'. 'Radiation' is H-TTCOMP in 'radiation ]
        [* therapy'.]
        IN NVAR AFTER N:
        IF VALUE X1 IS 'RADIATION'
        THEN IF CURRENT WORD IS 'TO' OR 'TOWARD'
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-PTLOC := SYMBOL H-PTLOC;
        X-NPTLOC := NIL;
        PREFIX X-PTLOC TO X-NPTLOC;
        X-NEWATT := INTERSECT OF X-NPTLOC;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-REMOVED =
        [* Resolve sublanguage ambiguity of 'REMOVED', as between H-TTSURG ]
        [* (tumor was removed) and H-TTGEN (patient was removed from aspirin)]
        [* In the case where the SUBJECT is H-PT and the 'removed' is passive]
        [* then the class is H-TTGEN; if the SUBJECT is H-INDIC or H-DIAG or]
        [* H-PTPART then the class is H-TTSURG. ]
        IN ASSERTION AFTER OBJECT:
        IF AT ELEMENT- SUBJECT X10
        BOTH CORE- X1 OF DEEPEST-COVERB- X3 IS 'REMOVED'
        WHERE X3 IS OCCURRING IN VENPASS
        AND CORE- [of SUBJECT] IS H-PT
        THEN DO $ASSIGN-SEL
        ELSE IF CORE- [of SUBJECT] IS H-PTPART OR H-INDIC OR H-DIAG
        THEN DO $ASSIGN-SEL2.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-TTGEN := SYMBOL H-TTGEN;
        X-VERBTTGEN := NIL;
        PREFIX X-TTGEN TO X-VERBTTGEN;
        X-NEWATT := INTERSECT OF X-VERBTTGEN;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-TTSURG := SYMBOL H-TTSURG;
        X-VERBTTSURG := NIL;
        PREFIX X-TTSURG TO X-VERBTTSURG;
        X-NEWATT := INTERSECT OF X-VERBTTSURG;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-RETURNED =
        [* Resolve sublanguage ambiguity of 'returned' in TV occurrence. ]
        [* 'Returned' = H-TTGEN, H-TMREP. In 'Pt returned to clinic' it ]
        [* is H-TTGEN; in 'Fibrillation returned' it is H-TMREP. ]
        [* If SUBJECT = N:(H-INDIC) in ASSERTION then 'returned' is H-TMREP.]
        [* If SUBJECT = N:(H-PT) in ASSERTION then 'returned' is H-TTGEN. ]
        IN ASSERTION AFTER VERB:
        IN VERB X3
        IF BOTH CORE- X1 OF X3 IS 'RETURNED'
        AND AT COELEMENT- SUBJECT CORE-ATT X5 OF EXTENDED-CORE- EXISTS
        THEN IF X5 HAS MEMBER
        H-INDIC [atrial fibrillation which returned to sinus rhythm]
        THEN DO $ASSIGN-SEL
        ELSE IF X5 HAS MEMBER H-PT ['Pt returned to clinic']
        THEN DO $ASSIGN-SEL2.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-TMREP := SYMBOL H-TMREP;
        X-VERBTMREP := NIL;
        PREFIX X-TMREP TO X-VERBTMREP;
        X-NEWATT := INTERSECT OF X-VERBTMREP;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-TTGEN := SYMBOL H-TTGEN;
        X-VERBTTGEN := NIL;
        PREFIX X-TTGEN TO X-VERBTTGEN;
        X-NEWATT := INTERSECT OF X-VERBTTGEN;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-SECOND =
        [* Resolve ambiguity of ADJ 'SECOND'=H-TMLOC/H-PTAREA; ]
        [* 'second' is H-TMLOC in 'for the second time' while ]
        [* 'second' is H-PTAREA in 'second intercostal space'. ]
        IN AVAR AFTER ADJ:
        IF ADJ X1 IS 'SECOND'
        THEN IF EITHER CURRENT WORD X-CURRENT IS N:H-PTAREA OR H-PTPART
        OR CURRENT WORD X-CURRENT IS ADJ:H-PTAREA OR H-PTPART
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-PTAREA := SYMBOL H-PTAREA;
        X-NPTAREA := NIL;
        PREFIX X-PTAREA TO X-NPTAREA;
        X-NEWATT := INTERSECT OF X-NPTAREA;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-SEE =
        [* Resolve sublanguage ambiguity of 'SEE' in TV occurrence. ]
        [* 'SEE' = H-PTFUNC, H-TTGEN, H-OBSERVE. In 'Pt sees normally' ]
        [* 'see' is H-PTFUNC; in 'One can see the rash' it is H-OBSERVE.]
        [* If OBJECT = H-INST or H-PT then 'see' is H-TTGEN. ]
        IN OBJECT:
        PRESENT-ELEMENT- X3 EXISTS;
        IF BOTH EITHER CORE- X1 OF COELEMENT- VERBAL IS 'SEE'
        [in ASSERTION:will see pt, agreed to see pt]
        OR CORE- X1 OF COELEMENT- LVR IS 'SEE'
        [in TOVO:advised to see a doctor]
        AND CORE-ATT OF CORE- OF X3 HAS MEMBER H-PT [will see the patient]
        OR H-INST [pt should see a doctor]
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-TTGEN := SYMBOL H-TTGEN;
        X-VERBTTGEN := NIL;
        PREFIX X-TTGEN TO X-VERBTTGEN;
        X-NEWATT := INTERSECT OF X-VERBTTGEN;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-SEEN =
        [* Resolve ambiguity of passive 'SEEN' H-TTGEN/H-TXCLIN/H-OBSERVE.]
        [* If right adjunct of 'seen' is P H-INST (seen in clinic) or ]
        [* if subject of passive 'seen' is H-PT (Pt was seen) then 'seen' ]
        [* is H-TTGEN. If the host or subject is H-INDIC or H-PTPART or ]
        [* H-TXVAR or H-PTFUNC the 'seen' is H-OBSERVE (no reflux seen). ]
        IN LVENR:
        IF BOTH IMMEDIATE VENPASS X10 EXISTS
        AND CORE- X1 [OF LVENR] IS 'SEEN'
        THEN BOTH $TTGEN AND $OBSERVE.
   $TTGEN = IF EITHER RIGHT-ADJUNCT X2 OF X1 IS PN
        WHERE CORE- OF ELEMENT- NSTGO IS H-INST
        [* 'in clinic']
        OR X10 IS OCCURRING IN OBJECTBE X4 WHERE
        BOTH AT IMMEDIATE-NODE OF X4 COELEMENT SUBJECT X3 EXISTS
        AND CORE- OF X3 IS H-PT
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-TTGEN := SYMBOL H-TTGEN;
        X-VENTTGEN := NIL;
        PREFIX X-TTGEN TO X-VENTTGEN;
        X-NEWATT := INTERSECT OF X-VENTTGEN;
        AT X1 DO $ASSIGN.
   $OBSERVE = IF EITHER HOST- OF X10 IS H-INDIC OR H-PTPART OR H-TXVAR
        OR H-PTFUNC
        OR EITHER X10 IS OCCURRING IN OBJECTBE X4
        WHERE BOTH AT IMMEDIATE-NODE OF X4
        COELEMENT SUBJECT X3 EXISTS
        AND CORE- OF X3 IS H-INDIC
        OR H-PTPART OR H-TXVAR OR H-PTFUNC
        OR X10 IS OCCURRING IN OBJBE X4
        WHERE BOTH AT IMMEDIATE-NODE OF X4
        COELEMENT BESUBJ X3 EXISTS
        AND CORE- OF X3 IS H-INDIC OR H-PTPART
        OR H-TXVAR OR H-PTFUNC
        [* 'no hepatojugular reflux seen']
        THEN DO $ASSIGN-SEL-OBS.
   $ASSIGN-SEL-OBS = X-NEWLIST := CORE-SELATT OF X1;
        X-OBSERVE := SYMBOL H-OBSERVE;
        X-VENOBSERVE := NIL;
        PREFIX X-OBSERVE TO X-VENOBSERVE;
        X-NEWATT := INTERSECT OF X-VENOBSERVE;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-SERIES =
        [* Resolve ambiguity of 'SERIES' in NVAR. ]
        [* In 'series of seizures', 'series of lab tests' ]
        [* 'series' is only H-TMREP. In 'Pt had a GI series']
        [* 'series' is both H-TXPROC and H-TMREP. ]
        IN NVAR AFTER N:
        IF N X1 IS 'SERIES'
        THEN IF CURRENT WORD IS 'OF'
        THEN DO $ASSIGN-SEL
        ELSE BOTH $PROC AND $SPEC.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-TMREP := SYMBOL H-TMREP;
        X-NTMREP := NIL;
        PREFIX X-TMREP TO X-NTMREP;
        X-NEWATT := INTERSECT OF X-NTMREP;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
   $PROC = IF IN COELEMENT- LN
        EITHER CORE- OF NPOS IS H-PTPART [GI series]
        OR CORE- OF APOS IS H-PTPART [abdominal series]
        THEN DO $ASSIGN-SEL2.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-TXPROC := SYMBOL H-TXPROC;
        X-NTXPROC := NIL;
        PREFIX X-TXPROC TO X-NTXPROC;
        X-NEWATT := INTERSECT OF X-NTXPROC;
        AT X1 DO $ASSIGN.
   $SPEC = IF IN COELEMENT- LN CORE- X2 OF NPOS IS H-ORG [HepB series]
        THEN DO $ASSIGN-SEL3.
   $ASSIGN-SEL3 = X-NEWLIST := CORE-SELATT OF X1;
        X-TXSPEC := SYMBOL H-TXSPEC;
        X-NTXSPEC := NIL;
        PREFIX X-TXSPEC TO X-NTXSPEC;
        X-NEWATT := INTERSECT OF X-NTXSPEC;
        AT X1 DO $ASSIGN.
WATT-ST =
        [* Resolve homograph ambiguity of 'ST' H-PTPART (subtalar)]
        [* vs 'ST' E-INTVL (EKG wave). In NNN position. ]
        [* 4/18/01 replaced word check by IMMEDIATE LN IS OCCURRING IN LWVR.]
        [* Word check was CURRENT WORD IS 'DEPRESSION' OR 'ELEVATION' OR ]
        [* 'INVERSION' OR 'DEPRESSIONS' OR 'ELEVATIONS' OR 'INVERSIONS' OR ]
        [* 'CHANGES'. Similarly in WATT-ST2. ]
        IN NNN AFTER N:
        IF BOTH ELEMENT- N X1 IS 'ST'
        AND IMMEDIATE LN IS OCCURRING IN LWVR
        ['ST depressions in AV1']
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-EINTVL := SYMBOL E-INTVL;
        X-NEINTVL := NIL;
        PREFIX X-EINTVL TO X-NEINTVL;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEINTVL.
WATT-ST2 =
        [* Resolve homograph ambiguity of 'ST' H-PTPART (subtalar)]
        [* vs 'ST' E-INTVL (EKG wave). In WVVAR position. ]
        [* 4/18/01 replaced word check by IMMEDIATE LN IS OCCURRING IN LWVR.]
        IN WVVAR AFTER N:
        IF ELEMENT- N X1 IS 'ST' ['ST elevated']
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-EINTVL := SYMBOL E-INTVL;
        X-NEINTVL := NIL;
        PREFIX X-EINTVL TO X-NEINTVL;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEINTVL.
WATT-T =
        [* Resolve ambiguity of 'T' H-PTFUNC (temperature) vs. 'T' E-WV ]
        [* (EKG wave) as in 'flipped T in V4'. 'T' should be the value N]
        [ of WVVAR in EKG occurrences. ]
        IN WVVAR:
        IF VALUE X1 IS 'T'
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-EWV := SYMBOL E-WV;
        X-NEWV := NIL;
        PREFIX X-EWV TO X-NEWV;
        X-NEWATT := INTERSECT OF X-NEWV;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-T2 =
        [* Resolve ambiguity of 'T' H-PTFUNC (temperature) vs. 'T' E-WV ]
        [* (EKG wave) as in 'flipped T in V4'. 'T' should be the value N]
        [ of NVAR when T stands for temperasture, as in 'T 98.6']
        IN NVAR AFTER N:
        IF VALUE X1 IS 'T'
        THEN IF CURRENT WORD IS Q:QNUMBER
        THEN DO $ASSIGN-SEL-FUNC.
   $ASSIGN-SEL-FUNC = X-NEWLIST := CORE-SELATT OF X1;
        X-FUNC := SYMBOL H-PTFUNC;
        X-NFUNC := NIL;
        PREFIX X-FUNC TO X-NFUNC;
        X-NEWATT := INTERSECT OF X-NFUNC;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-TEARS =
        [* Resolve homograph ambiguity of 'tears' H-PTPART vs 'tears' ]
        [* H-INDIC as in 'medial meniscal tears', and in 'partial tear']
        IN NVAR AFTER N:
        IF BOTH ELEMENT- N X1 IS 'TEARS'
        AND IN COELEMENT- LN
        EITHER APOS X2 SUBSUMES 'PARTIAL' OR 'SMALL' OR 'SLIGHT' OR
        'MULTIPLE'
        OR X2 SUBSUMES ADJ: H-PTPART [medial meniscal tears]
        ['partial tears' -> 'tears" is H-INDIC, not H-PTPART]
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-INDIC := SYMBOL H-INDIC;
        X-NINDIC := NIL;
        PREFIX X-INDIC TO X-NINDIC;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NINDIC.
WATT-TESTVIEW =
        [* Resolve ambiguity of words that are both ADJ and N, where the]
        [* ADJ is H-PTPART or H-PTAREA and the N is H-TESTVIEW, e.g. ]
        [* 'GASTROINTESTINAL' as ADJ:H-PTPART vs 'GASTROINTESTINAL' as ]
        [* N: H-TESTVIEW (Patient is scheduled for a gastrointestinal ]
        [* without contrast). In NNN position, reject the N:H-TESTVIEW; ]
        [* force the word to be ADJ:H-PTPART or H-PTAREA. N:H-TESTVIEW ]
        [* only if there is no other analysis.]
        IN NNN:
        VALUE IS NOT N:H-TESTVIEW.
WATT-UNREMARKABLE =
        [* Resolve ambiguity of 'unremarkable ' H-NEG/H-NORMAL. ]
        [* 'Unremarkable' is H-NEG before 'for' as in 'unremarkable ]
        [* for hearing loss'. ]
        [* 'Unremarkable' is H-NORMAL elsewhere: 'ABDOMEN: unremarkable'.]
        IN AVAR:
        IF CORE- X1 IS 'UNREMARKABLE'
        THEN IF CURRENT WORD IS 'FOR'
        THEN DO $ASSIGN-SEL
        ELSE DO $ASSIGN-SEL2.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-NEG := SYMBOL H-NEG;
        X-ANEG := NIL;
        PREFIX X-NEG TO X-ANEG;
        X-NEWATT := INTERSECT OF X-ANEG;
        AT X1 DO $ASSIGN.
   $ASSIGN-SEL2 = X-NEWLIST := CORE-SELATT OF X1;
        X-NORMAL := SYMBOL H-NORMAL;
        X-ANORMAL := NIL;
        PREFIX X-NORMAL TO X-ANORMAL;
        X-NEWATT := INTERSECT OF X-ANORMAL;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WATT-V =
        [* Resolve homograph ambiguity of 'V' NUNIT (volt, volume) ]
        [* vs 'V' H-INDIC (vomiting). Example of NUNIT: 'Both outputs ]
        [* are at 5 V'. Example of H-INDIC: 'No N, V or edema'. ]
        [* If QN succeeds with N = 'V', then eliminate the H-INDIC ]
        [* attribute; assign SELATT = NUNIT. Similar to WATT-CC. ]
        IN QN:
        IF ELEMENT- N X1 IS 'V'
        THEN DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NUNIT := SYMBOL NUNIT;
        X-NNUNIT := NIL;
        PREFIX X-NUNIT TO X-NNUNIT;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NNUNIT.
WATT-X =
        [* In emlex 'x' is both N:(NUNIT) and P. ]
        [* It is taken as N in '3 x' (= '3 times')]
        [* It is taken as P in 'x 3' (= 'times 3')]
        [* As N, it should allowed only in Q N, not NVAR. ]
        [* Ex: 'with nausea x 2.' we do not have 'nausea x']
        [* as a noun phrase, leaving '2' to be parsed in ]
        [* another structure.]
        IN NVAR AFTER N:
        VALUE [i.e. N] IS NOT 'X'.
— COMMA RESTRICTIONS
DCOM1 =
        [* Require ',' before RNSUBJ if coelement object is nonempty ]
        [* or require that RNOPTS is second SA in SA-LAST: 'He had an]
        [* xray there which was negative'. ]
        IN SAOPTS RE RNSUBJ:
        EITHER PRECEDING WORD IS ','
        OR AT IMMEDIATE SA-LAST
        EITHER BOTH $OBJ AND $PASSOBJ
        OR ELEMENT- SAOPTS EXISTS [preceding SA in recursive df].
   $OBJ = IF COELEMENT OBJECT EXISTS@
        THEN PRESENT-ELEMENT- IS EMPTY.
   $PASSOBJ = IF COELEMENT PASSOBJ EXISTS@
        THEN PRESENT-ELEMENT- IS EMPTY.
DCOM2 =
        [* No ',' before VERB unless a non-empty SA or RN precedes]
        [* or coelement SUBJECT is NULLC: She was ill and was seen]
        [* Must cover both SA positions around an empty TENSE. ]
        IN VERB RE OPTION 3:
        IF THE PRECEDING WORD IS ','
        THEN EITHER VALUE OF COELEMENT- SUBJECT IS NULLC
        OR ONE OF $PREVSA, $PREVRN, $INFRAG IS TRUE.
   $PREVSA = EITHER BOTH PREVIOUS-ELEMENT- X1 IS SA OR SACONJ
        AND X1 IS NOT EMPTY
        OR AT X1 BOTH PREVIOUS-ELEMENT- [TENSE] X2 IS EMPTY
        AND AT X2 PREVIOUS-ELEMENT- [SA post-SUBJ]
        IS NOT EMPTY
        [She , in 10/00/89 , had an infarct].
   $PREVRN = IF VERB IS NOT OCCURRING IN OBES
        THEN BOTH COELEMENT TENSE IS EMPTY
        AND CORE OF COELEMENT SUBJECT IS N OR VING OR PRO
        WHERE AT RIGHT-ADJUNCT-POS
        RNOPTS IS NOT EMPTY.
   $INFRAG = IMMEDIATE-NODE- IS TVO.
DCOM2A =
        [* No ',' before TENSE unless a non-empty SA or RN precedes ]
        [* or coelement SUBJECT is NULLC: 'She was ill and will be seen']
        IN TENSE RE OPTION 1:
        IF THE PRECEDING WORD IS ','
        THEN EITHER VALUE OF COELEMENT- SUBJECT X1 IS NULLC
        OR ONE OF $PREVSA, $PREVRN, $INFRAG IS TRUE.
   $PREVSA = BOTH PREVIOUS-ELEMENT- X1 IS SA OR SACONJ
        AND X1 IS NOT EMPTY.
   $PREVRN = CORE OF X1 IS N OR VING OR PRO
        WHERE AT RIGHT-ADJUNCT-POS RNOPTS IS NOT EMPTY.
   $INFRAG = IMMEDIATE-NODE- IS TVO.
DCOM3 =
        [* A comma preceding NPOS is possible if NPOS starts a nounphrase]
        [* i.e. no preceding LN adjuncts, or if APOS contains an adjunct ]
        [* marked off by commas. Companion restriction to WCOM1. Example:]
        [* a discrete, approximately 8 mm in length, section of stenosis.]
        IN NPOS:
        IF WORD PRECEDING PRESENT NODE IS ','
        THEN AT IMMEDIATE-NODE- [LN]
        EITHER ALL OF $T, $Q, $A
        OR $ADJFULL.
   $T = ELEMENT- TPOS IS EMPTY.
   $Q = ELEMENT- QPOS IS EMPTY.
   $A = ELEMENT- APOS IS EMPTY.
   $ADJFULL = CORE- OF ELEMENT- APOS IS QN
        WHERE WORD PRECEDING PRESENT NODE IS ','
        [a discrete , approximately 8 mm in length , section of stenosis].
DCOM4 =
        [* Certain strings in RN should not be preceded by a comma. ]
        [* OK: the man to see is John, NOT OK: the man, to see is John.]
        IN RNOPTS RE TOVO,TOVO-N, LDR:
        THE PRECEDING WORD IS NOT ','.
DCOM5 =
        IN RNOPTS RE S-N:
        [* Certain strings in RN should not be preceded by a comma. ]
        [* The "headless wh-string" S-N is one of these unless it ]
        [* begins with a pronoun. ]
        EITHER THE PRECEDING WORD IS NOT ','
        OR CURRENT WORD IS 'HE' OR 'SHE'
        [status post five-vessel bypass , she says , in 00/00/1988].
WCOM1 =
        [* Restricts ',' in TPOS, QPOS, APOS and NPOS]
        IN TPOS, QPOS, APOS, NPOS:
        IF PRESENT-ELEMENT- IS NOT EMPTY
        THEN EITHER WORD ENDING PRESENT NODE IS NOT ','
        OR BOTH PRESENT-ELEMENT- IS APOS
        WHERE CORE- IS QN X2
        AND AT X2 WORD PRECEDING PRESENT NODE IS ','
        [a discrete , approximately 8 mm in length , section of stenosis].
WCOM1A =
        [* Restricts ',' following NPOS]
        [* In 'No sputum, and chest tightness' NPOS=/ 'sputum, and chest']
        IN NPOS:
        WORD FOLLOWING PRESENT NODE IS NOT ','.
WCOM2=
        [* Restricts ',' in QN]
        IN QN AFTER LQR:
        IF PRESENT-ELEMENT- IS NOT EMPTY
        THEN WORD ENDING PRESENT NODE IS NOT ','.
WCOM3 =
        [* No comma preceding NVAR unless LN is empty: *a large, tumor]
        [* But comma OK of APOS has a QN set off ny commas. DCOM3, WCOM1]
        IN NVAR:
        IF THE WORD PRECEDING THE PRESENT NODE IS ','
        THEN EITHER COELEMENT- LN X1 IS EMPTY
        OR AT X1 $ADJFULL IS TRUE.
   $ADJFULL = CORE- OF ELEMENT- APOS IS QN
        WHERE WORD PRECEDING PRESENT NODE IS ','
        [a discrete , approximately 8 mm in length , section of stenosis].
WCOM4 =
        [* No ',' before ADJINRN; some exceptions ]
        IN RNOPTS AFTER ADJINRN:
        IF WORD PRECEDING PRESENT NODE IS ','
        THEN EITHER PRESENT-ELEMENT- IS OCCURRING IN RNSUBJ
        [* '... , a little better on the right than on the left']
        OR WORD ENDING PRESENT NODE IS ADJ:H-AMT
        [* 'orpthopnea, two-pillow']
        OR H-CHANGE-SAME [* 'scarring, unchanged']
        OR AINRN [* 'hypertension , well-controlled']
        ELSE [WORD PRECEDING PRESENT NODE IS NOT ',' so in this case...]
        CURRENT WORD IS NOT N:H-INDIC OR H-DIAG OR H-PTPART OR
        H-PTFUNC OR H-PTAREA [don't split ADJ + N].
WCOM5 =
        [* No ',' between a left adjunct and its host. ]
        [* In 'Tiring easily, relieved by rest', 'easily' is]
        [* not a left modifier of 'relieved'. ]
        IN LA, LD, LP, LQ, LT, LW, LV:
        IF PRECEDING WORD EXISTS
        [needed because WORD ENDING PRESENT NODE fails at sent start]
        THEN IF PRESENT-ELEMENT- IS NOT EMPTY
        THEN WORD ENDING PRESENT NODE IS NOT ','.
WCOM6 =
        [* Restricts ',' in NPN]
        IN NPN AFTER NSTGO:
        PRECEDING WORD IS NOT ','.
WCOM7 =
        [* Restricts comma in APOS between 2 LARs: Not VING COMMA VEN.]
        [* 7/11/00 E.g. not VING COMMA VEN in LAR: "walking, stopped" ]
        [* in "He decreased walking, stopped playing tennis"; cf WCONJ6]
        IN LAR:
        PRESENT-ELEMENT- X3 EXISTS;
        IF COELEMENT- ADJADJ X1 EXISTS
        THEN NOT ALL OF $COMMA, $VEN, $VING.
   $COMMA = IN X1 WORD ENDING PRESENT NODE IS ','.
   $VEN = CORE- OF X3 IS VEN.
   $VING = CORE- OF X1 IS VING.
WCOM8 =
        [* Restricts ',' between adverbs in RV]
        [* No conjunction of 'bilaterally' and 'a little better' in ]
        [* 'Good pulses are noted bilaterally , a little better on ]
        [* the right than on the left'.Keep 'a little better' with ]
        [* 'on the right than on the left'. ]
        IN RV AFTER LDR:
        IN LDR
        IF ELEMENT- COMMASTG EXISTS@
        THEN [in COMMASTG] IT IS NOT THE CASE THAT
        ELEMENT- Q-CONJ EXISTS.
WCOM9 =
        [* Special for 'Blood pressure 194 / 84 in left arm, ]
        [* 184 / 84 in right arm'. Disallow punctuation comma ]
        [* after 'left arm' so ',' will be conjunction higher ]
        [* up, yielding QUANT CONJ QUANT on 'blood pressure'. ]
        [* If ',' is punctuation we get a nest of RNs on 'blood]
        [* pressure' and not two findings of blood pressure. ]
        IN COMMASTG:
        IF BOTH BOTH IT IS NOT THE CASE THAT
        ELEMENT- Q-CONJ EXISTS [punct comma]
        AND CURRENT WORD IS Q:QNUMBER [e.g.194]
        AND BOTH IMMEDIATE PN EXISTS@ [e.g. in left arm]
        AND PRESENT-ELEMENT- IS OCCURRING IN RN
        WHERE COELEMENT- RNOPTS X-RNOPTS EXISTS
        THEN VALUE OF X-RNOPTS IS NOT QUANT.
WCOM10 =
        [* Keep VINGO out of post-SUBJECT SA if it is preceded ]
        [* but not followed by a comma. This VINGO is more likely ]
        [* a new HIU in which case the comma is a comma-conjunction ]
        [* and not a comma-punctuation before an SA = VINGO, as in ]
        [* 'Paroxysmal atrial fibrillation and SVT, increasing doses]
        [* of Diltiazem seemed to have improved this and a recent ]
        [* Digoxin level was normal'. Without WCOM10 we get ]
        [* 'Paroxysmal atrial fibrillation and SVT seemed to have ]
        [* improved this' with SA = 'increasing doses of Diltiazem'.]
        IN SAOPTS AFTER VINGO:
        IF AT IMMEDIATE SA
        PREVIOUS-ELEMENT- IS SUBJECT
        WHERE BOTH DESCEND TO COMMASTG PASSING THROUGH Q-CONJ@
        [in example, pass through Q-CONJ under ANDSTG = 'and SVT ,']
        AND IT IS NOT THE CASE THAT ELEMENT- Q-CONJ EXISTS
        [constraint applies to comma-punct not comma-conj]
        THEN CURRENT WORD IS ','.
— COMPUTED ATTRIBUTE RESTRICTIONS

WCOMP-ATT1 =
        IN NVAR AFTER N:
        BOTH VALUE X1 EXISTS
        AND IF BOTH $PNINRN
        AND X1 HAS ATTRIBUTE H-PTPART OR H-PTAREA [pain in knee]
        THEN $MARK-UNIT.
   $PNINRN =
        ASCEND TO PN; STORE IN X-PN; ASCEND TO RNOPTS;
        HOST- HAS ATTRIBUTE H-INDIC.
   $MARK-UNIT =
        AT X1 ASSIGN NODE ATTRIBUTE NOT-FREE.
WCOMP-ATT2 =
        [* A negation affects the central adverbs of an adverbial phrase:]
        [* 'not particularly distressed'. Needs more sophistication ]
        IN LDR:
        IF BOTH PRESENT-ELEMENT IS NOT EMPTY
        AND ELEMENT- LD IS NOT EMPTY
        WHERE CORE-ATT X-NEG OF CORE- HAS MEMBER H-NEG
        THEN AT CORE-
        ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEG.
— WCOMP-ATT-LN
—       THIS RESTRICTION TESTS WHETHER AN LN CAUSES A COMPUTED ATTRIBUTE
—       FOR THE NVAR DIRECTLY ON ITS RIGHT -- THIS IS, FOR THE LOCAL
—       LN + NVAR CASE ONLY. COMPUTED ATTRIBUTES FOR THE DISTRIBUTED
—       LN (I.E. LN NVAR + NVAR) ARE HANDLED DURING THE CONJUNCTIN
—       CHECK OF WCONJ9 (BY THE CODE IF $SHARE-LN THEN $EXACT-MATCH).
—       THE NOUN IS CHECKED TO SEE IF IT CAN PARTICIPATE IN A COMPUTED
—       ATTRIBUTE CONSTRUCTION; IF IT CAN, THE LN IS SEARCHED FOR
—       A WORD CAUSING A COMPUTED ATTRIBUTE CONSTRUCTION IN THE ORDER
—       NPOS (ONLY CLOSEST N TO THE HEAD N), APOS (ANY VALUE OF ADJADJ
—       SCANNING FROM RIGHT TO LEFT, E.G. 'SEVERE STIFF NECK',
—       'PAINFUL LOWER BACK'), QPOS, AND TPOS.
—       IF A COMPUTED ATTRIBUTE CONSTRUCTION IS FOUND:
—       1. THE HEAD N RECEIVES A NODE ATTRIBUTE 'COMPUTED-ATT',
—       WHOSE VALUE IS THE COMPUTED ATTRIBUTE LIST CREATED BY
—       THE COMPUTATION (STORED IN X-COMP-ATT);
—       2. THE HEAD N RECEIVES A NODE ATTRIBUTE 'N-TO-LN-ATT' WHOSE
—       VALUE IS THE LXR/NNN NODE IN LN WHICH IS INVOLVED IN THE
—       COMPUTED ATTRIBUTE CONSTRUCTION (STORED IN X-LN-POS);
—       3. THE HEAD N RECEIVES A NODE ATTRIBUTE 'SELECT-ATT' TO MARK
—       THE ATTRIBUTE(S) WHICH WERE INVOLVED IN THE COMPUTED
—       ATTRIBUTE CONSTRUCTION (STORED IN X-SELECT-N);
—       4. LIKEWISE THE WORD IN LN INVOLVED IN THE COMPUTED-ATTRIBUTE
—       ALSO RECEIVES ITS NODE ATTRIBUTE 'SELECT-ATT', WHOSE VALUE
—       IS THE LIST OF THOSE ATTRIBUTES WHICH WERE INVOLVED IN THE
—       COMPUTED-ATTRIBUTE CONSTRUCTION (STORED IN X-SELECT-MOD).
— *** NOTE ***
—       THIS RESTRICTION ASSUMES THAT WHERE THERE IS A POTENTIAL COMPUTED
—       ATTRIBUTE, IT SHOULD BE USED; HOWEVER FOR AN ADJECTIVE OR NOUN
—       OF UNKNOWN SUBCLASS (A 'NEW' WORD) WE MAY NOT WISH TO MAKE THIS
—       ASSUMPTION, IN WHICH CASE ADJUSTMENTS MAY HAVE TO MADE. IT
—       MAY BE POSSIBLE TO ADJUST CORE-ATT TO RETURN THE UNION OF CORE-AT
—       AND SELECT-ATT FOR THESE CASES, TO LEAVE ALL POSSIBILITIES OPEN.
— *** NOTE ***
—       THERE IS NO PROVISION AT THE MOMENT FOR A COMPUTED ATTRIBUTE OF
—       A COMPUTED-ATTRIBUTE, BECAUSE THERE APPEARS TO BE NO NEED FOR IT
—       IN THE MEDICAL MATERIAL; HOWEVER OTHER SUBLANGUAGES MAY REQUIRE
—       A MORE GENERAL FORMULATION.
—       *** REGISTER ASSIGNMENTS ***
—       X-NVAR CURRENT NVAR
—       X-LN LN ON SAME LEVEL AS NVAR
—       X-N N OF NVAR
—       X-NEWLIST USED FOR ROUTINE INTERSECT
—       XN-ATT CORE-ATT OF N
—       XN-COMP POSSIBLE ATTRIBUTES OF N LEADING TO COMP ATT
—       X-LN-POS LXR OR NNN IN LN EXAMINED FOR ATTRIBUTES
—       LEADING TO COMPUTED ATTRIBUTE
—       X-ADJ-CORE CORE OF WORD IN LN INVOLVED IN COMPUTED-ATT
—       X-IN-MOD ATTRIBUTE LIST (FROM CORE-ATT) OF LN OR RN
—       WORD (CORE OF X-LN-POS) FOR COMPUTED ATT CONSTRUCT
—       XN-COMP CANDIDATE LIST OF N:LN ATTRIBUTES FOR COMPUTED
—       ATTRIBUTE ASSIGNMENT AVAILABLE FROM ATTRIBUTE LIST
—       OF HEAD N
—       X-SELECT-N LIST OF SELECTIONAL ATTRIBUTES FOR N WHICH CAUSE
—       COMPUTED ATTRIBUTE CONSTRUCTION
—       X-SELECT-MOD
—       LIST OF SELECTIONAL ATTRIBUTES FOR LN WHICH CAUSE
—       COMPUTED ATTRIBUTE CONSTRUCTION
—       X-COMP-ATT LIST OF COMPUTED ATTRIBUTES FOR LN + NVAR
—       ** FOR $GET-ATTRIBUTE **
—       X-NEXT-COM USED TO SCAN LIST XN-COMP
—       X-TEST HEAD OF X-NEXT-COMP = ATTRIBUTE FOR HEAD N
—       X-POSSATTS USED TO SCAN ATTRIBUTE LIST OF X-NEXT-COMP, I.E.,
—       THE LIST OF RESULTANT ATTRIBUTES WITH ITS ATTR. LIST
—       X-RESULTANT
—       USED TO STORE THE RESULTANT COMPUTED ATTRIBUTE
—       X-ATTS ATTRIBUTE LIST FOR LN ASSOCIATED WITH N ATTRIB X-TEST
—       X-NEXT-ATTS
—       USED TO SCAN X-ATTS LIST
—       X-HEAD-ATTS
—       HEAD OF X-NEXT-ATTS = WORD ATTRIBUTE FROM
—       EQUIV-SUBCLASS LIST WHICH CORRESPONDS TO INDIV. LN WD
—       X-ATTL ATTRIBUTE LIST OF WORD ON XN-COMP, FOR THOSE
—       CASES WHERE COMPUTED ATTRIBUTE DIFFERS FROM ATTR OF
—       WORD IN LN OR RN.
WCOMP-ATT-LN =
        IN NVAR, WVVAR:
        AT PRESENT-ELEMENT- X-NVAR
        IF BOTH L LN EXISTS
        @AND PRESENT-ELEMENT- X-LN IS NOT EMPTY
        THEN IF AT CORE- X-N OF X-NVAR DO $GET-NVAR-CORE
        THEN IF $CHECK-LN
        THEN $MARK-ATTS.
   $GET-NVAR-CORE = CORE-ATT EXISTS; STORE [ATTRIBUTE LIST] IN XN-ATT.
   $CHECK-LN =
        AT X-LN
        EITHER BOTH NPOS IS EMPTY [5/15/97]
        [no compatt for 'positive' + 'use' in ]
        ['positive family history, tobacco use']
        AND $APOS-QPOS-TPOS
        OR $NPOS.
   $APOS-QPOS-TPOS = BOTH $COMPUT-ATT [check N-COMP-ATT-LN]
        AND ONE OF $APOS, $QPOS, $TPOS.
   $COMPUT-ATT =
        [* CHECK THAT CURRENT N HAS ATTRIBUTE(S) ON N-COMP-ATT-LN LIST]
        [* SET REG XN-COMP TO POINT TO ATTRIBUTE LIST *]
        AT CORE- X-N OF X-NVAR DO $GET-NVAR-CORE;
        X-NEWLIST: = LIST N-COMP-ATT-LN; [** ljt use better intersect]
        DO $CHECK-LIST.
   $CHECK-LIST = XN-COMP:= INTERSECT OF XN-ATT [SET IN $GET-NVAR-CORE];
        XN-COMP IS NOT NIL [N MUST HAVE ATT ON LIST TO PROCEED *].
   $APOS =
        APOS IS NOT EMPTY;
        GO DOWN;
        STORE IN X-PPP;
        X-COMP-ATT := NIL;
        ITERATE $LAR-PROC
        UNTIL $APOS-DONE FAILS;
        EITHER X-COMP-ATT IS NOT NIL [ done because of a success ]
        OR $ADJADJ-BELOW [ done because of no ADJADJ below try LAR].
   $APOS-DONE =
        X-COMP-ATT IS NIL;
        GO TO X-PPP;
        GO DOWN;
        STORE IN X-PPP;
        PRESENT-ELEMENT- IS ADJADJ.
   $ADJADJ-BELOW =
        GO TO X-PPP;
        EITHER $QN-COMP-ATT
        [12/2/99 for 1% eosophils]
        OR $BACK-TO-LAR.
   $BACK-TO-LAR =
        PRESENT-ELEMENT- IS LAR;
        X-LN-POS := PRESENT-ELEMENT- ;
        BOTH $LAR AND $GET-ATTRIBUTE;
        X-COMP-ATT IS NOT NIL.
   $QN-COMP-ATT =
        PRESENT-ELEMENT- IS QN;
        [12/2/99 for '1% eosophils']
        [mimic $ADJADJ-BELOW + $LAR]
        ELEMENT- N EXISTS
        [= N of QN, attrb is NUNIT to become X-IN-MOD];
        X-LN-POS := PRESENT-ELEMENT-
        [so far from $ADJADJ-BELOW];
        X-LN-POS IS N
        [adapted from $LAR, probably redundant] ;
        BOTH $LIKE-LAR AND $GET-ATTRIBUTE;
        X-COMP-ATT IS NOT NIL.
   $LIKE-LAR =
        CORE-ATT X-IN-MOD OF CORE- X-ADJ-CORE OF X-LN-POS EXISTS
        [from $LAR without LAR specific lines].
   $LAR-PROC =
        EITHER NOT GO RIGHT
        [12/2/99, assuming Not-go-right for $QN-COMP-ATT]
        OR $TRY-LAR;
        TRUE.
   $TRY-LAR =
        GO RIGHT;
        STORE IN X-RTT;
        GO TO X-RTT;
        X-LN-POS := PRESENT-ELEMENT- ;
        IF PRESENT-ELEMENT- IS LAR
        THEN EITHER BOTH $LAR AND $GET-ATTRIBUTE
        OR TRUE.
   $LAR = X-LN-POS IS LAR;
        [EITHER] CORE-ATT X-IN-MOD OF CORE- X-ADJ-CORE OF X-LN-POS EXISTS
        [OR $ADJ-EMPTY-SET].
   $VALUE-LAR = VALUE X-LN-POS OF ELEMENT- ADJADJ IS LAR.
   $RIGHTMOST-LAR = AT ELEMENT- ADJADJ, ELEMENT- ADJADJ EXISTS
        WHERE COELEMENT- LAR EXISTS; STORE IN X-LN-POS.
   $ADJ-EMPTY-SET =
        BOTH EITHER X-ADJ-CORE IS NOT APREQ
        OR X-ADJ-CORE IS SUPERLATIVE
        AND X-ADJ-CORE IS NOT NTH.
   $GET-ATTRIBUTE =
        [* SEARCHES LIST OF HEAD-NOUN SUBCLASS(ES) WHICH CAUSE COMPUTED *]
        [* ATTRIBUTE CONSTRUCTION (STORED IN XN-COMP). *]
        [* THIS LIST HAS AN ASSOCIATED ATTRIBUTE LIST OF ADJUNCT *]
        [* SUBCLASSES; THE INTERSECTION OF THIS LIST WITH THE CORE-ATT *]
        [* LIST FOR THE CURRENT LN WORD IS TAKEN. *]
        [* *]
        [* IF THERE IS A MATCH (IE THE REGISTER STORING THE COMPUTED ATT*]
        [* X-ATTS IS NOT EMPTY) THEN *]
        [* 1. THE SUBCLASS OF N (X-TEST) IS RECORDED IN THE SELECT-ATT*]
        [* (STORED IN X-SELECT-N) *]
        [* 2. THE SUBCLASS(ES) OF THE LN OR RN (X-ATTS) ARE RECORDED *]
        [* ON ITS SELECT-ATT LIST (X-SELECT-MOD) *]
        [* 3. THE RESULT (X-ATTS) IS RECORDED AS A COMPUTED-ATT ON N *]
        [* STORED IN X-COMP-ATT. *]
        DO $INITIALIZE-SEL;
        X-NEXT-COMP:= XN-COMP;
        ITERATE $MATCH-ATT
        UNTIL BOTH X-NEXT-COMP := SUCCESSORS OF X-NEXT-COMP [list]
        AND X-NEXT-COMP IS NIL SUCCEEDS;
        X-SELECT-MOD IS NOT NIL [* FAIL IF THERE IS NO SUITABLE ATT]
        [* AND GO TO NEXT ELEMENT IN LN].
   $INITIALIZE-SEL =
        IF X-ADJ-CORE HAS NODE ATTRIBUTE COMPUTED-ATT
        THEN X-ADJ-COMP-ATT:= NIL;
        X-SELECT-N:= NIL;
        X-COMP-ATT:= NIL;
        X-SELECT-MOD:= NIL.
   $MATCH-ATT =
        X-TEST [attribute of N] := HEAD OF X-NEXT-COMP; [ a symbol]
        [POSSATTS is second level]
        X-POSSATTS := ATTRIBUTE-LIST OF X-NEXT-COMP;
        ITERATE $ADD
        UNTIL BOTH X-POSSATTS := SUCCESSORS OF X-POSSATTS
        AND X-POSSATTS IS NIL
        SUCCEEDS.
   $ADD =
        EITHER X-ATTL := ATTRIBUTE-LIST OF X-POSSATTS
        OR X-ATTL := NIL;
        [ notice that ATTL may be the attrb of TRANSP]
        IF AT X-POSSATTS TEST FOR TRANSP
        THEN $EXP-TRANSP
        ELSE BOTH X-RESADD := HEAD OF X-POSSATTS
        AND $GET-ATTS;
        IF X-ATTS IS NOT NIL
        THEN BOTH IF X-SELECT-N DOES NOT HAVE MEMBER X-TEST
        THEN PREFIX X-TEST TO X-SELECT-N
        AND ITERATE $MARK-LISTS UNTIL $NEXT-ATTS SUCCEEDS.
   $NEXT-ATTS =
        X-ATTS := SUCCESSORS OF X-ATTS;
        X-ATTS IS NIL.
   $EXP-TRANSP =
        [ in the TRANSP case: if the TRANSP in the grammar has no attribs ]
        [ get the ATTS from CORE-ATT of ADJUNCT else the attribs is gotten ]
        [ from the intersection of the attribs in the grammar and the ]
        [ CORE-ATT of the ADJUNCT. ]
        IF X-ATTL IS NIL
        THEN X-ATTS := X-IN-MOD
        ELSE $GET-ATTS.
   $GET-ATTS =
        IF X-ATTL IS NOT NIL
        THEN BOTH X-NEWLIST := X-IN-MOD [CORE-ATT OF ADJUNCT]
        AND X-ATTS := INTERSECT OF X-ATTL
        ELSE X-ATTS := NIL.
   $MARK-LISTS =
        EITHER X-ATTS HAS ATTRIBUTE-LIST X-ADJ-SEL-ATT
        OR TRUE;
        X-HEAD-ATTS := HEAD OF X-ATTS;
        IF X-ADJ-CORE HAS NODE ATTRIBUTE COMPUTED-ATT
        THEN IF X-ADJ-COMP-ATT DOES NOT HAVE MEMBER X-HEAD-ATTS
        THEN BOTH PREFIX X-HEAD-ATTS:X-ADJ-SEL-ATT
        TO X-ADJ-COMP-ATT
        AND BOTH IF X-SELECT-MOD DOES NOT HAVE
        MEMBER X-ADJ-SEL-ATT
        THEN PREFIX X-ADJ-SEL-ATT TO
        X-SELECT-MOD
        ELSE TRUE[PAIR NEXT ELSE WITH HIGHER IF]
        AND $ADD-RES
        ELSE TRUE
        ELSE IF X-SELECT-MOD DOES NOT HAVE MEMBER X-HEAD-ATTS
        THEN BOTH PREFIX X-HEAD-ATTS TO X-SELECT-MOD
        AND $ADD-RES.
   $ADD-RES =
        IF AT X-POSSATTS TEST FOR TRANSP
        THEN X-RESADD := X-HEAD-ATTS ; [TRANSP case use third level]
        IF X-COMP-ATT DOES NOT HAVE MEMBER X-RESADD
        THEN PREFIX X-RESADD:X-TEST TO X-COMP-ATT
        [ADD AS ATTRIBUTE LIST THE CLASS OF THE HEAD NOUN ]
        [CAUSING THE COMPUTED ATTRIBUTE ].
   $QPOS = QPOS IS NOT EMPTY;
        AT VALUE X-LN-POS DESCEND TO Q
        [DOESNT ACCOUNT FOR Q-OF CONSTRUCTION];
        CORE-ATT X-IN-MOD OF PRESENT-ELEMENT- X-ADJ-CORE EXISTS
        [TO GET QNUMBER OR H-AMT];
        DO $GET-ATTRIBUTE.
   $TPOS =
        TPOS IS NOT EMPTY;
        VALUE X-LN-POS EXISTS;
        AT CORE- X-ADJ-CORE DO $CHECK-NEG;
        DO $GET-ATTRIBUTE.
   $CHECK-NEG =
        X-NEGLIST := LIST NEG-LIST;
        X-ADJ-CORE HAS ATTRIBUTE X-NEGLIST;
        X-IN-MOD := X-NEGLIST.
   $NPOS =
        [* ONLY CHECK RIGHT-MOST (CORE) IN COMPND NOUN FORMATION *]
        [* USE LIST N-COMP-ATT-NPOS *]
        NPOS IS NOT EMPTY;
        VERIFY NOT DO R(COMMASTG);
        VALUE X-LN-POS IS NNN;
        CORE-ATT X-IN-MOD OF CORE- X-ADJ-CORE EXISTS;
        X-NEWLIST:= LIST N-COMP-ATT-NPOS;
        [* NOTE THAT IF THERE IS AN NPOS W/O A COMPATT, REST OF LN *]
        [* WILL HAVE N-COMP-ATT-NPOS AS X-NEWLIST unless reset *]
        EITHER $NPOS-COMP-ATT
        [* If non-empty NPOS does not form a computed-attribute *]
        [* then try at APOS or QPOS or TPOS. *]
        [* In 'normal (APOS) upper_respiratory_tract (NPOS) flora' *]
        [* we want 'normal flora' to generate computed-att H-RESULT *]
        OR AT X-LN DO $APOS-QPOS-TPOS.
   $NPOS-COMP-ATT =
        DO $CHECK-LIST;
        DO $GET-ATTRIBUTE.
   $LQNR =
        X-LN-POS IS LQR;
        CORE-ATT X-IN-MOD OF ELEMENT- N X-ADJ-CORE OF CORE- [QN]
        EXISTS [GETS NUNIT].
   $MARK-ATTS =
        AT X-N ASSIGN PRESENT ELEMENT NODE ATTRIBUTE COMPUTED-ATT
        WITH VALUE X-COMP-ATT;
        AT X-N ASSIGN PRESENT ELEMENT NODE ATTRIBUTE N-TO-LN-ATT
        WITH VALUE X-LN-POS;
        AT X-N, DO $ASSIGN-SELECT-ATT;
        AT X-ADJ-CORE
        BOTH ASSIGN PRESENT ELEMENT NODE ATTRIBUTE SELECT-ATT
        WITH VALUE X-SELECT-MOD
        AND IF PRESENT-ELEMENT- HAS NODE ATTRIBUTE COMPUTED-ATT
        THEN ASSIGN PRESENT ELEMENT NODE ATTRIBUTE COMPUTED-ATT
        WITH VALUE X-ADJ-COMP-ATT;
        AT X-ADJ-CORE ASSIGN NODE ATTRIBUTE LN-TO-N-ATT WITH VALUE X-N.
   $ASSIGN-SELECT-ATT =
        X-SELECT-N := NIL;
        X-TMP := X-COMP-ATT;
        ITERATE $COMP-MEMBERS UNTIL SUCCESSORS X-TMP OF X-TMP IS NIL
        SUCCEEDS.
   $COMP-MEMBERS =
        X-B := ATTRIBUTE-LIST OF X-TMP;
        PREFIX X-B TO X-SELECT-N;
        AT X-N ASSIGN NODE ATTRIBUTE SELECT-ATT
        WITH VALUE X-SELECT-N.
— WCOMP-ATT-RN
—       THIS RESTRICTION TESTS WHETHER A FILLED RN CAUSES A COMPUTED
—       ATTRIBUTE ON THE DIRECTLY PRECEDING NVAR [FOUND BY $LAST-N].
—       IF THE N CAN TAKE A COMPUTED ATTRIBUTE (BECAUSE IT HAS ONE
—       OR MORE ATTRIBS. ON THE LIST N-COMP-ATT-RN), THEN IF THE
—       RIGHT ADJUNCT HAS A CONSTRUCTION WHOSE HEAD ALSO HAS AN ATTRIB.
—       CAUSING A COMPUTED ATTRIBUTE ($CHECK-RN), THEN $MARK-ATTS:
—       1. N IS ASSIGNED A NODE ATTRIBUTE 'SELECT-ATT' WHOSE VALUE
—       IS THE LIST OF ATTRIBUTES CAUSING THE RN COMPUTED-ATT
—       2. SIMILARLY THE HEAD OF THE CONSTRUCTION IN RN (GENERALLY
—       LNR IN PN) IS ALSO ASSIGNED 'SELECT-ATT' WITH VALUE =
—       LIST OF ATTRIBUTES INVOLVED IN THE RN COMPUTED-ATT;
—       3. N IS ASIGNED A NODE ATTRIBUTE 'COMPUTED-ATT' WITH VALUE =
—       LIST OF COMPUTED ATTRIBUTES FROM N + RN INTERACTION;
—       4. N IS ASSIGNED A NODE ATTRIBUTE 'N-TO-RN-ATT', TO MARK
—       THE OCCURRENCE OF THE RN COMPUTED ATTRIBUTE CONSTRUCTION;
—       THE VALUE OF THIS NODE ATTRIBUTE IS THE LXR NODE IN THE
—       RN WHICH IS INVOLVED IN THE COMPUTED ATT. CONSTRUCTION;
—       5. IF N HAS A NODE ATTRIBUTE 'DEFERRED' (FROM WCONJ9, FOR
—       THE CONJOINED CASE), ERASE IT;
—       6. IF N HAS A COMPUTED-ATT FROM LN AND A COMPUTED-ATT FROM
—       RN THEN WE HAVE A COMPUTED-ATT CONFLICT:
—       A. NON-LOCAL CASE
—       IF THE LN IS NOT LOCAL [I.E. IT IS SHARED WITHIN A
—       CONJUNCTION], THEN THE RN COMPUTED ATTRIBUTE TAKES
—       PRECEDENCE, AND THE LN COMPUTED ATT MARKER
—       'N-TO-LN-ATT IS ERASED AND THE CONJOINING WILL BE
—       RECOMPUTED ON THE BASIS OF THE RN COMPUTED ATT IN
—       WCONJ9;
—       *** PROBLEM: IN DISREGARDING THE NON-LOCAL LN COMP ATT,
—       WE MUST ALSO NOT USE 'SELECT-ATT', WHICH HOWEVER
—       MAY HAVE RESULTED FROM OTHER RESTRICTIONS, IN
—       ADDITION TO THE LN COMPUTED ATT; THIS INFORMATION
—       WILL BE LOST, AND 'SELECT-ATT' REPLACED ONLY BY
—       INFORMATION FROM THE RN COMPUTED ATT CALC.
—       B. LOCAL LN
—       IN CONSTRUCTION LN NVAR RN WHERE A LOCAL LN CAUSED A
—       COMPUTED ATT, THIS RESTRICTION IGNORES LN COMPUTED
—       ATT AND ACTS ON RN-N COMPUTED ATTRIBUTE. RN ALWAYS
—       TAKES PRECEDENCE.

—       *** REGISTER ASSIGNMENT ***

—       X-RN CURRENT RN
—       X-N CURRENT N OF LAST NVAR DIRECTLY PRECEDING RN
—       X-NVAR NVAR ABOVE CURRENT N
—       X-RN-POS ANALOGOUS TO X-LN-POS IN WCOMP-ATT-LN:
—       LXR NODE IN PN OF RN CAUSING THE COMPUTED ATTRIBUTE
—       X-COMP-ATT COMPUTED ATTRIBUTE LIST, SET IN $GET-ATTRIBUTE-R
—       [COPIED FROM WCOMP-ATT-LN AND SUFFIXED -R]
—       X-ADJ-CORE CORE OF LXR N RN CAUSING COMPUTED ATT
—       X-IN-MOD CORE-ATT LIST OF X-ADJ-CORE
—       XN-COMP INTERSECT OF HEAD NOUN'S ATTRIBUTES WITH
—       LIST OF WORDS TAKING RN COMPUTED ATT
—       (LIST N-COMP-ATT-RN)
—       X-NEWLIST USED IN INTERSECT; HERE LIST N-COMP-ATT-RN.

WCOMP-ATT-RN =
IN RN:
        IF PRESENT-ELEMENT- IS NOT EMPTY
        THEN IF HOST- X-N IS N OR VING [OR QN]
        WHERE IMMEDIATE NVAR X-NVAR EXISTS
        THEN AT X-NVAR IF NOT $RN-EMPTY
        THEN $DO-COMP-ATT IS TRUE.
   $RN-EMPTY = DO R(RN); PRESENT-ELEMENT- X-RN IS EMPTY.
   $DO-COMP-ATT =
        VERIFY X-RN-POS:= NIL;
        AT VALUE X-RN OF X-RN [go to RNOPTS; store in X-RN]
        IF $COMPUT-ATT [N CAN TAKE COMPUT-ATT]
        THEN IF AT X-RN ONE OF $COMP-PN,
   $COMP-PQUANT,
   $COMP-PVINGO,
   $COMP-QUANT,
   $COMP-VINGO,
   $COMP-OTHERS [VENPASS, ADJINRN]
        THEN $MARK-ATTS.
   $COMPUT-ATT =
        [N HAS ATTRIBUTES ON LIST N-COMP-ATT-RN,SAVED IN XN-COMP]
        DO $ASSIGN-XNATT [get attributes for match, put in XNATT];
        X-NEWLIST := LIST N-COMP-ATT-RN;
        XN-COMP := INTERSECT OF XN-ATT;
        XN-COMP IS NOT NIL [no XNATT on N-COMP-ATT-RN > no COMPUTED ATT]
        [* 8/19/94 remove: X-SUBLIST := XN-COMP needed only for COMPLEMENT]
        [* 4/25/89 remove: EITHER COMPLEMENT X-ADD OF XN-ATT IS NOT NIL]
        [* OR X-ADD:= NIL. see comment in $MARK-ATTS].
   $ASSIGN-XNATT =
        IF AT X-NVAR
        BOTH COELEMENT- LN X-LN IS EMPTY [no local LN]
        AND X-N HAS NODE ATTRIBUTE N-TO-LN-ATT [broken arm and leg]
        [* ignore SELECT-ATT and COMPUTED-ATT lists due to LN-COMP-ATT]
        [* in attempting to construct RN COMPUTED-ATT]
        THEN $GET-MED-ATT
        ELSE CORE-SELATT XN-ATT OF X-N EXISTS.
   $GET-MED-ATT =
        [* over-rule LN COMPUTED-ATT by possible RN COMPUTED-ATT; ns ?!]
        X-N HAS ATTRIBUTE-LIST XN-ATT;
        X-NEWLIST:= LIST SUBLANGUAGE-ATTS;
        XN-ATT:= INTERSECT OF XN-ATT.
   $COMP-PN =
        VALUE IS PN;
        ELEMENT- P X-P EXISTS;
        X-P IS NOT 'WITHOUT'; [28mar94]
        X-P IS NOT 'FREE OF'; [30aug94]
        X-P IS NOT 'FOR' [work-up at some POINT FOR IRON DEFICIENCY ANEMIA];
        X-P IS NOT 'TO'; [altered sensation in her ARMS TO PAIN]
        X-P IS NOT 'SINCE';
        [in the four year interval since her last cardiac catheterization]
        IF X-P IS 'WITH'
        THEN AT IMMEDIATE PN
        IT IS NOT THE CASE THAT HOST- HAS ATTRIBUTE NOT-FREE;
        [dullness on the right side NOT-FREE with crackles]
        BOTH X-P IS NOT H-CONN [*GRI*]
        AND AT COELEMENT- NSTGO DESCEND TO LNR OR LQR
        WHERE STORE IN X-RN-POS;
        DO $GET-ATTRIBUTE-R [copied from WCOMP-ATT-LN and suffixed -R].
   $COMP-PQUANT =
        VALUE IS PQUANT;
        ELEMENT- QUANT EXISTS;
        AT VALUE ELEMENT- LQR [of QPERUNIT/QN] X-RN-POS EXISTS;
        CORE-ATT X-IN-MOD OF CORE- X-ADJ-CORE EXISTS;
        DO $GET-ATTRIBUTE-R [copied from WCOMP-ATT-LN and suffixed -R].
   $COMP-PVINGO =
        VALUE IS PVINGO;
        ELEMENT- P X-P EXISTS;
        X-P IS 'OF' [990907 history of increasing dyspnoea];
        AT COELEMENT- VINGO OF X-P DESCEND TO OBJECT;
        BOTH DESCEND TO LNR PASSING THROUGH PN
        WHERE STORE IN X-RN-POS
        AND BOTH CORE-ATT X-IN-MOD OF CORE- X-ADJ-CORE OF X-RN-POS EXISTS
        AND DO $GET-ATTRIBUTE-R.
   $COMP-QUANT =
        VALUE IS QUANT;
        AT VALUE ELEMENT- LQR [of QPERUNIT/QN] X-RN-POS EXISTS;
        CORE-ATT X-IN-MOD OF CORE- X-ADJ-CORE EXISTS;
        DO $GET-ATTRIBUTE-R [copied from WCOMP-ATT-LN and suffixed -R].
   $COMP-VINGO =
        VALUE IS VINGO;
        ELEMENT- LVINGR X-RN-POS EXISTS;
        [EITHER] CORE-ATT X-IN-MOD OF CORE- X-ADJ-CORE EXISTS
        [OR $ADJ-EMPTY-SET-R] [copied from WCOMP-ATT-LN and suffixed -R];
        IF X-IN-MOD HAS MEMBER H-NULL
        OR VBE [rhythm being slow in the 70s]
        OR H-BECONN
        [She has ceased wearing makeup and products containing nickel.]
        ['makeup' H-CHEM, 'nickel' H-CHEM]
        [We want 'products containing nickel' to have COMP-ATT= H-CHEM]
        [for conjoining. Then can get 'She has ceased wearing products]
        [containing nickel']
        THEN AT X-RN-POS [LVINGR]
        IF COELEMENT- OBJECT HAS VALUE NSTGO
        OR OBJECTBE [rhythm being slow]
        @THEN DESCEND TO LNR [OR LQR]
        OR LAR [rhythm being slow]
        WHERE STORE IN X-RN-POS;
        DO $GET-ATTRIBUTE-R [copied from WCOMP-ATT-LN and suffixed -R].
   $ADJ-EMPTY-SET-R =
        BOTH EITHER X-ADJ-CORE IS NOT APREQ
        OR X-ADJ-CORE IS SUPERLATIVE
        AND X-ADJ-CORE IS NOT NTH.
   $COMP-OTHERS =
        VALUE IS VENPASS OR ADJINRN;
        VALUE X-RN-POS EXISTS [LVENR OR LAR OR LNR];
        EITHER CORE-ATT X-IN-MOD OF CORE- X-ADJ-CORE EXISTS
        OR $ADJ-EMPTY-SET-R;
        DO $GET-ATTRIBUTE-R [copied from WCOMP-ATT-LN and suffixed -R].
   $GET-ATTRIBUTE-R =
        DO $INITIALIZE-SEL;
        X-NEXT-COMP:= XN-COMP;
        ITERATE $MATCH-ATT
        UNTIL BOTH X-NEXT-COMP := SUCCESSORS OF X-NEXT-COMP [list]
        AND X-NEXT-COMP IS NIL SUCCEEDS;
        X-SELECT-MOD IS NOT NIL [* FAIL IF THERE IS NO SUITABLE ATT]
        [* AND GO TO NEXT ELEMENT IN LN].
   $INITIALIZE-SEL =
        X-ADJ-COMP-ATT:= NIL;
        X-SELECT-N:= NIL;
        X-COMP-ATT:= NIL;
        X-SELECT-MOD:= NIL.
   $MATCH-ATT =
        X-TEST [attribute of N] := HEAD OF X-NEXT-COMP; [ a symbol]
        [POSSATTS is second level]
        X-POSSATTS := ATTRIBUTE-LIST OF X-NEXT-COMP;
        ITERATE $ADD
        UNTIL BOTH X-POSSATTS := SUCCESSORS OF X-POSSATTS
        AND X-POSSATTS IS NIL
        SUCCEEDS.
   $ADD =
        EITHER X-ATTL := ATTRIBUTE-LIST OF X-POSSATTS
        OR X-ATTL := NIL;
        [ notice that ATTL may be the attrb of TRANSP]
        IF AT X-POSSATTS TEST FOR TRANSP
        THEN $EXP-TRANSP
        ELSE BOTH X-RESADD := HEAD OF X-POSSATTS
        AND $GET-ATTS;
        IF X-ATTS IS NOT NIL
        THEN BOTH IF X-SELECT-N DOES NOT HAVE MEMBER X-TEST
        THEN PREFIX X-TEST TO X-SELECT-N
        AND ITERATE $MARK-LISTS UNTIL $NEXT-ATTS SUCCEEDS.
   $NEXT-ATTS =
        X-ATTS := SUCCESSORS OF X-ATTS;
        X-ATTS IS NIL.
   $EXP-TRANSP =
        [ in the TRANSP case: if the TRANSP in the grammar has no attribs ]
        [ get the ATTS from CORE-ATT of ADJUNCT else the attribs is gotten ]
        [ from the intersection of the attribs in the grammar and the ]
        [ CORE-ATT of the ADJUNCT]
        IF X-ATTL IS NIL
        THEN X-ATTS := X-IN-MOD
        ELSE $GET-ATTS.
   $GET-ATTS =
        IF X-ATTL IS NOT NIL
        THEN BOTH X-NEWLIST := X-IN-MOD [CORE-ATT OF ADJUNCT]
        AND X-ATTS := INTERSECT OF X-ATTL
        ELSE X-ATTS := NIL.
   $MARK-LISTS =
        EITHER X-ATTS HAS ATTRIBUTE-LIST X-ADJ-SEL-ATT
        OR X-ADJ-SEL-ATT := NIL;
        X-HEAD-ATTS := HEAD OF X-ATTS;
        IF X-ADJ-CORE HAS NODE ATTRIBUTE COMPUTED-ATT
        THEN IF X-ADJ-COMP-ATT DOES NOT HAVE MEMBER X-HEAD-ATTS
        THEN BOTH PREFIX X-HEAD-ATTS:X-ADJ-SEL-ATT
        TO X-ADJ-COMP-ATT
        AND BOTH IF X-SELECT-MOD DOES NOT HAVE
        MEMBER X-ADJ-SEL-ATT
        THEN PREFIX X-ADJ-SEL-ATT TO
        X-SELECT-MOD
        ELSE TRUE[PAIR NEXT ELSE WITH HIGHER IF]
        AND $ADD-RES
        ELSE TRUE
        ELSE IF X-SELECT-MOD DOES NOT HAVE MEMBER X-HEAD-ATTS
        THEN BOTH PREFIX X-HEAD-ATTS TO X-SELECT-MOD
        AND $ADD-RES.
   $ADD-RES =
        IF AT X-POSSATTS TEST FOR TRANSP
        THEN X-RESADD := X-HEAD-ATTS ; [TRANSP case use third level]
        IF X-COMP-ATT DOES NOT HAVE MEMBER X-RESADD
        THEN PREFIX X-RESADD:X-TEST TO X-COMP-ATT
        [ADD AS ATTRIBUTE LIST THE CLASS OF THE HEAD NOUN ]
        [CAUSING THE COMPUTED ATTRIBUTE ].
   $MARK-ATTS =
        IF X-N HAS NODE ATTRIBUTE N-TO-LN-ATT
        THEN
        IF X-COMP-ATT HAS MEMBER H-RESULT
        WHERE BOTH ATTRIBUTE-LIST HAS MEMBER QNUMBER
        AND NEITHER $PNTEST
        NOR $PREV-COMP-ATT-COMMA
        THEN BOTH $RN-ASSIGN
        AND $ERASE-N-TO-LN-ATT
        ELSE IF $COMPATT-VALUES
        THEN TRUE [exit + without assigning RN compatt]
        ELSE BOTH $RN-ASSIGN
        AND $ERASE-N-TO-LN-ATT
        ELSE $RN-ASSIGN.
   $PNTEST =
        [* exception for time PN with QNUMBER]
        [* 'xrays in 2 weeks' =/ time exp]
        BOTH RIGHT-ADJUNCT OF X-N IS PN@
        AND CORE OF NSTGO IS NTIME1 OR NTIME2 OR H-TMLOC.
[* If compatts can be built from both LN and RN then before]
[* assigning the RN compatt, check if there is N-TO-LN-ATT;]
[* then if RN compatt is from QNUMBER in RN, assign it, ]
[* e.g. H-RESULT for 'respiration rate of 16'. ]
[* Thus, in 'irregular heartbeat, respiration rate of 16' ]
[* LN compatt due to 'irregular' will not be taken in ]
[* preference to RN compatt for 'respiration rate of 16'. ]
[* But 'dilantin levels in 2 weeks' will not taken as time;]
[* no assign if RN=PN whose N= NTIME1 or NTIME2 or H-TMLOC.]
[* If LN compatt is named in $COMPATT-VALUES, then no ]
[* RN compatt. In other cases of LN-RN compatt conflict, ]
[* assign RN compatt (overwrites LN compatt) and ]
[* erase node attribute N-TO-LN-ATT. ]
   $PREV-COMP-ATT-COMMA = BOTH $COMPATT-VALUES AND $COMMA
        [* '2+ femorals , 2+ popliteals'. No RN compatt on 'femorals'].
   $COMMA = WORD PRECEDING PRESENT NODE IS ','.
   $COMPATT-VALUES =
        X-N HAS NODE ATTRIBUTE COMPUTED-ATT X-LN-ATT
        WHERE X-LN-ATT HAS MEMBER H-INDIC OR H-DIAG OR H-RESULT
        OR H-TTMED OR H-TXPROC ['MRI study' 5/16/96].
   $RN-ASSIGN =
        AT X-N ASSIGN NODE ATTRIBUTE COMPUTED-ATT WITH VALUE X-COMP-ATT;
        AT X-N ASSIGN NODE ATTRIBUTE N-TO-RN-ATT WITH VALUE X-RN-POS;
        AT X-N, DO $ASSIGN-SELECT-ATT-R [copied from WCOMP-ATT-LN; now -R];
        AT X-ADJ-CORE
        BOTH ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-SELECT-MOD
        AND IF PRESENT-ELEMENT- HAS NODE ATTRIBUTE COMPUTED-ATT
        THEN ASSIGN NODE ATTRIBUTE COMPUTED-ATT WITH VALUE
        X-ADJ-COMP-ATT
        [* new attribute RN-TO-N-ATT 2000/06/15 *];
        AT X-ADJ-CORE ASSIGN NODE ATTRIBUTE RN-TO-N-ATT WITH VALUE X-N.
   $ERASE-N-TO-LN-ATT = AT X-N ERASE NODE ATTRIBUTE N-TO-LN-ATT.
   $ASSIGN-SELECT-ATT-R =
        IF EITHER PRESENT-ELEMENT- DOES NOT HAVE NODE ATTRIBUTE SELECT-ATT
        OR BOTH PRESENT-ELEMENT- HAS NODE ATTRIBUTE SELECT-ATT X-NA-SEL
        AND X-NA-SEL DOES NOT HAVE MEMBER X-SELECT-N
        THEN ASSIGN PRESENT ELEMENT NODE ATTRIBUTE SELECT-ATT WITH VALUE
        X-SELECT-N.
WCOMP-ATT-RN-Q =
        [* assigns COMPUTED-ATT of H-RESULT to N=H-TXVAR ]
        [* (e.g. 'amylase') with RN= <QUANT> (e.g. 'amylase 77') ]
        IN RNOPTS AFTER QUANT: IF HOST X1 IS H-TXVAR
        THEN $ASSIGN-H-RESULT.
$ASSIGN-H-RESULT =
        X1 HAS NODE ATTRIBUTE SELECT-ATT X-SELATT;
        X-SEL := HEAD OF X-SELATT;
        X-RESULT := SYMBOL H-RESULT;
        X-NEWL := NIL;
        PREFIX X-RESULT:X-SEL TO X-NEWL;
        AT X1, ASSIGN NODE ATTRIBUTE COMPUTED-ATT WITH VALUE X-NEWL.
WCOMP-ATT-RN-PQ =
        [* assigns COMPUTED-ATT of H-RESULT to N=H-TXVAR ]
        [* (e.g. 'amylase') with RN= PQUANT (e.g. 'a2 77') ]
        IN RNOPTS AFTER PQUANT: IF HOST X1 IS H-TXVAR
        THEN $ASSIGN-H-RESULT.
$ASSIGN-H-RESULT =
        X1 HAS NODE ATTRIBUTE SELECT-ATT X-SELATT;
        X-SEL := HEAD OF X-SELATT;
        X-RESULT := SYMBOL H-RESULT;
        X-NEWL := NIL;
        PREFIX X-RESULT:X-SEL TO X-NEWL;
        AT X1, ASSIGN NODE ATTRIBUTE COMPUTED-ATT WITH VALUE X-NEWL.
— WCOMP-ATT-RN-PERUNIT =
—       [* ASSIGNS COMPUTED-ATT OF H-RESULT TO N=H-TXVAR ]
—       [* (E.G. 'GLOBULES BLANCS') WITH RN= ('/ CHAMP')]
—       IN RNOPTS AFTER PERUNIT: IF HOST X1 IS H-TXVAR
—       THEN $ASSIGN-H-RESULT.
— $ASSIGN-H-RESULT =
—       X1 HAS NODE ATTRIBUTE SELECT-ATT X-SELATT;
—       X-SEL := HEAD OF X-SELATT;
—       X-RESULT := SYMBOL H-RESULT;
—       X-NEWL := NIL;
—       PREFIX X-RESULT:X-SEL TO X-NEWL;
—       AT X1, ASSIGN NODE ATTRIBUTE COMPUTED-ATT WITH VALUE X-NEWL.

— CONJUNCTION RESTRICTIONS

DCONJ0 =
        [* To avoid loop, this must be first DCONJ housed in Q-CONJ. ]
        [* Generate definition for Q-CONJ.]
        [* X1 first node to be copied in generation option]
        [* X2 last node to be copied in generation option ]
        [* Generates full LXR and STRING; also RX conj RX; ]
        [* also SA conj SA for first and last SA of string;]
        [* also single element option for CENTER and OBJECT]
        [* (for OBJECTBE). ]
        IN Q-CONJ RE OPTION 1:
        ALL OF $GET-RIGHT-MOST,
   $GEN-FIRST-OPTION,
   $GEN-FULL-STRING.
   $GET-RIGHT-MOST =
        ASCEND TO CONJ-NODE;
        ITERATE GO LEFT UNTIL TEST FOR CONJ-NODE FAILS;
        EITHER ITERATE DO CONJELEM- [up to highest corresponding element]
        OR TRUE;
        STORE IN X2;
        X2 IS NOT NVAR.
   $GEN-FIRST-OPTION =
        AT X2 IF BOTH PRESENT-ELEMENT- HAS NODE ATTRIBUTE LAST-NODE
        [assigned in DCONJ5]
        AND PRESENT-ELEMENT- IS NOT EMPTY
        THEN $GEN-ONE-NODE.
   $GEN-ONE-NODE =
        AT X2 BOTH STORE IN X1
        AND ERASE NODE ATTRIBUTE LAST-NODE;
        DO $GENERATE.
   $GENERATE =
        GENERATE OPTION SPANNING X1 TO X2.
   $GEN-FULL-STRING =
        AT X2 IF ONE OF $FIRST-SA, $OBJECT, $CENTER, $ADJADJ
        THEN STORE IN X1
        ELSE BOTH ITERATE GO LEFT @AND STORE IN X1;
        DO $GENERATE.
   $FIRST-SA =
        BOTH X2 IS SA
        AND X2 IS STRING INITIAL.
   $OBJECT =
        BOTH IT IS NOT THE CASE THAT A PARSE HAS BEEN OBTAINED
        AND EITHER X2 IS OBJECT WHERE VALUE IS OBJECTBE,
        OR X2 IS OBJBE WHERE IMMEDIATE-NODE IS NOT OBJECTBE
        [ ALLOW OBJ CONJ OBJ FOR OBJECTBE OR BESHOW ].
   $CENTER = X2 IS CENTER.
   $ADJADJ = X2 IS ADJADJ.
DCONJ1 =
        [* Cannot conjoin if all preceding elements on level of CONJSTG]
        [* are empty.]
        IN CONJ-NODE:
        IMMEDIATE-NODE- X-ABOVE IS NOT EMPTY.
DCONJ2 =
        [* Do not attach conjunction to the right of another conjunction]
        IN CONJ-NODE:
        IF $NEXT-TO-CONJ THEN X1 IS COMMASTG WHERE IT IS NOT THE CASE
        THAT ELEMENT- Q-CONJ EXISTS.
   $NEXT-TO-CONJ =
        GO LEFT; TEST FOR CONJ-NODE; STORE IN X1.
DCONJ3 =
        [* Display the name of the source node for generated conj string]
        IN Q-CONJ:
        IMMEDIATE-NODE X-SOURCE OF IMMEDIATE-NODE- EXISTS.
DCONJ4 =
        [* No conjoining within APPOS]
        IN Q-CONJ:
        IT IS NOT THE CASE THAT AT PRESENT-ELEMENT-
        IMMEDIATE LNR EXISTS
        WHERE IMMEDIATE-NODE IS APPOS.
DCONJ5 =
[* Attach special process only in LXR or permitted nodes]
[* For LXR's allow LXR CONJ LXR; RX CONJ RX (where RX not empty). RX ]
[* is handled by assigning NA = LAST-NODE to RX in DCONJ5$TYPE-LXR ]
[* and using it in DCONJ0$GEN-FIRST-NODE. For full strings also allow]
[* SA CONJ SA for initial and last SA where upper SA is not empty. ]
[* For the initial SA see DCONJ5$INITSA. The same process as for RX ]
[* is used for last SA (assigning NA = LAST-NODE in DCONJ5$COMPLETE) ]
[* Comma is allowed before certain RN strings, as punctuation. ]
[* Comma is allowed before certain RDATE strings, as punctuation. ]
[* Comma is allowed after TENSE before D as presumed start of an SA ]
[* X1 is a parent node of the CONJ-NODE ]
[* X2 is a previous node next to the CONJ-NODE]
        IN CONJ-NODE RE OPTION 1:
        ONE OF $TYPE-LXR, $PERMITTED-NODE.
   $TYPE-LXR =
        BOTH IMMEDIATE-NODE X1 IS OF TYPE LXR
        AND BOTH PREVIOUS-ELEMENT- X2 IS OF TYPE RADJSET
        AND AT X2 ASSIGN NODE ATTRIBUTE LAST-NODE.
   $PERMITTED-NODE =
        BOTH PREVIOUS-ELEMENT- X2 EXISTS
        AND ONE OF $POSTCONJ-COMMA, $POSTTENSE-COMMA,
   $TOVO, $VINGO, $LN, $VEN, $VO, $PN, $QN, $NSTGT, $BESHOW,
   $PDATE, $ASSERT, $THATS, $FRAGMENT, $ONESENT, $TVO,
   $ADJADJ, $C1SHOULD, $SPWORD, $QCONJ, $PRE-RWV-COMMA,
   $PRE-RDATE-COMMA,
   $PRE-RN-COMMA, $PRE-MORE-QN-COMMA, $TIME-ADJ, $OBJBE.
   $POSTCONJ-COMMA = PRESENT-ELEMENT- IS COMMASTG;
        WORD PRECEDING PRESENT NODE IS 'AND' OR 'OR'
        OR 'BUT'.
   $POSTTENSE-COMMA =
        PRESENT-ELEMENT- IS COMMASTG;
        X2 IS RW;
        X1 IS TENSE;
        X1 IS NOT EMPTY;
        NEXT WORD X-NEXT [for testing] IS D
        [She did , however , experience an increase in blood pressure].
   $PRE-RWV-COMMA = ALL OF $COMMASTG, $WVVAR.
   $COMMASTG = PRESENT-ELEMENT- IS COMMASTG.
   $WVVAR = X2 IS WVVAR [for pre-RWV comma]
        [3 - 5 mm ST elevations , 1 , L , V2-V6];
        CURRENT WORD IS N: E-LEAD.
   $PRE-RDATE-COMMA = ALL OF $COMMASTG, $DATE.
   $DATE = X2 IS DATEVAR [for pre-RDATE comma];
        EITHER NEXT WORD IS 'WHEN'
        OR $NEXT-WORD1
        [PT was seen in 04/00/2001 , at which time he was afebrile].
   $PRE-RN-COMMA = ALL OF $COMMASTG, $NVAR, $NEXT.
   $NVAR = X2 IS NVAR [for pre-RN comma] OR RNOPTS
        [for second pre-RN comma].
   $NEXT = ONE OF $NEXT-WORD, $NEXT-WORD1, $NEXT-WORD2.
   $NEXT-WORD =
        EITHER NEXT WORD IS 'WHO' OR 'WHICH' OR 'WITH' OR 'PRESENTING' OR
        'WHEN' OR 'COMPLAINING' OR 'LASTING' OR 'RADIATING' OR 'FEARING'
        [The patient , fearing complications , refused treatment] OR
        'ASSOCIATED'_'WITH' OR
        [She has chest pressure , associated with shortness of breath]
        'EACH' OR 'ALL' OR 'UNCHANGED' [scarring , unchanged] OR
        'RESOLVED' [with right-sided hemiparesis , resolved] OR
        'SHE' OR 'HE' [status post five-vessel bypass , she says (S-N)]
        OR EITHER BOTH CORE OF X2 IS H-TTMED
        AND NEXT WORD IS DS ['dilantin , 500 mg at bedtime']
        OR CORE OF X2 IS H-INST [OR H-DEVMED] OR H-PT
        [for RNOPTS=APPOS; OK H-INST or H-PT; Not OK H-DEVMED]
        [ For APPOS permission, see also DPOS36,WPOS102]
        ['Dr YYY102, her family physician']
        ['Pacemaker, VVI, for sinus bradycardia'; 'VVI' now ADJ:AINRN]
        ['The patient , MR XXX , has CAD].
   $NEXT-WORD1 =
        BOTH $AT-WHICH AND $TIME-HOST [for WHEN-PHRASE in WHENS]
        [This continued until yesterday, at which time she was started on..].
   $AT-WHICH = GO TO CURRENT WORD;
        GO TO NEXT WORD; STORE IN X-AT;
        GO TO NEXT WORD; STORE IN X-WHICH;
        X-AT IS 'AT' OR 'FOR' OR 'DURING';
        X-WHICH IS 'WHICH'.
   $TIME-HOST = EITHER EITHER CORE- X-CORE OF X2 IS NTIME1 OR NTIME2 [yesterday]
        OR X-CORE IS DT [date]
        OR BOTH X-CORE HAS NODE ATTRIBUTE PHRASE-ATT X-PH-ATT
        AND X-PH-ATT HAS MEMBER TIME-PHRASE
        [until hospital day number three , at which time ...].
   $NEXT-WORD2 =
        EITHER BOTH NEXT WORD IS Q ['equally reactive pupils , 4 to 2']
        AND IF X2 IS NVAR [not RNOPTS]
        THEN NEITHER COELEMENT- LN SUBSUMES Q:QNUMBER
        NOR EITHER BOTH X2 IS OCCURRING IN PN ['in the circ']
        @AND IN LEFT-ADJUNCT OF HOST- X-HOST
        PRESENT-ELEMENT- [LN] SUBSUMES Q:QNUMBER
        [In '50% lesions in the circ, 60% lesions in the RAD']
        [don't accept '60%' as RN of 'circ']
        [or of first 'lesions']
        OR BOTH X-HOST IS H-PTFUNC [blood pressure]
        AND AT IMMEDIATE NVAR OF X-HOST
        VALUE OF ELEMENT- RNOPTS OF COELEMENT- RN
        IS QUANT
        [In 'blood pressure 194 / 84 in left arm,]
        [184 / 84 in right arm' force ',' upwards]
        [to be CONJ QUANT on first QUANT on 'BP'.]
        [not punctuation ',' after 'arm.]
        OR NEXT WORD IS [N OR] ADJ OR D: H-PTAREA OR H-PTPART OR H-DESCR
        [can start BPART in RNOPTS: left side/knee/unknown vessels]
        [1/9/2002 can't allow BPART to prevent conjoining of PTPARTs:]
        [radiation into the neck, arm, jaw or back; BPART=/neck, arm.]
        OR H-AMT [some_of=(D:DLT, H-AMT), allowed in Q-OF in WHS-N]
        ['Chest pain , some of which may be ischemic']
        [also H-AMT 'orthopnea , two-pillow';]
        ['thrombus , approximately 3 cm']
        OR AINRN [hypertension , well-controlled].
   $PRE-MORE-QN-COMMA = ALL OF $COMMASTG, $MORE-QN.
   $MORE-QN = X2 IS SCALESTG;
        NEXT WORD IS Q:QNUMBER
        [5 feet , 3 inches].
   $TIME-ADJ =
        BOTH X1 IS QUANT AND X2 IS NQ OR QN
        [until hospital day number three , at which time ...].
   $OBJBE =
        BOTH X1 IS SASOBJBE OR ASOBJBE AND X2 IS OBJBE
        [regarded as investigational or for research].
   $TOVO =
        BOTH X1 IS TOVO AND X2 IS VO.
   $VINGO =
        BOTH X1 IS VINGO AND X2 IS SA-LAST
        [Patient began tolerating a regular diet and passing bowel movement].
   $PDATE =
        BOTH X1 IS PDATE AND X2 IS LDATER.
   $ASSERT =
        BOTH X1 IS ASSERTION
        AND ONE OF $INITSA, $OBJECTBE, $COMPLETE.
   $INITSA =
        X2 IS STRING INITIAL;
        X2 IS SA;
        X2 IS NOT EMPTY.
   $OBJECTBE =
        DO $OBJECT;
        AT X2 VALUE IS OBJECTBE.
   $OBJECT =
        [* SPNODE AFTER PASSOBJ IS FOR COMMA-PUNCT; AFTER OBJECT IT IS]
        [* FOR OBJECTBE OR COMMA-PUNCT]
        X2 IS OBJECT OR PASSOBJ OR OBJBE.
   $COMPLETE =
        X2 IS SA-LAST;
        PREVIOUS-ELEMENT- OF X2 IS OBJECT OR PASSOBJ OR OBJBE;
        AT X2 ASSIGN NODE ATTRIBUTE LAST-NODE.
   $THATS =
        BOTH X1 IS THATS OR ASSERTION
        [* She says her cholesterol is satisfactory and that she has high HDL]
        AND NEXT WORD X-NEXT IS 'THAT'.
   $VEN =
        BOTH X1 IS VENPASS OR VENO
        AND EITHER $OBJECT OR $COMPLETE.
   $VO =
        BOTH X1 IS VO OR TOVO AND X2 IS OBJECT OR VO
        [she is unable to sit up , or even get out of bed].
   $TVO =
        BOTH X1 IS TVO AND X2 IS VO
        [Ex: Refused PAP smear on this visit , will do in 2 weeks].
        [Cmmt: 10/21/02 Seems to relate to a previous def of TVO]
   $PN = BOTH X1 IS PN AND EITHER X2 IS P
        OR X2 IS NSTGO.
   $QN = BOTH X1 IS QN AND X2 IS MORE-QN.
   $LN = BOTH X1 IS LN AND [EITHER X2 IS APOS]
        [OR] X2 IS NPOS.
        [9/2/97 prevent LN CONJ LN where both LNs end at APOS]
   $NSTGT =
        X1 IS NSTGT;
        X2 IS NSTG.
   $BESHOW =
        BOTH X1 IS BESHOW AND EITHER $OBJECT OR $COMPLETE.
   $FRAGMENT =
        BOTH X1 IS FRAGMENT
        AND [BOTH] X2 IS SA-LAST
        [AND X2 IS NOT STRING INITIAL].
   $C1SHOULD = BOTH X1 IS C1SHOULD
        AND EITHER X2 IS 'THAT'
        OR X2 IS NULL.
   $ONESENT =
        X1 IS ONESENT;
        X2 IS CENTER OR INTRODUCER.
   $ADJADJ =
        [* allow LAR CONJ QN/NQ but not LXR=LAR CONJ LAR 6/18/96 *]
        BOTH X1 IS APOS
        AND BOTH X2 IS ADJADJ [small, 6 year old]
        AND $QN-OR-NQ IS TRUE.
   $QN-OR-NQ = EITHER EITHER NEXT WORD [skip CONJ] X5 IS Q
        OR BOTH X5 IS D:DLQ [only 5 mm]
        AND AT X5 NEXT WORD IS Q
        OR X5 IS N:NPREQ [grade 3].
   $SPWORD =
        BOTH CURRENT WORD IS SPWORD
        AND X2 IS COMMASTG WHERE NOT $1.
   $QCONJ =
        X1 IS Q-CONJ.
   $1 = ELEMENT Q-CONJ EXISTS.
DCONJ8 =
        [* If next or preceding word is a conjunction don't take ',' as a]
        [* conjunction. (John, Mary, and Bill like to swim.) (He and, in ]
        [* general, she like to swim.)]
        IN () COMMASTG RE OPTION SACONJ:
        THE CURRENT WORD IS NOT SPWORD.
DCONJ8A =
        [* Restricts punctuation comma ]
        IN () COMMASTG RE OPTION NULL:
        ONE OF $INITSA, $OBJECT, $RX, $LN, $BEFORE-CONJ.
   $INITSA =
        BOTH PREVIOUS-ELEMENT- X1 IS SA
        @AND BOTH PRESENT-ELEMENT- IS STRING INITIAL
        AND PRESENT-ELEMENT- IS NOT EMPTY.
   $OBJECT =
        X1 IS OBJECT OR PASSOBJ [COMMA-PUNCT allowed before final SA].
   $RX = BOTH $NOT-CERTAIN-T-Q AND $OK-EMPTY-RN.
   $NOT-CERTAIN-T-Q =
        BOTH X1 IS NOT EMPTY
        AND IF IMMEDIATE-NODE- OF X1 IS LQR OR LTR
        @THEN IMMEDIATE-NODE- IS NOT QN OR QPOS OR TPOS
        ELSE X1 IS OF TYPE RADJSET.
   $OK-EMPTY-RN =
        X1 IS RN [for comma-punct after empty RN].
   $LN =
        IMMEDIATE-NODE- IS NOT LN.
   $BEFORE-CONJ =
        THE CURRENT WORD IS SPWORD.
DCONJ9 =
        [* If SA is empty then no preceding COMMA-PUNCT allowed ]
        IN SA, SA-LAST RE NULL: NOT $1.
   $1 = PREVIOUS-ELEMENT- IS COMMASTG WHERE IT IS NOT CASE
        THAT ELEMENT- Q-CONJ EXISTS.
— DCONJ13->DACONJ13; TO BE 1ST RESTRICTION ON NODE, NEEDED BY 'EDIT'
— DCONJ14->DACONJ14; TO BE 1ST RESTRICTION ON NODE, NEEDED BY 'EDIT'
DCONJ15 =
        [* Special for POUR N ET POUR N (5b.1.5)]
        IN Q-CONJ:
        IF CURRENT WORD IS P WHERE PRESENT-ELEMENT- IS 'POUR'
        THEN AT IMMEDIATE CONJ-NODE COELEMENT P EXISTS
        WHERE PRESENT-ELEMENT- IS 'POUR'.
WCONJ0 =
        [* Q-CONJ must not be empty.]
        IN Q-CONJ:
        PRESENT-ELEMENT- IS NOT EMPTY.
WCONJ1 =
        [* Assigns PRE- and POST-CONJELELEM node attributes. ]
        [* This restriction ]
        [* must be first WELL-FORMEDNESS executed in Q-CONJ.]
        IN Q-CONJ :
        GO UP; DO PRE-POST-CONJELEM.
WCONJ2 =
        [* A right adjunct node should not be conjoined to an empty right]
        [* adjunct]
        IN Q-CONJ:
        IF BOTH VALUE IS OF TYPE RADJSET X1 AND NOT GO LEFT
        THEN AT X1 CONJELEM IS NOT EMPTY.
WCONJ3 =
        [* Restricts LNR CONJ LNR ]
        [* 9/3/97 In 'asthma attack without chest pain, positive ]
        [* shortness of breath' the conjoining of 'chest pain' and ]
        [* 'positive shortness of breath' under P='without' would result ]
        [* in a bad expansion:`without chest pain , (without) shortness ]
        [* of breath'. So for this special case the upper core ('pain') is]
        [* refused the conjunct COMMASTG (', shortness of breath'), which ]
        [* will conjoin subsequently to 'asthma attack'. ]
        IN Q-CONJ:
        IF IMMEDIATE-NODE- IS COMMASTG
        THEN NOT BOTH $1 AND $2.
   $1 = VALUE OF ELEMENT- NVAR X-NVAR IS N;
        N HAS ATTRIBUTE H-INDIC;
        AT COELEMENT- LN OF X-NVAR CORE- OF APOS IS 'POSITIVE'.
   $2 = CONJELEM X-NVAR-UPPER OF X-NVAR EXISTS;
        PRESENT-ELEMENT- HAS VALUE N;
        N HAS ATTRIBUTE H-INDIC;
        AT X-NVAR-UPPER ASCEND TO PN;
        ELEMENT- P IS 'WITHOUT'.
WCONJ3A =
        [* Restricts LNR CONJ LNR ]
        [* Resolution of APPOS vs. Q-CONJ for H-PT COMMA-CONJ H-PT, as in ]
        [* 'The patient , Mr XPT-P12345 , is a 50 year old male with CAD'. ]
        [* Avoid creating separate HIU for 'Mr XPT-P12345'. This occurs ]
        [* because the comma is taken as a conjunction between 2 LNRs. ]
        [* Reject the conjunction and hope the option APPOS will be taken. ]
        [* (1) Assign attribute NAME in preprocessing to X-PTxxx, YYY-xxx; ]
        [* (2) Assign attribute NAME to XXX and YYY entries in MLPdict; ]
        [* (3) Write (this) CONJ restriction: No LNR COMMA-CONJ LNR when ]
        [* both COREs have attrb H-PT and the second also has attrb NAME. ]
        IN Q-CONJ:
        IF IMMEDIATE-NODE- IS COMMASTG
        THEN NOT BOTH $1 AND $2.
   $1 = VALUE OF ELEMENT- NVAR X-NVAR IS N
        WHERE BOTH PRESENT-ELEMENT- HAS ATTRIBUTE H-PT
        AND PRESENT-ELEMENT- HAS ATTRIBUTE NAME.
   $2 = CONJELEM X-NVAR-UPPER OF X-NVAR EXISTS
        WHERE VALUE OF X-NVAR-UPPER HAS ATTRIBUTE H-PT.
WCONJ3B =
        [* Restricts LNR CONJ LNR ]
        [* 10/21/01 Another special case.In 'She was started on BiPAP and ]
        [* then refused treatment', the string 'and then refused treatment']
        [* is not an LNR conjunct on 'BiPAP' with 'refused' a VEN in AVAR ]
        [* in LN modifying 'treatment' (a refused treatment). This would ]
        [* create 'She was started on refused treatment'. ]
        IN Q-CONJ:
        IF VALUE OF ELEMENT- NVAR IS N: H-TTCOMP OR H-TTGEN OR H-TTSURG
        [refused treatment/admission/surgery]
        THEN IN ELEMENT- LN
        CORE- OF APOS IS NOT 'REFUSED'.
WCONJ3C =
        [* Restricts LNR CONJ LNR ]
        [* 3/14/2002 Another special case. In 'The patient's condition at ]
        [* discharge, patient instructions, diagnosis and discharge meds ]
        [* will be listed', the stretch from 'patient instructions' thru ]
        [* 'meds' should not be conjoined to 'discharge' even though both ]
        [* 'discharge' and 'instructions' are H-TTMED, hence OK by WCONJ9.]
        [* To prevent this conjoining we note that 'discharge' occurs in ]
        [* 'at discharge', a rather special time expression. ]
        IN Q-CONJ:
        IF IMMEDIATE-NODE- IS COMMASTG
        THEN NOT $1.
   $1 = VALUE OF ELEMENT- NVAR X-NVAR IS N: H-TTGEN [instructions];
        CONJELEM X-NVAR-UPPER OF X-NVAR EXISTS;
        VALUE OF PRESENT-ELEMENT- IS 'DISCHARGE' OR 'ADMISSION' OR 'VISIT';
        AT X-NVAR-UPPER ASCEND TO PN;
        ELEMENT- P IS 'AT' OR 'ON'.
WCONJ3D =
        [* 12/07/02 Another (semi)special case. No double negatives in the]
        [* case where the verb is negative ('denies') and a conjunct in ]
        [* the OBJECT contains 'no'. In 'Patient denies presyncope or ]
        [* syncope , no chest pain,' the scope of 'denies' ends at ]
        [* 'syncope'; the phrase 'no chest pain' is a new fragment. ]
        IN TPOS:
        IF BOTH IMMEDIATE-NODE- X-IMM2 OF IMMEDIATE-NODE- X-IMM1 IS Q-CONJ
        [Q-CONJ should be beginning an LN+NVAR+RN conjunct]
        AND CORE- [of TPOS] IS 'NO'
        THEN IF ASCEND TO OBJECT PASSING THROUGH Q-CONJ OR LN
        @THEN CORE- OF COELEMENT- VERBAL IS NOT H-NEG.
WCONJ4 =
        [* Restriction for LN CONJ LN, rules out funny conjunct with ]
        [* nonempty TPOS where upper TPOS is empty. ]
        [* 12/13/97 Disallow LN CONJ LN where only APOS's are non-empty]
        [* so as to not bypass restriction WCONJ6 on LAR conjoining. ]
        IN Q-CONJ:
        BOTH $1 AND $2.
   $1 = IF ELEMENT- TPOS X-TPOS EXISTS
        THEN AT X-TPOS IF CONJELEM- IS EMPTY
        THEN PRESENT-ELEMENT- IS EMPTY.
   $2 = IF BOTH ELEMENT- APOS X-APOS IS NOT EMPTY
        AND CONJELEM- X100 OF X-APOS IS NOT EMPTY
        THEN NOT ALL OF $T, $Q, $N.
   $T = X-TPOS IS EMPTY;
        CONJELEM- OF X-TPOS IS EMPTY.
   $Q = ELEMENT- QPOS X-QPOS IS EMPTY;
        CONJELEM- OF X-QPOS IS EMPTY.
   $N = ELEMENT- NPOS X-NPOS IS EMPTY;
        CONJELEM- OF X-NPOS IS EMPTY.
WCONJ4A =
        [* Restriction for LN CONJ LN: compatible classes in APOS/NPOS ]
        IN Q-CONJ:
        X-QCONJ1 := PRESENT-ELEMENT-;
        [ Find how many conjuncts are here ]
        IF ELEMENT- NPOS X-NPOS1 EXISTS
        @THEN IF CONJELEM X-NPOS2 EXISTS
        @THEN $DO-CONJS
        ELSE TRUE
        ELSE TRUE.
$DO-CONJS =
        IF CONJELEM X-NPOS3 EXISTS
        THEN $MORE-THAN-TWO
        ELSE $TWO-CONJUNCT.
$TWO-CONJUNCT =
        IF X-NPOS1 IS NOT EMPTY
        THEN SET LOGIC SWITCH 11;
        IF X-NPOS2 IS NOT EMPTY
        THEN SET LOGIC SWITCH 12;
        IF BOTH TEST LOGIC SWITCH 11
        AND TEST LOGIC SWITCH 12
        THEN EITHER $BOTH-NPOS-FULL-OLD
        [10/15/2003 Reverting to EXACT MATCH to avoid conjoining ]
        [of 'PTCA and stent' in 'PTCA and stent replacement' -> ]
        [medically unreasonable 'PTCA replacement'. ]
        OR EITHER BOTH X-NPOS1 DOES NOT HAVE NODE ATTRIBUTE SELECT-ATT
        AND X-NPOS2 DOES NOT HAVE NODE ATTRIBUTE SELECT-ATT
        [If neither has a selatt then return true]
        OR BOTH CURRENT WORD IS N:H-CHANGE ['changes']
        AND $BOTH-NPOS-FULL [equiv-match for 'ECG and enzyme changes']
        ELSE IF EITHER TEST LOGIC SWITCH 11
        OR TEST LOGIC SWITCH 12
        THEN $MIXED-NPOS
        [ELSE $BOTH-NPOS-EMPTY].
        [9/2/97 no LN CONJ LN with both NPOS empty; force LAR conjuncts]
        [to prevent peculiar conjoining:'25% , myocardial']
$BOTH-NPOS-FULL-OLD =
        [ If both NPOS'S are full check for an exact match of the selatts]
        [ If neither has a selatt then return true]
        BOTH CORE- OF X-NPOS2 HAS NODE ATTRIBUTE SELECT-ATT X-NEWLIST
        AND BOTH CORE- OF X-NPOS1 HAS NODE ATTRIBUTE SELECT-ATT
        @AND INTERSECT IS NOT NIL.
$BOTH-NPOS-FULL =
        [ If both NPOS'S are full check for an equiv match of the selatts]
        BOTH CORE- OF X-NPOS2 HAS NODE ATTRIBUTE SELECT-ATT X-NPOS2LIST
        AND IF CORE- OF X-NPOS1 HAS NODE ATTRIBUTE SELECT-ATT X-NPOS1LIST
        THEN $EQUIV-MATCH4A.
   $EQUIV-MATCH4A =
        EQUIV-MATCH USING CONJ-EQUIV-CLASSES OF ATT-LISTS X-NPOS1LIST X-NPOS2LIST
        INTO X1-SELECT X2-SELECT WITH REJECTION SET MAJOR-EQUIV-CLASSES;
GO TO X1-SELECT;
GO TO X2-SELECT.
$BOTH-NPOS-EMPTY =
        [If both NPOS's are empty test the APOS's]
        AT X-NPOS1 IF COELEMENT- APOS IS NOT EMPTY
        THEN AT X-NPOS2 COELEMENT- APOS IS NOT EMPTY
        ELSE TRUE.
   $MIXED-NPOS =
        IF TEST LOGIC SWITCH 11
        THEN AT X-NPOS1 IF COELEMENT- APOS IS NOT EMPTY
        THEN FALSE
        ELSE BOTH PRESENT-ELEMENT- X-NPOS EXISTS
        AND AT X-NPOS2 DO $CHECK-APOS
        ELSE AT X-NPOS2 IF COELEMENT- APOS IS NOT EMPTY
        THEN FALSE
        ELSE BOTH PRESENT-ELEMENT- X-NPOS EXISTS
        AND AT X-NPOS1 DO $CHECK-APOS.
   $CHECK-APOS =
        IF COELEMENT- APOS X-APOS IS EMPTY
        THEN FALSE
        ELSE $MIXED-NA.
   $MIXED-NA =
        IF CORE- X-TEST OF X-NPOS HAS NODE ATTRIBUTE SELECT-ATT X-NEWLIST
        THEN IF CORE- OF X-APOS HAS NODE ATTRIBUTE SELECT-ATT
        @THEN BOTH EITHER INTERSECT IS NOT NIL
        OR TRUE
        AND X-INTERSECTION IS NOT NIL
        ELSE FALSE
        ELSE CORE- OF X-APOS DOES NOT HAVE NODE ATTRIBUTE SELECT-ATT.
   $MORE-THAN-TWO =
        IF PRESENT-ELEMENT- IS EMPTY
        THEN $ALL-NS-EMPTY
        ELSE $ALL-NS-FULL.
   $ALL-NS-EMPTY =
        X-NPOS2 IS EMPTY;
        X-NPOS1 IS EMPTY;
        X-NP := X-NPOS3;
        ITERATET X-NP IS EMPTY
        UNTIL AT X-NP CONJELEM X-NP EXISTS FAILS;
        DO $TEST-AS.
   $TEST-AS =
        AT X-POS1 IF COELEMENT- APOS X-APOS IS EMPTY
        THEN $APS-ALL-EMPTY
        ELSE $APS-ALL-FULL.
   $APS-ALL-EMPTY =
        ITERATET X-APOS IS EMPTY
        UNTIL AT X-APOS CONJELEM X-APOS EXISTS FAILS.
   $APS-ALL-FULL =
        ITERATET X-APOS IS NOT EMPTY
        UNTIL AT X-APOS CONJELEM X-APOS EXISTS FAILS.
   $ALL-NS-FULL =
        IF CORE- OF PRESENT-ELEMENT- HAS NODE ATTRIBUTE SELECT-ATT X-NEWLIST
        THEN $FULL-WITH-SELATT
        ELSE $FULL-NO-SELATT.
   $FULL-WITH-SELATT =
        X-NPOS2 IS NOT EMPTY;
        CORE- OF PRESENT-ELEMENT- HAS NODE ATTRIBUTE SELECT-ATT;
        INTERSECT IS NOT NIL;
        X-NEWLIST := X-INTERSECTION;
        X-NPOS1 IS NOT EMPTY;
        CORE- OF PRESENT-ELEMENT- HAS NODE ATTRIBUTE SELECT-ATT;
        INTERSECT IS NOT NIL;
        X-NEWLIST := X-INTERSECTION;
        X-NP := X-NPOS3;
        ITERATET $TEST-FULL-AND-SELATT
        UNTIL AT X-NP CONJELEM X-NP EXISTS FAILS.
   $TEST-FULL-AND-SELATT =
        X-NP IS NOT EMPTY;
        CORE- OF PRESENT-ELEMENT- HAS NODE ATTRIBUTE SELECT-ATT;
        INTERSECT IS NOT NIL;
        X-NEWLIST := X-INTERSECTION.
   $FULL-NO-SELATT =
        X-NPOS2 IS NOT EMPTY;
        NOT CORE- OF PRESENT-ELEMENT- HAS NODE ATTRIBUTE SELECT-ATT;
        X-NPOS1 IS NOT EMPTY;
        NOT CORE- OF PRESENT-ELEMENT- HAS NODE ATTRIBUTE SELECT-ATT;
        X-NP := X-NPOS3;
        ITERATET
        BOTH X-NP IS NOT EMPTY
        AND NOT CORE- OF PRESENT-ELEMENT- HAS NODE ATTRIBUTE SELECT-ATT
        UNTIL AT X-NP CONJELEM X-NP EXISTS FAILS.
WCONJ5 =
        [* Restriction for LN CONJ LN, rules out funny conjunct with ]
        [* nonempty APOS where upper APOS is empty: '2.00 and normal']
        [* But OK if upper APOS has non-empty coelement NPOS, as in ]
        [* 'No costovertebral angle or spinal tenderness'. WCONJ4A ]
        [* tests for subclass compatibility in such a conjunct. ]
        IN Q-CONJ:
        IF ELEMENT- APOS X1 EXISTS
        THEN AT X1
        IF BOTH CONJELEM- X-UPPER IS EMPTY
        AND COELEMENT NPOS OF X-UPPER IS EMPTY
        THEN PRESENT-ELEMENT- IS EMPTY.
WCONJ5A =
        [* Avoid conjoining of QN or NQ with N in NVAR; force APOS]
        IN Q-CONJ: BOTH $1 AND $2.
   $1 = IF ELEMENT- NVAR X55 HAS VALUE QN OR NQ
        THEN $UP-TO-QN-NQ.
   $UP-TO-QN-NQ = CONJELEM OF X55 HAS VALUE QN OR NQ.
   $2 = IF X55 HAS VALUE N OR PRO OR VING
        THEN NOT $UP-TO-QN-NQ.
WCONJ6 =
        [* Restriction for LAR CONJ LAR; ]
        [* no INDIC & PTPART conjoining, e.g. 'nicking' and 'arteriolar']
        [* in 'A-V nicking and arteriolar narrowing'.]
        [* no INDIC & TTGEN conjoining, e.g. 'ill' and 'air lifted']
        [* in 'She was ill, air lifted then to ZZZ,...'.]
        [* 7/11/00 Also not VING CONJ VEN in LAR: 'walking, stopped' in]
        [* 'He decreased walking, stopped playing tennis']
        [* 12/7/02 Also not ADJ CONJ VEN in LAR (too broad?) as in]
        [* 'She was not feeling well and developed chest pain'. Here, ]
        [* she did not feel a well and developed chest pain.]
        IN Q-CONJ:
        PRESENT-ELEMENT- X3 EXISTS;
        IF $IN-LAR
        THEN ALL OF $TOP-TO-BOTTOM, $BOTTOM-TO-TOP, $VEN-VING-ADJ.
   $IN-LAR =
        [* restriction tests 2 conjuncts only]
        GO UP; GO UP; TEST FOR LAR; STORE IN X1.
   $TOP-TO-BOTTOM = BOTH IF CORE- X30 OF X3 IS H-INDIC
        THEN CORE- X10 OF X1 IS NOT H-PTPART OR H-TTGEN
        AND IF X30 IS H-PTPART OR H-TTGEN
        THEN CORE- X10 OF X1 IS NOT H-INDIC.
   $BOTTOM-TO-TOP = BOTH IF CORE- X10 OF X1 IS H-INDIC
        THEN CORE- X30 OF X3 IS NOT H-PTPART OR H-TTGEN
        AND IF X10 IS H-PTPART OR H-TTGEN
        THEN CORE- X30 OF X3 IS NOT H-INDIC.
   $VEN-VING-ADJ = IF X30 IS VEN
        THEN EITHER X30 IS 'ENLARGED'
        OR CORE- X10 OF X1 IS NOT VING OR ADJ
        [*walking, stopped, *well and developed].
WCONJ7 =
        [* Restriction for LAR CONJ LAR, rules out comma conjunct for ]
        [* specific words: 'afebrile, systolic blood pressure 140' is ]
        [* not a single phrase, implying 'afebrile blood pressure'. ]
        [* Similarly in 'She continued to have nausea, vomiting, non-bloody]
        [* diarrhea', must disallow 'vomiting, non-bloody' as left adjuncts]
        [* in ADJADJ on diarrhea, in effect creating a 'vomiting diarrhea'.]
        IN Q-CONJ:
        BOTH IF ELEMENT- AVAR X1 EXISTS
        WHERE VALUE IS 'SYSTOLIC'
        THEN AT X1 IF CONJELEM- HAS VALUE ADJ@
        THEN IT- IS NOT 'AFEBRILE'
        AND IF AT X1 VALUE IS 'NON-BLOODY'
        THEN AT X1 IF CONJELEM- HAS VALUE VING@
        THEN PRESENT-ELEMENT- IS NOT 'VOMITING'.
WCONJ7A =
        [* Restriction for LAR COMMA LAR where COMMASTG does not contain ]
        [* Q-CONJ but occurs as punctuation in 1st LAR in ADJADJ, and the]
        [* second LAR is right sibling to that ADJADJ. This configuration]
        [* occurs in parsing after WCONJ7 kicks the 2nd LAR out of Q-CONJ]
        IN ADJADJ: BOTH $1 AND $2.
   $1 = IF BOTH ELEMENT- ADJADJ X3 EXISTS [right recursion in ADJADJ]
        AND ELEMENT- LAR X4 EXISTS [second LAR]
        WHERE CORE- IS H-PTFUNC ['SYSTOLIC']
        THEN AT X3
        NOT BOTH CORE- OF ELEMENT- LAR IS H-INDIC ['AFEBRILE']
        AND ELEMENT- LAR HAS ELEMENT- COMMASTG
        WHERE IT IS NOT THE CASE THAT ELEMENT- Q-CONJ EXISTS
        [punctuation comma].
   $2 = IF BOTH ELEMENT- ADJADJ X3 EXISTS [right recursion in ADJADJ]
        AND ELEMENT- LAR X4 EXISTS [second LAR]
        WHERE CORE- IS H-DESCR ['non-bloody']
        THEN AT X3
        NOT BOTH CORE- OF ELEMENT- LAR IS 'VOMITING'
        AND ELEMENT- LAR HAS ELEMENT- COMMASTG
        WHERE IT IS NOT THE CASE THAT ELEMENT- Q-CONJ EXISTS
        [punctuation comma].
WCONJ8 =
        [* Q-CONJ not OK if still has DEFERRED and no further conjunct]
        IN Q-CONJ:
        NOT CORE- OF ELEMENT- NVAR HAS NODE ATTRIBUTE DEFERRED.
— WCONJ9-DOC
— ALLOWS ONLY COMPATIBLE LNR'S TO CONJOIN.
— COMPATIBILITY IS DETERMINED BY EXAMINING ATTRIBUTES CARRIED BY THE
— CORE OF EACH LNR, USUALLY A NOUN. THE CORE HAS A SELECT-ATT WHOSE
— VALUE IS THE LIST OF POTENTIALLY RELEVANT MEDICAL LEXICAL CLASSES
— OF THE CORE WORD ('FOOT': H-PTPART, NUNIT); IT
— MAY HAVE A COMPUTED-ATT IF ITS MODIFIERS IMPART A SEMANTIC VALUE
— TO THE LNR DIFFERENT FROM THE SELECT-ATT VALUE OF THE CORE, E.G.
— AT 'FOOT' OF 'SWOLLEN FOOT' COMPUTED-ATT = H-INDIC (SYMPTOM WORD)
— DUE TO THE H-INDIC ATTRIBUTE OF 'SWOLLEN'.
— CORE-ATT RETURNS THE 'HIGHEST LEVEL' ATTRIBUTE: COMPUTED-ATT IF
— THERE IS ONE OR ELSE SELECT-ATT.

— STRATEGY FOR 2 CONJUNCTS:
— NOTE: THE TERMS 'UPPER'/'LOWER' REFER TO THE RELATIVE POSITIONS OF
— THE 2 CONJUNCTS IN THE TREE. IN THE SENTENCE, THE WORDS OF THE UPPER
— CONJUNCT OCCUR BEFORE THOSE OF THE LOWER CONJUNCT.

— THE TASK IS DIVIDED INTO MATCHING AND FURTHER ACTIONS (ALTER AND
— CREATE NEW NODE ATTRIBUTES). MATCHING USES FIRST THE HIGHEST LEVEL
— ATTRIBUTE (CORE-ATT) OF EACH CORE OF LNR TO BE MATCHED.
— A "MIXED MATCH" IS A COMPUTED-ATT (UPPER OR LOWER) WITH A
— SELECT-ATT (LOWER OR UPPER): 'BROKEN LEG AND FEVER',
— 'FEVER AND BROKEN LEG'; SIMILARLY WITH COMPUTED-ATT COMING FROM
— MODIFIERS ON THE RIGHT: 'LEG WITH EDEMA AND FEVER',
— 'FEVER AND LEG WITH EDEMA'.

— THE MATCHING PROCESS PRODUCES FOR EACH CONJUNCT (AT CORE OF NVAR)
— A SUBLIST OF THE ATTRIBUTES THAT ENTERED INTO THE MATCH. WHAT IS
— TRUE OF THESE SUBLISTS IS THAT THERE IS A "PATH" FROM EACH ITEM ON
— ONE LIST TO ONE OR MORE ITEMS ON THE OTHER. THIS "PATH" COMES INTO
— BEING IN ONE OF TWO WAYS: (1) EXACT-MATCH, I.E. THE ITEMS HAVE THE
— SAME NAME * (SAME-NAMED ATTRIBUTE); OR (2) EQUIV-MATCH, I.E. THE
— ITEMS HAVE NO EXACT-MATCH, BUT BOTH ITEMS OCCUR ON THE SAME SUBLIST
— OF THE LIST CONJ-EQUIV-CLASSES OF THE GRAMMAR. AN EXAMPLE OF
— EXACT-MATCH IS 'FEVER AND VOMITING': H-INDIC AND H-INDIC. AN EXAMPLE
— OF EQUIV-MATCH IS 'MEASLES AND HIGH FEVER': H-DIAG AND H-INDIC.

—       EXACT-MATCH IS REQUIRED FOR CERTAIN ACTIONS PERFORMED AFTER
— MATCHING, NAMELY, COPYING A COMPUTED-ATT (ACTUALLY, CREATING A
— COMPUTED-ATT ON ONE NODE BASED ON THE COMPUTED-ATT ON ANOTHER NODE,
— AS IN 'BROKEN ARM AND [BROKEN] LEG'); AND IN ESTABLISHING THE
— CONDITIONS FOR CREATING THE ATTRIBUTE LINKC, DESCRIBED BELOW.

— NOTE: AN ITEM ON ONE SUBLIST MIGHT HAVE A PATH (I.E. MATCH) TO MORE
— THAT ONE ITEM ON THE OTHER LIST: A MATCHES B,C WHERE THE LIST
— CONJ-EQUIV-CLASSES CONTAINS A SUBLIST ON WHICH A, B, C, OCCUR, OR
— CONTAINS TWO SUBLISTS, ONE WITH A, B, AND ONE WITH A, C.
—       IF THE HIGHEST LEVEL MATCH FAILS AND THE MATCH WAS NOT ONE
— WITH ALL SELECT-ATTS OR ALL COMPUTED-ATTS, I.E. A MIXED MATCH,
— THEN A SECOND TRY IS ATTEMPTED USING ONLY SELECT-ATTS.
— THE REASON IS THAT A COMPUTED-ATT ON ONE OF THE COMPARED CORES
— MAY APPLY TO THE OTHER, AND TAKING THIS INTO ACCOUNT WOULD
— MAKE THE CONJUNCTS COMPATIBLE. FOR EXAMPLE, IN 'BROKEN ARM AND LEG',
— THE COMPUTED-ATT = H-INDIC ON 'ARM' FAILS TO MATCH THE SELECT-ATT =
— H-PTPART ON 'LEG'. WHAT IS NEEDED IS THAT 'LEG' SHOULD GET A
— COMPUTED-ATT = H-INDIC COMING FROM 'BROKEN', JUST AS 'ARM' DID.
— SIMILARLY IN 'ARM AND LEG WITH EDEMA', 'ARM' SHOULD GET A
— COMPUTED-ATT = H-INDIC DUE TO 'WITH EDEMA'.

—       HOWEVER, IF THE UPPER CORE IS H-PTPART, IT MIGHT BE IN THE SCOPE OF
— A SYMPTOM WORD (H-INDIC) AND THUS NOT BE FREE TO BECOME A PART OF A
— COMPUTED-ATT COMING FROM A RIGHT MODIFIER ON THE LOWER CORE (CONTRAST
— 'RASH ON ARM AND LEG WITH EDEMA' (NO COMPUTED-ATT ON 'ARM' COMING FROM
— 'WITH EDEMA') WITH 'ARM AND LEG WITH EDEMA' (WHERE 'ARM' SHOULD GET
— A COMPUTED-ATT DUE TO 'WITH EDEMA'). WHEN THE UPPER CORE IS IN THE
— SCOPE OF AN H-INDIC WORD AS DESCRIBED, IT CARRIES THE ATTRIBUTE
— NOT-FREE (ASSIGNED BY WCOMP-ATT1), I.E. 'ARM' IN 'RASH ON ARM AND
— LEG WITH EDEMA'. THEN, IN WCONJ9, IF THE HIGHEST LEVEL MATCH FAILS
— AND THE UPPER CORE CARRIES NOT-FREE, THEN THE RESTRICTION DOES NOT TRY
— FOR A SELECT-ATT MATCH, WHICH, IF SUCCESSFUL, WOULD ENTAIL BUILDING
— A NEW COMPUTED-ATT. RATHER, THE RESTRICTION FAILS.
— AS A RESULT, THE LOWER LNR CONJUNCT WILL BE DETACHED FROM THE TREE,
— TO BE REBUILT AT A HIGHER LEVEL OF THE TREE (NO LONGER A PART OF
— THE UPPER CONJUNCT), AND THE UPPER LNR CONJUNCT (CARRYING NOT-FREE)
— WILL COMPLETE THE UPPER INDIC PHRASE ('RASH ON ARM').

— IN THE 3 CONJUNCT CASE, IF THE MIDDLE CONJUNCT IS AN H-PTPART
— CONJOINED TO AN UPPER H-PTPART WHICH CARRIES NOT FREE, THEN NOT-FREE
— IS COPIED TO THE MIDDLE CONJUNCT. THIS IMPLIES THAT THE MIDDLE
— CONJUNCT IS GROUPED TO THE LEFT, NOT THE RIGHT (SEEMS REASONABLE);
— THUS 'RASH ON ARM AND NECK AND LEG WITH EDEMA' PUTS 'RASH'
— (NOT 'EDEMA') ON 'NECK'. BUT NOTE THAT IF THE CONJUNCTIONS ARE A
— PARTICULAR MIX OF COMMAS AND 'AND'S, THIS MIGHT INFLUENCE WHAT IS
— THE CORRECT GROUPING.

— MATCHES COME IN 2 FLAVORS: EXACT-MATCH MEANS THE COMPARED ATTRIBUTE
— LISTS HAVE 1 OR MORE ITEMS IN COMMON, E.G. 'FEVER AND VOMITING':
— H-INDIC AND H-INDIC. EQUIV-MATCH MEANS THE COMPARED ATTRIBUTE LISTS
— HAVE ONE OR MORE ITEMS THAT APPEAR IN THE SAME SUBLIST OF THE LIST
— CONJ-EQUIV-CLASSES OF THE GRAMMAR, E.G. 'FEVER AND TUBERCULOSIS':
— H-INDIC AND H-DIAG. EXACT-MATCH IS REQUIRED FOR CERTAIN ACTIONS
— PERFORMED AFTER MATCHING, NAMELY, COPYING A COMPUTED-ATT (ACTUALLY,
— CREATING A COMPUTED-ATT ON ONE NODE BASED ON THE COMPUTED-ATT ON
— ANOTHER NODE), * AS IN 'BROKEN ARM AND [BROKEN] LEG'); AND IN
— ESTABLISHING THE CONDITIONS FOR CREATING THE ATTRIBUTE LINKC,
— DESCRIBED BELOW.

—       REGARDLESS OF HOW A MATCH IS OBTAINED, CERTAIN ACTIONS ARE ALWAYS
— PERFORMED:
—       (A) PRUNE COMPUTED-ATTS/SELECT-ATTS
—       - ONLY ATTRIBUTES INVOLVED IN THE SUCCESSFUL MATCH
—       ARE CARRIED FORWARD -
—       PROVISION IS ALSO MADE FOR THE CASE WHERE A CONJUNCT DOES NOT
— CARRY EITHER A COMPUTED-ATT OR A SELECT-ATT. +++ NOT DONE 11/29 +++
— THIS WILL TRUE FOR WORDS WHICH DO NOT HAVE SUBLANGUAGE CLASSES.
— IN THIS CASE ($NO-SUBCLASS) CONJOINING IS ALLOWED, BUT NO ATTRIBUTE
— (COMPUTED-ATT OR SELECT-ATT) IS ASSIGNED.

—       PROVISION IS ALSO MADE FOR THE CASE WHERE A CONJUNCT DOES NOT
— PASS THE MATCH TEST BUT MIGHT PASS AS A RESULT OF ACTIONS AT A
— FOLLOWING (YET TO BE ANALYZED) CONJUNCT, E.G. IN A 3-CASE WHERE
— THE MIDDLE CONJUNCT AWAITS A COMPUTED-ATT DERIVING FROM THE ADJUNCT
— IN THE THIRD LNR: 'FEVER AND KNEE AND ANKLE WITH EDEMA'. THE CORE
— OF THE MIDDLE LNR IN THIS CASE ('KNEE') GETS THE ATTRIBUTE DEFERRED.
WCONJ9 =
        IN RN: EITHER $RISK-FACTORS OR $WCONJ9-TEST.
   $RISK-FACTORS = ASCEND TO OBJECTBE PASSING THROUGH Q-CONJ;
        ASCEND TO OBJECT;
        CORE- OF COELEMENT- SUBJECT IS 'RISK'_'FACTORS'
        [Ex: 'Risk factors include age, obesity,...'].
   $WCONJ9-TEST = X-RN := PRESENT-ELEMENT-;
        IF BOTH $PRE-CONDITIONS
        AND $FIND-CONJ-NVAR
        THEN IF NOT TEST LOGIC SWITCH 7
        THEN $TWO-CONJUNCTS
        ELSE $THREE-MORE-CONJUNCTS.
   $PRE-CONDITIONS =
        BOTH PREVIOUS-ELEMENT- IS NOT RNOPTS
        AND IMMEDIATE Q-CONJ EXISTS.
—       - - - - - - - - - - - - - - - - - - - - - - - -
—       *** REGISTER ASSIGNMENTS ***

—       X1 LOWER CONJOINED N
—       X2 NEXT UPPER CONJOINED N
—       X3 NEXT NEXT UPPER CONJOINED N IN 3-CONJUNCT CASE
—       X4 UPPERMOST CONJOINED N IN 4-CONJUNCT CASE
—       X-LN REGISTER STORING LN
—       X1-ATT ATTRIBUTE LIST OF X1 PARTICIPATING IN THE MATCH
—       X2-ATT ATTRIBUTE LIST OF X2 PARTICIPATING IN THE MATCH
—       X3-ATT ATTRIBUTE LIST OF X3 PARTICIPATING IN THE MATCH
—       X-SAVE VALUE OF NODE ATTRIBUTE N-TO-LN-ATT (OR N-TO-RN-ATT)
—       (I.E. LXR IN LN OR RN CAUSING COMPUTED ATTRIBUTE)
—       X-NEWLIST USED FOR ROUTINE INTERSECT
—       (AS A RESULT OF $EQUIV-SUBCLASS OR $EXACT-MATCH)
—       X1-SELECT REGISTER STORING SUBLIST OF X1-ATT THAT MATCHED
—       X2-SELECT REGISTER STORING SUBLIST OF X2-ATT THAT MATCHED
—       X3-SELECT REGISTER STORING SUBLIST OF X3-ATT THAT MATCHED
—       X4-SELECT REGISTER STORING SUBLIST OF X4-ATT THAT MATCHED
— LOGIC SWITCHES:
—       1 - X1 HAS COMPUTED-ATT
—       2 - X2 HAS COMPUTED-ATT
—       3 - X3 HAS COMPUTED-ATT
—       4 - X4 HAS COMPUTED-ATT
—       5 - X5 HAS COMPUTED-ATT
—       7 - THREE CONJUNCT CASE
—       10 - FOUR CONJUNCT CASE
—       6 - ONE OR MORE ATTRIBUTES PRODUCED EXACT MATCHES
—       8 - NON-EMPTY RN ON LOWER; SEE $SET-LINKC-RN; MARKS ASSIGNED LINKC
—       9 - MATCH MADE ON SELECT ATT
—       11 - COMPATT USED FOR COMPARISON ON X1
—       12 - COMPATT USED FOR COMPARISON ON X2
—       13 - COMPATT USED FOR COMPARISON ON X3
—       14 - COMPATT USED FOR COMPARISON ON X4
—       16 - A TWO-CONJ TRY IN A THREE-CONJ CASE
—       19 - A RETRY WAS DONE
—       20 - A LOCAL TEMP SWITCH
—       INDICATES AN EXACT MATCH ON SELATTS-LINKC PROCESSING
—       21 - ONLY ONE ITEM IN ATT LIST FOR NODE X1
—       22 - ONLY ONE ITEM IN ATT LIST FOR NODE X2
—       23 - ONLY ONE ITEM IN ATT LIST FOR NODE X3
—       24 - ONLY ONE ITEM IN ATT LIST FOR NODE X4
—       29 - EXACT MATCH IF X1 AAND X2 ATT LISTS
—       30 - A LOCAL TEMP SWITCH
—       USED IN BODY PART ANALYSIS IN LINKC PROCESSING
—       31 - COPIED COMP-ATT AT X1
—       32 - COPIED COMP-ATT AT X2
—       33 - COPIED COMP-ATT AT X3
—       34 - COPIED COMP-ATT AT X4
   $FIND-CONJ-NVAR =
        [* X1 is LNR-core of conjunct where WCONJ9 begins (lower in tree);]
        [* X2 is next upper conjunct core]
        [* X3 is the third (uppermost) conjunct core in 3 conjunct case]
        [* X4 is the fourth (uppermost) conjunct core in 4 conjunct case]
        HOST- X1 [OF PRESENT-ELEMENT-] EXISTS ;
        GO UP [NVAR];
        STORE IN X1-NVAR;
        CORE- X2 OF CONJELEM EXISTS;
        AT X1-NVAR GO UP; TEST FOR Q-CONJ [conjunct is in LNR at least a 2-case];
        EITHER $MAYBE-THREE-CONJ
        OR TRUE[if it fails only a 2-case].
   $MAYBE-THREE-CONJ=
        AT X2 GO UP [NVAR];
        STORE IN X2-NVAR;
        CORE- X3 OF CONJELEM [NVAR] EXISTS;
        AT X2-NVAR GO UP; TEST FOR Q-CONJ [conjunct is in LNR at least a 3-case];
        SET LOGIC SWITCH 7 [tests for 3-conjunct case];
        EITHER $MAYBE-FOUR-CONJ
        OR TRUE [if it fails only a 3-case].
   $MAYBE-FOUR-CONJ =
        AT X3 GO UP [NVAR];
        STORE IN X3-NVAR;
        CORE- X4 OF CONJELEM [NVAR] EXISTS;
        AT X3-NVAR GO UP; TEST FOR Q-CONJ [conjunct is in LNR at least a 4-case];
        SET LOGIC SWITCH 10 [tests for 4-conjunct case].
   $TWO-CONJUNCTS =
        IF $SUBCLASS-MATCH
[Actions after match: Always (a) prune COMPUTED-ATTs/SELECT-ATTs ]
[ Conditional (c) If both mixed-match failed ]
[ and SELECT-ATTs exact-matched ]
[ then copy COMPUTED-ATT to non COMPUTED-ATT node.]
[ (d) If certain conditions obtain, set LINKCs. ]
        THEN ALL OF $GET-LNS,
   $FINISH-UP,
   $TRY-MAKE-LINKC
        ELSE $DEFER. [chk for conj following and defer failure]
   $SUBCLASS-MATCH =
        DO $GET-THE-ATTS;
        IF NOT $EXACT-OR-EQUIV [try for a match]
        THEN $TRY-AGAIN-TWO.
   $GET-THE-ATTS =
        DO $GET-ATTS-X1;
        DO $GET-ATTS-X2;
        IF TEST LOGIC SWITCH 7 [is there a third conj]
        THEN DO $GET-ATTS-X3;
        IF TEST LOGIC SWITCH 10 [is there a fourth conj]
        THEN DO $GET-ATTS-X4.
   $GET-ATTS-X1=
        IF X1 HAS NODE ATTRIBUTE COMPUTED-ATT X1-ATT
        THEN BOTH SET LOGIC SWITCH 1
        AND SET LOGIC SWITCH 11
        ELSE BOTH CORE-SELATT X1-ATT OF X1 EXISTS
        AND SET LOGIC SWITCH 9;
        IF SUCCESSORS OF X1-ATT IS NIL
        THEN SET LOGIC SWITCH 21.
   $GET-ATTS-X2=
        IF X2 HAS NODE ATTRIBUTE COMPUTED-ATT X2-ATT
        THEN BOTH BOTH SET LOGIC SWITCH 2
        AND SET LOGIC SWITCH 12
        AND CLEAR LOGIC SWITCH 9
        ELSE CORE-SELATT X2-ATT OF X2 EXISTS;
        IF SUCCESSORS OF X2-ATT IS NIL
        THEN SET LOGIC SWITCH 22.
   $GET-ATTS-X3=
        IF X3 HAS NODE ATTRIBUTE COMPUTED-ATT X3-ATT
        THEN BOTH BOTH SET LOGIC SWITCH 3
        AND SET LOGIC SWITCH 13
        AND CLEAR LOGIC SWITCH 9
        ELSE CORE-SELATT X3-ATT OF X3 EXISTS;
        IF SUCCESSORS OF X3-ATT IS NIL
        THEN SET LOGIC SWITCH 23.
   $GET-ATTS-X4=
        IF X4 HAS NODE ATTRIBUTE COMPUTED-ATT X4-ATT
        THEN BOTH BOTH SET LOGIC SWITCH 4
        AND SET LOGIC SWITCH 14
        AND CLEAR LOGIC SWITCH 9
        ELSE CORE-SELATT X4-ATT OF X4 EXISTS;
        IF SUCCESSORS OF X4-ATT IS NIL
        THEN SET LOGIC SWITCH 24.
   $EXACT-OR-EQUIV =
        IF $EXACT-MATCH
        THEN BOTH SET LOGIC SWITCH 6
        AND IF $CHECK-DONE
        THEN TRUE
        ELSE $EQUIV-MATCH
        ELSE $EQUIV-MATCH.
   $EXACT-MATCH =
        X1-SELECT := NIL;
        X2-SELECT := NIL;
        IF TEST LOGIC SWITCH 7 [3-conj case]
        THEN X3-SELECT:= NIL;
        IF TEST LOGIC SWITCH 10 [4-conj case]
        THEN X4-SELECT:= NIL;
        X-NEWLIST:= X2-ATT ;
        INTERSECT X2-SELECT OF X1-ATT
        [with X2-ATT in X-NEWLIST] IS NOT NIL;
        SET LOGIC SWITCH 29;
        IF TEST LOGIC SWITCH 7 [3-conj case]
        THEN BOTH IF BOTH X-NEWLIST:= X3-ATT
        AND INTERSECT X3-SELECT OF X2-SELECT IS NIL
        THEN BOTH X2-SELECT := NIL
        AND FALSE
        AND IF TEST LOGIC SWITCH 10 [4-conj case]
        THEN IF BOTH X-NEWLIST:= X4-ATT
        AND INTERSECT X4-SELECT OF X3-SELECT IS NIL
        THEN BOTH X3-SELECT := NIL
        AND FALSE ;
        X-NEWLIST:= X1-ATT;
        INTERSECT X1-SELECT OF X2-ATT [with X1-ATT in X-NEWLIST] EXISTS.
   $CHECK-DONE =
        BOTH TEST LOGIC SWITCH 21
        AND TEST LOGIC SWITCH 22.
   $EQUIV-MATCH =
EQUIV-MATCH USING CONJ-EQUIV-CLASSES OF ATT-LISTS X1-ATT X2-ATT
        INTO X1-SELECT X2-SELECT WITH REJECTION SET MAJOR-EQUIV-CLASSES;
GO TO X1-SELECT;
GO TO X2-SELECT.
   $TRY-AGAIN-TWO = [no CORE-ATT match; try for SELECT-ATT match ]
        [only go forward if failed on a mixed-match]
        X2 DOES NOT HAVE NODE ATTRIBUTE NOT-FREE;
        [ In order for a retry to be a success it must be able to do a copy]
        [ For this to be allowed the X2 compatt must be an LN compatt]
        [ or in the other case the X1 compatt must be an RN compatt]
        IF TEST LOGIC SWITCH 1
        THEN IF TEST LOGIC SWITCH 2
        THEN FALSE [two comps]
        ELSE BOTH X1 HAS NODE ATTRIBUTE N-TO-RN-ATT
        AND $TRY-AGAIN-1
        ELSE IF NOT TEST LOGIC SWITCH 2
        THEN FALSE [two sels]
        ELSE BOTH X2 DOES NOT HAVE NODE ATTRIBUTE N-TO-RN-ATT
        AND $TRY-AGAIN-2;
        SET LOGIC SWITCH 9; [LS 9 - match made on SELECT ATTs]
        [ in the case of a retry it is necessary to have exact match]
        [ for a successful match because next step is to copy compatt]
        DO $EXACT-MATCH; [if true an exact match was found]
        SET LOGIC SWITCH 6; [LS 6 - an exact match]
        SET LOGIC SWITCH 19. [mark a retry]
   $TRY-AGAIN-1 =
        X1-COMPATT-SAV := X1-ATT;
        CORE-SELATT X1-ATT OF X1 EXISTS;
        CLEAR LOGIC SWITCH 11;
        IF SUCCESSORS OF X1-ATT IS NIL
        THEN SET LOGIC SWITCH 21
        ELSE CLEAR LOGIC SWITCH 21.
   $TRY-AGAIN-2 =
        X2-COMPATT-SAV := X2-ATT;
        CORE-SELATT X2-ATT OF X2 EXISTS;
        CLEAR LOGIC SWITCH 12;
        IF SUCCESSORS OF X2-ATT IS NIL
        THEN SET LOGIC SWITCH 22
        ELSE CLEAR LOGIC SWITCH 22.
   $FINISH-UP =
        DO $REASSIGN-ADJUST-SEL-COMP;
        IF TEST LOGIC SWITCH 19
        THEN $COPY-COMPATTS.
   $REASSIGN-ADJUST-SEL-COMP =
        [ if a selatt match assign the generated selatt to all the]
        [ nodes. These will all have the same top level atts but may]
        [ have differring sub-atts]
        [If the att used in the match tt had only one att item ]
        [no need to do operation]
        IF NOT TEST LOGIC SWITCH 21
        THEN $ADJUST-X1;
        IF NOT TEST LOGIC SWITCH 22
        THEN $ADJUST-X2;
        IF TEST LOGIC SWITCH 7
        THEN IF NOT TEST LOGIC SWITCH 23
        THEN $ADJUST-X3;
        IF TEST LOGIC SWITCH 10
        THEN IF NOT TEST LOGIC SWITCH 24
        THEN $ADJUST-X4.
   $ADJUST-X1 =
        XX := X1;
        XX-ATT := X1-ATT;
        XX-SELECT := X1-SELECT;
        IF TEST LOGIC SWITCH 1
        THEN SET LOGIC SWITCH 57
        ELSE CLEAR LOGIC SWITCH 57;
        IF TEST LOGIC SWITCH 11
        THEN SET LOGIC SWITCH 58
        ELSE BOTH CLEAR LOGIC SWITCH 58
        AND IF TEST LOGIC SWITCH 1
        THEN XX-SELECT := X1-COMP-SAV;
        EITHER $ADJUST-XX
        OR TRUE.
   $ADJUST-X2 =
        XX := X2;
        XX-ATT := X2-ATT;
        XX-SELECT := X2-SELECT;
        IF TEST LOGIC SWITCH 2
        THEN SET LOGIC SWITCH 57
        ELSE CLEAR LOGIC SWITCH 57;
        IF TEST LOGIC SWITCH 12
        THEN SET LOGIC SWITCH 58
        ELSE BOTH CLEAR LOGIC SWITCH 58
        AND IF TEST LOGIC SWITCH 2
        THEN XX-COMP-SAV := X2-COMP-SAV;
        EITHER $ADJUST-XX
        OR TRUE.
   $ADJUST-X3 =
        XX := X3;
        XX-ATT := X3-ATT;
        XX-SELECT := X3-SELECT;
        IF TEST LOGIC SWITCH 3
        THEN SET LOGIC SWITCH 57
        ELSE CLEAR LOGIC SWITCH 57;
        IF TEST LOGIC SWITCH 13
        THEN SET LOGIC SWITCH 58
        ELSE BOTH CLEAR LOGIC SWITCH 58
        AND IF TEST LOGIC SWITCH 3
        THEN XX-COMP-SAV := X3-COMP-SAV;
        EITHER $ADJUST-XX
        OR TRUE.
   $ADJUST-X4 =
        XX := X4;
        XX-ATT := X4-ATT;
        XX-SELECT := X4-SELECT;
        IF TEST LOGIC SWITCH 4
        THEN SET LOGIC SWITCH 57
        ELSE CLEAR LOGIC SWITCH 57;
        IF TEST LOGIC SWITCH 14
        THEN SET LOGIC SWITCH 58
        ELSE BOTH CLEAR LOGIC SWITCH 58
        AND IF TEST LOGIC SWITCH 4
        THEN XX-COMP-SAV := X4-COMP-SAV;
        EITHER $ADJUST-XX
        OR TRUE.
   $ADJUST-XX =
        FALSE;
        GO TO XX;
        IF TEST LOGIC SWITCH 58 [compatt used in match]
        THEN BOTH ASSIGN NODE ATTRIBUTE COMPUTED-ATT WITH VALUE XX-SELECT
        AND BOTH $PRUNE-SEL
        AND AT XX ASSIGN NODE ATTRIBUTE SELECT-ATT
        WITH VALUE X-PRU
        ELSE BOTH ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE XX-SELECT
        AND IF TEST LOGIC SWITCH 57 [there is a compatt]
        THEN BOTH $PRUNE-COMP
        AND AT XX ASSIGN NODE ATTRIBUTE COMPUTED-ATT
        WITH VALUE X-PRU.
   $PRUNE-SEL =
        [comp-att was used in match; prune sel-att]
        X-PRU := NIL;
        IF SUCCESSORS OF XX-SELECT IS NIL
        THEN $ONE-ATT-IN-COMP
        ELSE $MORE-ATT-IN-COMP.
   $ONE-ATT-IN-COMP =
        [ only one item in matched comp-att ]
        XX-SELECT HAS ATTRIBUTE-LIST X-TEMP;
        PREFIX X-TEMP TO X-PRU.
   $MORE-ATT-IN-COMP =
        ITERATE $ONE-ATT-IN-COMP
        UNTIL SUCCESSORS XX-SELECT OF XX-SELECT IS NIL SUCCEEDS.
   $PRUNE-COMP =
        [sel-att was used in match; prune comp-att]
        X-PRU := NIL;
        ITERATE $PRUN-LIST UNTIL SUCCESSORS XX-COMP-SAV
        OF XX-COMP-SAV IS NIL SUCCEEDS.
   $PRUN-LIST =
        XX-COMP-SAV HAS ATTRIBUTE-LIST X-TEMP;
        IF XX-SELECT HAS MEMBER X-TEMP
        THEN $ADD-COMP.
   $ADD-COMP =
        X-P3 := HEAD OF XX-COMP-SAV;
        PREFIX X-P3:X-TEMP TO X-PRU.
   $COPY-COMPATTS =
        EITHER $COPY-COMPATT-LN
        OR TRUE ;
        EITHER $COPY-COMPATT-RN
        OR TRUE.
   $COPY-COMPATT-LN =
        AT X-LN BOTH TPOS IS EMPTY
        AND QPOS IS EMPTY;
        [if the upper node has an LN-compatt and lower has no compatt]
        [copy the compatt to the lower node: 'broken arm and leg']
        NOT TEST LOGIC SWITCH 1; [no compatt on X1]
        X2 HAS NODE ATTRIBUTE N-TO-LN-ATT X-SAVE;
        AT X1 ASSIGN NODE ATTRIBUTE N-TO-LN-ATT WITH VALUE X-SAVE;
        X2 HAS NODE ATTRIBUTE COMPUTED-ATT X-SAVE;
        AT X1 ASSIGN NODE ATTRIBUTE COMPUTED-ATT WITH VALUE X-SAVE;
        SET LOGIC SWITCH 1; [LN compatt copied]
        SET LOGIC SWITCH 31.
   $COPY-COMPATT-RN =
        [ if the lower node has a compatt and upper has none copy the ]
        [ compatt to the upper node: 'arm and leg with edema']
        NOT TEST LOGIC SWITCH 2;
        TEST LOGIC SWITCH 1;
        DO $COPY-RN-X2;
        IF TEST LOGIC SWITCH 7
        THEN DO $COPY-COMPATT-RN-THIRD;
        IF TEST LOGIC SWITCH 10
        THEN DO $COPY-COMPATT-RN-FOURTH.
   $COPY-RN-X2 =
        X1 HAS NODE ATTRIBUTE N-TO-RN-ATT X-SAVE;
        AT X2 BOTH EITHER ERASE NODE ATTRIBUTE N-TO-LN-ATT
        OR TRUE
        AND ASSIGN NODE ATTRIBUTE N-TO-RN-ATT WITH VALUE X-SAVE;
        X1 HAS NODE ATTRIBUTE COMPUTED-ATT X-SAVE;
        AT X2 ASSIGN NODE ATTRIBUTE COMPUTED-ATT WITH VALUE X-SAVE;
        SET LOGIC SWITCH 2; [RN compatt copied]
        SET LOGIC SWITCH 32.
   $COPY-RN-X3 =
        X1 HAS NODE ATTRIBUTE N-TO-RN-ATT X-SAVE;
        AT X3 BOTH EITHER ERASE NODE ATTRIBUTE N-TO-LN-ATT
        OR TRUE
        AND ASSIGN NODE ATTRIBUTE N-TO-RN-ATT WITH VALUE X-SAVE;
        X1 HAS NODE ATTRIBUTE COMPUTED-ATT X-SAVE;
        AT X3 ASSIGN NODE ATTRIBUTE COMPUTED-ATT WITH VALUE X-SAVE;
        SET LOGIC SWITCH 3; [RN compatt copied]
        SET LOGIC SWITCH 33.
   $COPY-COMPATT-RN-THIRD = [copy comp-att from X2 to X3]
        NOT TEST LOGIC SWITCH 3;
        TEST LOGIC SWITCH 2;
        X2 HAS NODE ATTRIBUTE N-TO-RN-ATT X-SAVE;
        AT X3 ASSIGN NODE ATTRIBUTE N-TO-RN-ATT WITH VALUE X-SAVE;
        X2 HAS NODE ATTRIBUTE COMPUTED-ATT X-SAVE;
        AT X3 ASSIGN NODE ATTRIBUTE COMPUTED-ATT WITH VALUE X-SAVE;
        SET LOGIC SWITCH 3; [RN compatt copied]
        SET LOGIC SWITCH 33.
   $COPY-COMPATT-RN-FOURTH = [copy comp-att from X3 to X4]
        NOT TEST LOGIC SWITCH 4;
        TEST LOGIC SWITCH 3;
        X3 HAS NODE ATTRIBUTE N-TO-RN-ATT X-SAVE;
        AT X4 ASSIGN NODE ATTRIBUTE N-TO-RN-ATT WITH VALUE X-SAVE;
        X3 HAS NODE ATTRIBUTE COMPUTED-ATT X-SAVE;
        AT X4 ASSIGN NODE ATTRIBUTE COMPUTED-ATT WITH VALUE X-SAVE;
        SET LOGIC SWITCH 4; [RN compatt copied]
        SET LOGIC SWITCH 34.
   $TRY-MAKE-LINKC =
        CLEAR LOGIC SWITCH 20;
        IF BOTH TEST LOGIC SWITCH 6 [an exact match]
        AND TEST LOGIC SWITCH 9 [a selatt match]
        THEN SET LOGIC SWITCH 20; [exact match on selatts]
        DO $MAKE-LINKC.
   $MAKE-LINKC =
        IF TEST LOGIC SWITCH 20
        THEN EITHER $SET-LINKC-RN
        OR TRUE;
        EITHER $SET-LINKC-LN
        OR TRUE.
   $GET-LNS =
        AT IMMEDIATE NVAR OF X1 COELEMENT- LN X-LN EXISTS;
        [get the upper LN]
        CONJELEM X2-LN EXISTS.
   $SET-LINKC-RN =
        X2 DOES NOT HAVE NODE ATTRIBUTE N-TO-LN-ATT;
        X-RN IS NOT EMPTY;
        CONJELEM X2-RN EXISTS;
        X2-RN IS EMPTY;
        EITHER BOTH TEST LOGIC SWITCH 1 [X1 has compatt]
        AND BOTH TEST LOGIC SWITCH 32 [ copied comp att]
        AND X2 HAS NODE ATTRIBUTE N-TO-RN-ATT
        OR BOTH BOTH NOT TEST LOGIC SWITCH 1
        AND NOT TEST LOGIC SWITCH 2
        AND AT X-RN DO $CHECK-NO-LINK;
        AT X2-RN ASSIGN NODE ATTRIBUTE LINKC WITH VALUE X-RN.
   $CHECK-NO-LINK = ALL OF $DS, $PN [, $WHS-N].
   $DS = IT IS NOT THE CASE THAT ELEMENT- DS OF ELEMENT- RNOPTS EXISTS
        [don't copy a dose onto another med]
        ['Ecotrin, Isordil 10 mg 3 times daily' -/> 'Ecotrin 10 mg..'].
   $PN = IF ELEMENT- PN X-PN OF ELEMENT- RNOPTS EXISTS
        THEN AT X-PN ALL OF $PN-OF, $BODY-PART, $PN-WITH, $GENERIC,
   $PN-STATUS-POST.
   $PN-OF = ELEMENT- P X-P IS NOT 'OF'
        ['of' is usually a local modifier].
        ['blood pressure and volume of water in the body' -/> ]
        ['blood pressure of water in the body']
   $BODY-PART = CORE-ATT OF CORE- OF ELEMENT- NSTGO DOES NOT HAVE MEMBER
        H-PTPART OR H-PTAREA
        [to avoid 'fever in leg' from 'fever and pain in leg';]
        [needs refinement: true when upper N is whole-body symptom]
        [but not true otherwise: 'soreness in wrists and ankles'].
   $PN-WITH =
        [* 'choking and indigestion with rapid pulse']
        [* No LINKC to avoid 'choking with rapid pulse']
        NOT ALL OF $P-WITH, $PN-WITH-CORE, $HOST-WITH, $UPPER-HOST-WITH.
   $P-WITH = X-P IS 'WITH' OR 'WITHOUT'.
   $PN-WITH-CORE = CORE-ATT OF CORE- OF ELEMENT- NSTGO HAS MEMBER
        H-INDIC OR H-DIAG OR H-RESULT [rapid pulse].
   $HOST-WITH = CORE-ATT OF HOST- OF X-PN HAS MEMBER
        H-INDIC OR H-DIAG OR H-RESULT [indigestion].
   $UPPER-HOST-WITH = CORE-ATT OF HOST- OF X2-RN HAS MEMBER
        H-INDIC OR H-DIAG OR H-RESULT [choking].
   $GENERIC = NOT ALL OF $HOST-GEN, $PREP-GEN, $GEN
        [* In ' dysmetria and difficulty with tandem gait' dont set LINKC]
        [* because it allows generation of 'dysmetria (with tandem gait) ].
   $HOST-GEN = AT X-RN BOTH HOST- X-PN-HOST IS GENERIC [difficulty, problem]
        AND X-PN-HOST IS H-INDIC.
   $PREP-GEN = X-P IS 'WITH' OR 'WITHOUT'.
   $GEN = AT X2-RN BOTH HOST- IS H-INDIC
        AND HOST- IS NOT GENERIC [e.g. 'dysmetria'].
   $PN-STATUS-POST =
        BOTH X-P IS 'STATUS-POST' OR 'STATUS'_'POST' OR 'S'_'/'_'P'
        AND IF CORE-ATT OF HOST- OF X-PN HAS MEMBER H-INDIC OR H-DIAG
        OR H-RESULT
        THEN CORE-ATT OF CORE- OF ELEMENT- NSTGO OF X-PN DOES NOT HAVE
        MEMBER H-INDIC OR H-DIAG OR H-RESULT
        [* 'COPD, known CAD status post myocardial infarction']
        [* don't copy 'status post' PN to 'COPD']
        [+++ ns to add more restrictions].
   $SET-LINKC-LN =
        [X1 DOES NOT HAVE NODE ATTRIBUTE N-TO-RN-ATT;]
        EITHER X2-LN IS NOT EMPTY [++++ what is this about]
        OR TEST LOGIC SWITCH 7;[3 or more case ]
        DO $LINKC-LN-TPOS;
        X1 DOES NOT HAVE NODE ATTRIBUTE N-TO-RN-ATT; [moved 9/24/98]
        DO $LINKC-LN-NOT-TPOS. [ do the non TPOS's ]
   $LINKC-LN-TPOS =
        AT X-LN GO DOWN; STORE IN X1-STEP;[ get the TPOS ]
        AT X2-LN GO DOWN; STORE IN X2-STEP;
        IF X1-STEP IS NOT EMPTY [check termination ]
        [ ** exact match on selatts not needed for TPOS ]
        [ ** the article and the negative disribute over conjoined noun ]
        [ ** phrases 'No fever or broken limbs'-> 'no fever and no broken ]
        [ ** limbs', where fever and limbs are not exact match ]
        THEN IF X-COM-STEP IS NOT EMPTY [or both nodes are filled]
        THEN FALSE;
        IF X2-STEP IS NOT EMPTY
        THEN AT X1-STEP ASSIGN NODE ATTRIBUTE LINKC WITH VALUE X2-STEP
        ELSE EITHER $MAYBE-LINKC [upper is empty but could have LINKC ]
        OR TRUE.
   $LINKC-LN-NOT-TPOS =
        TEST LOGIC SWITCH 20 [ do the other POS's ];
        ITERATET IF X1-STEP IS NOT EMPTY
        THEN IF X1-STEP IS QPOS [check for termination ]
        THEN X-COM-STEP IS NOT EMPTY [or both nodes are filled]
        ELSE TRUE
        ELSE $SETLCLN
        UNTIL $STEP-X FAILS.
   $SETLCLN =
        IF X2-STEP IS NOT EMPTY
        THEN $MARK-LINKS-NOT-TPOS
        ELSE EITHER $MAYBE-LINKC [upper is empty but could have LINKC ]
        OR TRUE.
   $MAYBE-LINKC =
        TEST LOGIC SWITCH 7; [3 or more case ]
        X2-STEP HAS NODE ATTRIBUTE LINKC X-TEMP;
        AT X1-STEP ASSIGN NODE ATTRIBUTE LINKC WITH VALUE X-TEMP.
   $CHECK-TERMINATE =
        [false means lower TPOS or QPOS is filled do not proceed]
        IF EITHER X1-STEP IS TPOS
        OR X1-STEP IS QPOS
        THEN X-COM-STEP IS EMPTY. [or both nodes are filled]
   $MARK-LINKS-NOT-TPOS =
        IF X1-STEP IS APOS
        THEN $CHECK-APOS
        ELSE IF X1-STEP IS NPOS
        THEN $CHECK-NPOS.
   $CHECK-APOS =
        IF ONE OF $CHECK-APOS-CASE1,
   $CHECK-APOS-CASE2
        THEN AT X1-STEP ASSIGN NODE ATTRIBUTE LINKC
        WITH VALUE X2-STEP.
   $CHECK-APOS-CASE1 =
        TEST LOGIC SWITCH 2 [X2 has compatt];
        TEST LOGIC SWITCH 31 [copied comp att];
        X1 HAS NODE ATTRIBUTE N-TO-LN-ATT.
   $CHECK-APOS-CASE2 =
        NOT TEST LOGIC SWITCH 1;
        NOT TEST LOGIC SWITCH 2;
        AT X2-STEP NOT $CK-BODY-PART.
   $CHECK-NPOS =
        IF $CHECK-APOS-CASE1
        THEN AT X1-STEP ASSIGN NODE ATTRIBUTE LINKC
        WITH VALUE X2-STEP.
   $STEP-X =
        AT X1-STEP GO RIGHT;STORE IN X1-STEP;
        AT X2-STEP GO RIGHT;STORE IN X2-STEP.
   $CK-BODY-PART =
        CLEAR LOGIC SWITCH 30;
        GO DOWN; STORE IN X-ADJ-POS;
        [ iterate through all the ADJADJ's checking associated NVAR's ]
        [ The iterations terminates with true when no ADJADJ is below ]
        [ current one. It also ends with a failure if an NVAR is ]
        [ encountered which does not have BP. Switch 10 allows one to ]
        [ distinguish the two and set the proper return signal. It will]
        [ be clear if no NVAR's are encountered or if the NVAR does not]
        [ have a BP. It is set by a NVAR with BP. It cannot be reset ]
        [ because the loop will terminate if switch 10 goes from a set ]
        [ clear state ]
        EITHER ITERATET $ADJADJ-CK UNTIL X-ADJ-POS IS ADJADJ FAILS
        OR TRUE; [ need this to stay here in case of fail termination ]
        TEST LOGIC SWITCH 20.
   $ADJADJ-CK =
        [ Either below is an ADJADJ or LAR or else if adjadj check ]
        [ right LAR then check down; if LAR there do that if else done]
        IF BOTH GO RIGHT
        @AND PRESENT-ELEMENT- IS LAR
        @THEN $SELATT-BP;
        GO TO X-ADJ-POS; GO DOWN;
        STORE IN X-ADJ-POS;
        IF PRESENT-ELEMENT- IS LAR
        THEN $SELATT-BP.
   $SELATT-BP = [returns true if cannot get to AVAR or it has BP]
        [if the AVAR has a BP switch 10 will be set ]
        IF $MOVE-TO-AVAR
[if there are two modifiers then both must have a BP for]
[the unit to have the BP attribute ]
        THEN IF EITHER X-BP HAS MEMBER H-PTPART OR H-PTAREA
        [ if there is a conjunction modifier then check that as well]
        OR IF X-AVAR HAS NODE ATTRIBUTE POSTCONJELEM
        X-CONJ-ADJ
        THEN DO $CK-BP-CONJ
        THEN SET LOGIC SWITCH 30
        [ terminate iteration and mark for no BP ]
        ELSE BOTH CLEAR LOGIC SWITCH 30 AND FALSE.
   $MOVE-TO-AVAR =
        GO DOWN; PRESENT-ELEMENT- IS LA;
        GO RIGHT; PRESENT-ELEMENT- IS AVAR;
        STORE IN X-AVAR;
        GO DOWN;
        PRESENT-ELEMENT- HAS NODE ATTRIBUTE SELECT-ATT X-BP.
   $CK-BP-CONJ =
        GO TO X-CONJ-ADJ; GO DOWN;
        IF PRESENT-ELEMENT- HAS NODE ATTRIBUTE SELECT-ATT X-BP
        THEN IF X-BP HAS MEMBER H-PTPART OR H-PTAREA
        THEN SET LOGIC SWITCH 30
        [ terminate iteration and mark for no BP ]
        ELSE BOTH CLEAR LOGIC SWITCH 30 AND FALSE.
   $DEFER =
[++++ NS get LN RN COMP-ATT test here]
        CORE-ATT X1-ATT OF X1 EXISTS;
        X1-ATT HAS MEMBER [on list] N-COMP-ATT-RN;
        AT X-RN WORD FOLLOWING PRESENT NODE IS SPWORD;
        AT X1 ASSIGN NODE ATTRIBUTE DEFERRED.
   $SWAP-X1-X2 =
        X-SWAP := X1;
        X1 := X2;
        X2 := X-SWAP;
        IF TEST LOGIC SWITCH 1
        THEN SET LOGIC SWITCH 31;
        IF TEST LOGIC SWITCH 2
        THEN SET LOGIC SWITCH 1
        ELSE CLEAR LOGIC SWITCH 1;
        IF TEST LOGIC SWITCH 31
        THEN SET LOGIC SWITCH 2
        ELSE CLEAR LOGIC SWITCH 2.
   $THREE-MORE-CONJUNCTS =
        IF X2 HAS NODE ATTRIBUTE DEFERRED
        THEN IF X-RN IS EMPTY
        THEN $DEFER
        ELSE IF X1 HAS NODE ATTRIBUTE COMPUTED-ATT
        THEN $PROC-DEFER
        ELSE FALSE
        ELSE IF TEST LOGIC SWITCH 10
        THEN $FOUR-CONJUNCTS
        ELSE $THREE-CONJUNCTS.
   $PROC-DEFER =
        IF TEST LOGIC SWITCH 10
        THEN $FOUR-CONJ-DEFER
        ELSE $THREE-CONJ-DEFER.
   $FOUR-CONJ-DEFER =
        [ In the 4-conjunct case it is necessary to start by acertaining ]
        [ whether any of the middle conjunct nodes have been deferred by a ]
        [ previous WCONJ9 invocation. There are two allowed possibilities: ]
        [ Either both are deferred or only the right one (X2) is deferred. ]
        [ If only X2 is deferred then a 2-conjunct processing (as in the ]
        [ three case is done. If both are deferred ]
        [ done on the middle and lower conjuncts. This is needed so that ]
        [ a right conjunct may provide a COMPUTED-ATT which will allow a ]
        [ 3-way match to be done later. ]
        IF X3 HAS NODE ATTRIBUTE DEFERRED
        THEN $FOUR-BOTH-CONJ-DEFER
        ELSE $FOUR-ONE-CONJ-DEFER.
   $FOUR-ONE-CONJ-DEFER =
        CLEAR LOGIC SWITCH 10;
        DO $THREE-CONJ-TRY-COPY;
        BOTH $GET-ATTS-X4
        AND $GET-ATTS-X3;
        SET LOGIC SWITCH 10;
        DO $DO-FOUR-CONJ-AFTER-DEFER.
   $FOUR-BOTH-CONJ-DEFER =
        CORE-SELATT X1-ATT OF X1 EXISTS;
        IF SUCCESSORS OF X1-ATT IS NIL
        THEN SET LOGIC SWITCH 21;
        CORE-SELATT X2-ATT OF X2 EXISTS;
        IF SUCCESSORS OF X2-ATT IS NIL
        THEN SET LOGIC SWITCH 22;
        CORE-SELATT X3-ATT OF X3 EXISTS;
        IF SUCCESSORS OF X3-ATT IS NIL
        THEN SET LOGIC SWITCH 23;
        CLEAR LOGIC SWITCH 10; [look like a 3-case]
        DO $EXACT-MATCH;
        IF TEST LOGIC SWITCH 21
        THEN CORE-ATT X1-ATT OF X1 EXISTS
        ELSE $FIX-COMP1;
        SET LOGIC SWITCH 1;
        SET LOGIC SWITCH 11;
        X2-ATT := X1-ATT;
        SET LOGIC SWITCH 2;
        SET LOGIC SWITCH 12;
        X3-ATT := X1-ATT;
        SET LOGIC SWITCH 3;
        SET LOGIC SWITCH 13;
        SET LOGIC SWITCH 10;
        DO $GET-ATTS-X4;
        DO $DO-FOUR-CONJ-AFTER-DEFER-2.
   $DO-FOUR-CONJ-AFTER-DEFER=
        CLEAR LOGIC SWITCH 9; [selatt match]
        CLEAR LOGIC SWITCH 6; [exact match]
        DO $EXACT-OR-EQUIV-FOUR;
        SET LOGIC SWITCH 9; [selatt match]
        SET LOGIC SWITCH 6; [exact match]
        DO $REASSIGN-ADJUST-SEL-COMP;
        DO $CLEAR-X2-DEFER;
        DO $COPY-RN-X2;
        DO $SET-LINKC-RN.
   $DO-FOUR-CONJ-AFTER-DEFER-2 =
        CLEAR LOGIC SWITCH 9; [selatt match]
        CLEAR LOGIC SWITCH 6; [exact match]
        DO $EXACT-OR-EQUIV-FOUR;
        DO $REASSIGN-ADJUST-SEL-COMP;
        SET LOGIC SWITCH 9; [selatt match]
        SET LOGIC SWITCH 6; [selatt match]
        DO $CLEAR-X2-DEFER;
        DO $CLEAR-X3-DEFER;
        DO $COPY-RN-X2;
        DO $COPY-RN-X3;
        DO $SET-LINKC-RN-FOUR.
   $THREE-CONJ-DEFER =
        [ In the 3-conjunct case it is necessary to start by acertaining ]
        [ whether the middle conjunct node has been deferred by a previous ]
        [ WCONJ9 invocation. If so then a 2-conjunct processing must be ]
        [ done on the middle and lower conjuncts. This is needed so that ]
        [ a right conjunct may provide a COMPUTED-ATT which will allow a ]
        [ 3-way match to be done later. ]
        BOTH $THREE-CONJ-TRY-COPY
        AND $DO-THREE-CONJ-AFTER-DEFER.
   $THREE-CONJ-TRY-COPY =
        CORE-SELATT X1-ATT OF X1 EXISTS;
        IF SUCCESSORS OF X1-ATT IS NIL
        THEN SET LOGIC SWITCH 21;
        CORE-SELATT X2-ATT OF X2 EXISTS;
        IF SUCCESSORS OF X2-ATT IS NIL
        THEN SET LOGIC SWITCH 22;
        CLEAR LOGIC SWITCH 7;
        DO $EXACT-MATCH;
        IF TEST LOGIC SWITCH 21
        THEN CORE-ATT X1-ATT OF X1 EXISTS
        ELSE $FIX-COMP1;
        SET LOGIC SWITCH 1;
        SET LOGIC SWITCH 11;
        X2-ATT := X1-ATT;
        SET LOGIC SWITCH 2;
        SET LOGIC SWITCH 12;
        IF SUCCESSORS OF X1-ATT IS NIL
        THEN BOTH SET LOGIC SWITCH 21
        AND SET LOGIC SWITCH 22
        ELSE BOTH CLEAR LOGIC SWITCH 21
        AND CLEAR LOGIC SWITCH 22;
        SET LOGIC SWITCH 7.
   $FIX-COMP1 =
        CORE-ATT XX-COMP-SAV OF X1 EXISTS;
        XX-SELECT := X1-SELECT;
        DO $PRUNE-COMP;
        X1-ATT := X-PRU.
   $DO-THREE-CONJ-AFTER-DEFER=
        DO $GET-ATTS-X3;
        CLEAR LOGIC SWITCH 9; [selatt match]
        CLEAR LOGIC SWITCH 6; [exact match]
        ALL OF $EXACT-OR-EQUIV-THREE,
   $REASSIGN-ADJUST-SEL-COMP,
   $CLEAR-X2-DEFER,
   $COPY-RN-X2,
   $SET-LINKC-RN.
   $CLEAR-X2-DEFER =
        AT X2 ERASE NODE ATTRIBUTE DEFERRED.
   $CLEAR-X3-DEFER =
        AT X3 ERASE NODE ATTRIBUTE DEFERRED.
   $THREE-CONJUNCTS =
        IF $SUBCLASS-MATCH-THREE
        THEN ALL OF $GET-LNS-THREE,
   $FINISH-UP-THREE-OR-MORE,
   $TRY-MAKE-LINKC-THREE
        ELSE $DEFER.
   $SUBCLASS-MATCH-THREE =
        DO $GET-THE-ATTS ;
        IF BOTH NOT $EXACT-OR-EQUIV-THREE
        AND NOT TEST LOGIC SWITCH 30 [ not a defer case]
        THEN $TRY-AGAIN-THREE.
   $EXACT-OR-EQUIV-THREE =
        IF $EXACT-MATCH
        THEN BOTH SET LOGIC SWITCH 6
        AND IF $CHECK-DONE-THREE
        THEN TRUE
        ELSE $EQUIV-MATCH-THREE
        ELSE $EQUIV-MATCH-THREE.
   $CHECK-DONE-THREE =
        BOTH $CHECK-DONE
        AND TEST LOGIC SWITCH 23.
   $EQUIV-MATCH-THREE =
EQUIV-MATCH USING CONJ-EQUIV-CLASSES OF ATT-LISTS X1-ATT X2-ATT X3-ATT
        INTO X1-SELECT X2-SELECT X3-SELECT WITH REJECTION SET
        MAJOR-EQUIV-CLASSES;
GO TO X1-SELECT;
GO TO X2-SELECT;
GO TO X3-SELECT.
   $GET-LNS-THREE =
        DO $GET-LNS;
        CONJELEM X3-LN EXISTS.
   $FINISH-UP-THREE-OR-MORE =
        DO $REASSIGN-ADJUST-SEL-COMP;
        IF TEST LOGIC SWITCH 19
        THEN $COPY-COMPATTS.
— WCONJ9-DOCB
— IF THE MATCHING PROCESS FAILS WHEN USING THE HIGHEST LEVEL NODE
— ATTRIBUTE AVAILIBLE THERE IS THE POSSIBILITY THAT A MATCH IS POSSIBLE
— USING A LOWER LEVEL NODE ATTRIBUTE AT SOME OF THE NODES.
— IN THE THREE CONJUNCT CASE THERE ARE 8 CASES:
—       CASE X3 X2 X1 ACTION
—       1 C C C FAIL WCONJ9
—       2 C C S MAKE A 2-CONJUNCT ON X1,X2 WITH COPY
—       3 C S C FAIL WCONJ9
—       4 C S S FAIL WCONJ9
—       5 S C C FAIL WCONJ9
—       6 S C S MAKE A 2-CONJUNCT ON X1,X2 WITH COPY
—       7 S S C DO ALL SELATT MATCH-IE SELATT AT X1
—       8 S S S FAIL WCONJ9 LOWERING LEVEL NOT POSSIBLE
   $TRY-AGAIN-THREE =
        NOT TEST LOGIC SWITCH 16; [no retry, this was case 2 or 6]
        NOT TEST LOGIC SWITCH 9; [case 8 - all selatts done already]
        IF NOT TEST LOGIC SWITCH 1
        THEN IF TEST LOGIC SWITCH 2
        THEN $PROC-AS-2-CONJ-THREE [cases 2 and 6]
        ELSE FALSE [case 4]
        ELSE IF EITHER TEST LOGIC SWITCH 2
        OR TEST LOGIC SWITCH 3
        THEN FALSE [cases 1 and 3 and 5]
        ELSE $DROP-TO-SELS [case 7].
   $PROC-AS-2-CONJ-THREE =
        [ A compatt on X2 selatt on X1 analysis will fail so we proceed to]
        [ make s sel-sel one ++ NS fix up this]
        X2 HAS NODE ATTRIBUTE N-TO-LN-ATT X-TEMP;
        CLEAR LOGIC SWITCH 7;
        DO $TRY-AGAIN-TWO;
        DO $REASSIGN-ADJUST-SEL-COMP;
        AT X1 ASSIGN NODE ATTRIBUTE N-TO-LN-ATT WITH VALUE X-TEMP;
        X2 HAS NODE ATTRIBUTE COMPUTED-ATT X-TEMP;
        AT X1 ASSIGN NODE ATTRIBUTE COMPUTED-ATT WITH VALUE X-TEMP;
        SET LOGIC SWITCH 7;
        DO $GET-LNS;
        DO $TRY-MAKE-LINKC-THREE.
   $DROP-TO-SELS =
        X1 HAS NODE ATTRIBUTE N-TO-RN-ATT X-TEMP;
        DO $TRY-AGAIN-1;
        SET LOGIC SWITCH 9;
        DO $EXACT-MATCH;
        SET LOGIC SWITCH 6.
   $TRY-MAKE-LINKC-THREE =
        CLEAR LOGIC SWITCH 20;
        IF BOTH TEST LOGIC SWITCH 6 [an exact match]
        AND TEST LOGIC SWITCH 9 [a selatt match]
        THEN SET LOGIC SWITCH 20;
        DO $MAKE-LINKC-THREE;
        [ if no APOS QPOS LINKC was made because of X3-X2 matching ]
        [ see if exact match was made or could be made on X1-X2 sels ]
        IF NOT TEST LOGIC SWITCH 20
        THEN $TRY-PART-LINKC-LOWER-TWO.
   $TRY-PART-LINKC-LOWER-TWO =
        [was an exact match made using selatts on X1 and X2]
        IF BOTH TEST LOGIC SWITCH 29 [X1 X2 exact match]
        AND BOTH NOT TEST LOGIC SWITCH 11 [and only sels used]
        AND NOT TEST LOGIC SWITCH 12 [compatt use on X3]
        THEN BOTH SET LOGIC SWITCH 20 [ do not LINKC on TPOS done ]
        AND $MAKE-LINKC-NOT-TPOS [treat as a two case]
        ELSE $TRY-EXACT-MATCH-ON-SELS.
   $TRY-EXACT-MATCH-ON-SELS =
        IF TEST LOGIC SWITCH 11 [comp att used in match]
        THEN $TRY-AGAIN-1
        ELSE $TRY-AGAIN-2;
        CLEAR LOGIC SWITCH 20;
        IF $EXACT-MATCH
        THEN BOTH SET LOGIC SWITCH 20
        AND $MAKE-LINKC.
   $MAKE-LINKC-THREE =
        IF TEST LOGIC SWITCH 20 [an exact match on selatts]
        THEN EITHER $SET-LINKC-RN-THREE
        OR TRUE;
        EITHER $SET-LINKC-LN
        OR TRUE.
   $SET-LINKC-RN-THREE =
        DO $SET-LINKC-RN;
        AT X2-RN CONJELEM X3-RN EXISTS;
        PRESENT-ELEMENT- IS EMPTY;
        EITHER BOTH TEST LOGIC SWITCH 1 [X1 has compatt]
        AND BOTH TEST LOGIC SWITCH 33 [ copied comp att]
        AND X3 HAS NODE ATTRIBUTE N-TO-RN-ATT
        OR BOTH BOTH NOT TEST LOGIC SWITCH 1
        AND NOT TEST LOGIC SWITCH 3
        AND AT X-RN DO $CHECK-NO-LINK;
        AT X3-RN ASSIGN NODE ATTRIBUTE LINKC WITH VALUE X-RN.
   $MAKE-LINKC-NOT-TPOS =
        AT X-LN GO DOWN; STORE IN X1-STEP;[ get the TPOS ]
        AT X2-LN GO DOWN; STORE IN X2-STEP;
        DO $LINKC-LN-NOT-TPOS.
   $ASSIGN-COMPATT-THREE =
        [ the comp-att from X3 ]
        NOT TEST LOGIC SWITCH 1;
        NOT TEST LOGIC SWITCH 2;
        TEST LOGIC SWITCH 3;
        X3 HAS NODE ATTRIBUTE COMPUTED-ATT XT-COMPATT;
        AT X1 ASSIGN NODE ATTRIBUTE COMPUTED-ATT WITH VALUE XT-COMPATT.
   $FOUR-CONJUNCTS =
        IF $SUBCLASS-MATCH-FOUR
        THEN ALL OF $GET-LNS-FOUR,
   $FINISH-UP-THREE-OR-MORE,
   $TRY-MAKE-LINKC-FOUR
        ELSE $DEFER.
   $SUBCLASS-MATCH-FOUR =
        DO $GET-THE-ATTS ;
        IF BOTH NOT $EXACT-OR-EQUIV-FOUR
        AND NOT TEST LOGIC SWITCH 30 [ not a defer case]
        THEN $TRY-AGAIN-FOUR.
   $EXACT-OR-EQUIV-FOUR =
        IF $EXACT-MATCH
        THEN BOTH SET LOGIC SWITCH 6
        AND IF $CHECK-DONE-FOUR
        THEN TRUE
        ELSE $EQUIV-MATCH-FOUR
        ELSE $EQUIV-MATCH-FOUR.
   $CHECK-DONE-FOUR =
        BOTH $CHECK-DONE-THREE
        AND TEST LOGIC SWITCH 24.
   $EQUIV-MATCH-FOUR =
EQUIV-MATCH USING CONJ-EQUIV-CLASSES OF ATT-LISTS X1-ATT X2-ATT X3-ATT X4-ATT
        INTO X1-SELECT X2-SELECT X3-SELECT X4-SELECT WITH REJECTION SET
        MAJOR-EQUIV-CLASSES;
GO TO X1-SELECT;
GO TO X2-SELECT;
GO TO X3-SELECT;
GO TO X4-SELECT.
   $GET-LNS-FOUR =
        DO $GET-LNS-THREE;
        CONJELEM X4-LN EXISTS.
— CASE X4 X3 X2 X1 ACTION
—       1 C C C C FAIL
—       2 C C C S MAKE A 2-CONJ ON X1,X2
—       3 C C S C FAIL
—       4 C C S S FAIL
—       5 C S C C FAIL
—       6 C S C S MAKE A 2-CONJ ON X1,X2
—       7 C S S C FAIL
—       8 C S S S FAIL
—       9 S C C C FAIL
—       10 S C C S MAKE A 2-CONJ ON X1,X2
—       11 S C S C FAIL
—       12 S C S S FAIL
—       13 S S C C FAIL
—       14 S S C S MAKE A 2-CONJ ON X1,X2
—       15 S S S C DO ALL SELATT MATCH, THEN
—       16 S S S S FAIL
   $TRY-AGAIN-FOUR =
        IF BOTH NOT TEST LOGIC SWITCH 1
        AND TEST LOGIC SWITCH 2
        THEN $PROC-AS-2-CONJ-FOUR [case 2,6,10,14]
        ELSE IF EITHER TEST LOGIC SWITCH 3
        OR TEST LOGIC SWITCH 4
        THEN FALSE [case 1,3,4,5,7,8,9,11,12,13]
        ELSE $DROP-TO-SELS [case 15].
   $PROC-AS-2-CONJ-FOUR =
        [ A compatt on X2 selatt on X1 analysis will fail so we proceed to]
        [ make s sel-sel one ++ NS fix up this]
        X2 HAS NODE ATTRIBUTE N-TO-LN-ATT X-TEMP;
        CLEAR LOGIC SWITCH 7;
        CLEAR LOGIC SWITCH 10;
        DO $TRY-AGAIN-TWO;
        DO $REASSIGN-ADJUST-SEL-COMP;
        AT X1 ASSIGN NODE ATTRIBUTE N-TO-LN-ATT WITH VALUE X-TEMP;
        X2 HAS NODE ATTRIBUTE COMPUTED-ATT X-TEMP;
        AT X1 ASSIGN NODE ATTRIBUTE COMPUTED-ATT WITH VALUE X-TEMP;
        SET LOGIC SWITCH 7;
        SET LOGIC SWITCH 10;
        DO $GET-LNS;
        DO $TRY-MAKE-LINKC-FOUR.
   $TRY-MAKE-LINKC-FOUR =
        CLEAR LOGIC SWITCH 20;
        IF BOTH TEST LOGIC SWITCH 6
        AND TEST LOGIC SWITCH 9
        THEN SET LOGIC SWITCH 20;
        DO $MAKE-LINKC-FOUR;
        [ if no APOS QPOS NPOS LINKC was made because of X4-X3 matching ]
        [ see if exact match was made or could be made on X1-X2 sels ]
        IF NOT TEST LOGIC SWITCH 20
        THEN $TRY-PART-LINKC-LOWER-TWO.
   $MAKE-LINKC-FOUR =
        IF TEST LOGIC SWITCH 20
        THEN EITHER $SET-LINKC-RN-FOUR
        OR TRUE;
        EITHER $SET-LINKC-LN
        OR TRUE.
   $SET-LINKC-RN-FOUR =
        DO $SET-LINKC-RN-THREE;
        AT X3-RN CONJELEM X4-RN EXISTS;
        PRESENT-ELEMENT- IS EMPTY;
        EITHER BOTH TEST LOGIC SWITCH 1 [X1 has compatt]
        AND BOTH TEST LOGIC SWITCH 34 [ copied comp att]
        AND X4 HAS NODE ATTRIBUTE N-TO-RN-ATT
        OR BOTH BOTH NOT TEST LOGIC SWITCH 1
        AND NOT TEST LOGIC SWITCH 4
        AND AT X-RN DO $CHECK-NO-LINK;
        AT X4-RN ASSIGN NODE ATTRIBUTE LINKC WITH VALUE X-RN.
   $ASSIGN-COMPATT-FOUR =
        [ the comp-att from X4 ]
        NOT TEST LOGIC SWITCH 1;
        NOT TEST LOGIC SWITCH 2;
        NOT TEST LOGIC SWITCH 3;
        TEST LOGIC SWITCH 4;
        X4 HAS NODE ATTRIBUTE COMPUTED-ATT XT-COMPATT;
        AT X1 ASSIGN NODE ATTRIBUTE COMPUTED-ATT WITH VALUE XT-COMPATT.
WCONJ10 =
        [* Force conjoined OBJECTBE to mirror upper OBJECTBE with some OBJBE]
        [* variation]
        [* 7/11/00 In OBJECTBE. VINGO only with VINGO; VENPASS only with VENPASS]
        [* 7/11/00 Not VINGO or VENPASS conjoined with OBJBE. Maybe too tight. ]
        [* E.g. not VINGO='gardening' conjoined to OBJBE->ASTG->VEN='noticed' in]
        [* 'She says that she has been gardening more and noticed ...' ]
        [* 1/10/02 Not OBJBE conjoined with THATS: In 'She says her cholesterol ]
        [* has been satisfactory and that she has a high HDL level' no conjunct ]
        [* of 'satisfactory' with 'that she has a high HDL level'. ]
        [* X1 = lower OBJECTBE, X3 = value of lower OBJBE]
        [* X2 = upper OBJECTBE, X4 = value of upper OBJBE]
        IN Q-CONJ:
        IF ELEMENT- OBJECT X-OBJ EXISTS
        WHERE BOTH VALUE X1 IS OBJECTBE AND NOT $FULL-STRING
        THEN BOTH $MATCH-OBJECTBE AND $MATCH-OBJBE.
   $FULL-STRING =
        GO LEFT [OBJECT IN Q-CONJ HAS PREVIOUS ELEMENT].
   $MATCH-OBJECTBE =
        AT X-OBJ VALUE X2 OF CONJELEM- IS X1 [ONLY OBJECTBE CONJ OBJECTBE];
        IF VALUE OF X1 IS VENPASS
        THEN VALUE OF X2 IS VENPASS;
        IF VALUE OF X1 IS VINGO
        THEN VALUE OF X2 IS VINGO;
        IF VALUE OF X1 IS OBJBE
        THEN VALUE OF X2 IS NOT THATS;
        IF VALUE OF X1 IS THATS
        THEN VALUE OF X2 IS NOT OBJBE.
   $MATCH-OBJBE = AT X1
        IF ELEMENT- OBJBE EXISTS WHERE VALUE X3 EXISTS
        THEN ALL OF $OBJBE, $ASTG, $NSTG, $OBJPN, $QUANT, $LDR.
   $OBJBE =
        AT X2 EITHER VALUE [OF UPPER OBJECTBE] IS OBJBE
        WHERE VALUE X4 EXISTS
        OR VALUE OF X2 IS VENPASS [OR VINGO]
        WHERE BOTH CORE- OF LVENR IS 'BASED'
        AND X3 IS PN WHERE P IS 'OF'
        [edema is based on venous insufficiency and is of mild degree].
   $ASTG = IF X3 IS ASTG
        THEN EITHER X4 IS ASTG OR PN OR QUANT OR PQUANT
        OR VALUE OF X2 IS VENPASS OR VINGO.
   $NSTG = IF X3 IS NSTG
        THEN BOTH X4 IS NSTG [OR ASTG]
        AND [IF X4 IS NSTG]
        [THEN] DO $EXACT-OR-EQUIV.
   $EXACT-OR-EQUIV = IF $NOT-EXACT-NIL THEN $EQUIV
        [code adapted from WCONJ9].
   $NOT-EXACT-NIL = NOT $EXACT-NIL.
   $EXACT-NIL = CORE-ATT X1-ATT OF CORE- OF X3 EXISTS;
        CORE-ATT X2-ATT OF CORE- OF X4 EXISTS;
        INTERSECT X1-ATT OF X2-ATT IS NIL.
   $EQUIV =
        CLEAR LOGIC SWITCH 3;
        X1-REST:= X1-ATT;
        ITERATE $EQUIV-MATCH-LOOP UNTIL SUCCESSORS X1-REST OF X1-REST
        IS NIL SUCCEEDS;
        TEST LOGIC SWITCH 3.
   $EQUIV-MATCH-LOOP =
        X-EQUIV-LIST:= LIST CONJ-EQUIV-CLASSES;
        X1-HEAD:= HEAD OF X1-REST;
        EITHER $MATCH-SUBCLASSES OR TRUE.
   $MATCH-SUBCLASSES =
        IF $HAS-EQUIV-CLASS
        THEN $MATCH-X2-ATT. [find match for X2 also]
        [* If X1-REST is not on any EQUIV-CLASS then the only way ]
        [* it can get on the select list requires an exact match ]
        [* If this is the case then this attrib will have been ]
        [* picked up in the exact match analysis. ]
   $HAS-EQUIV-CLASS =
        [find first EQUIV-CLASS X1-ATT is on]
        ITERATET $THROUGH-EQUIV-LIST UNTIL $AT-EQUIV-CLASS SUCCEEDS.
   $THROUGH-EQUIV-LIST =
        SUCCESSORS X-EQUIV-LIST OF X-EQUIV-LIST IS NOT NIL.
        [go to next EQUIV-CLASS in EQUIV-LIST]
   $AT-EQUIV-CLASS =
        HEAD X-EQUIV-CLASS OF X-EQUIV-LIST HAS MEMBER X1-HEAD
        [X1-ATT is in this EQUIV-CLASS].
   $MATCH-X2-ATT =
        [Go through EQUIV-LIST until both X1-ATT and X2-ATT have
        match in EQUIV-CLASS]

        X-NEWLIST:= X2-ATT;
        IF ITERATET $FIND-NEXT-EQUIV UNTIL $FOUND-MATCH SUCCEEDS
        [if one gets a first find then do the X1 only once]
        [ X2 processing got done in the iteration]
        THEN SET LOGIC SWITCH 3.
   $FIND-NEXT-EQUIV =
        ITERATE $THROUGH-EQUIV-LIST UNTIL $AT-EQUIV-CLASS SUCCEEDS.
   $FOUND-MATCH =
        INTERSECT X-REST-INT OF X-EQUIV-CLASS IS NOT NIL.
   $OBJPN = IF X3 IS PN
        THEN EITHER X4 IS PN OR ASTG OR QUANT OR PQUANT
        OR AT X2 [upper OBJECTBE] VALUE IS VINGO OR VENPASS
        [She was hyperventilating and in distress].
   $QUANT = IF X3 IS QUANT OR PQUANT
        THEN X4 IS QUANT OR PQUANT OR ASTG.
   $LDR = IF X3 IS LDR
        THEN X4 IS LDR.
WCONJ10A =
        [* WCONJ10 adapted for objbe as string element]
        IN Q-CONJ:
        IF ELEMENT- OBJBE X1 EXISTS WHERE CONJELEM- X2 EXISTS
        THEN ALL OF $SETUP, $ASTG, $NSTG, $OBJPN, $QUANT.
   $SETUP =
        BOTH VALUE X3 OF X1 EXISTS AND VALUE X4 OF X2 EXISTS.
   $ASTG = IF X3 IS ASTG
        THEN EITHER X4 IS ASTG OR PN OR QUANT OR PQUANT
        OR VALUE OF X2 IS VENPASS OR VINGO.
   $NSTG = IF X3 IS NSTG THEN X4 IS NSTG.
   $OBJPN = IF X3 IS PN THEN X4 IS PN OR ASTG OR QUANT OR PQUANT.
   $QUANT = IF X3 IS QUANT OR PQUANT
        THEN X4 IS QUANT OR PQUANT OR ASTG.
WCONJ11 =
        [* Rule out funny conjunct with 'ON' or 'VOUS' or 'NOUS'. ]
        [* NHUMAN can be conjunct of NHUMAN or H-INST: 'Diagnosed ]
        [* by rehab and referring physicians' ]
        IN Q-CONJ:
        IF ELEMENT- NVAR X1 EXISTS WHERE CORE IS NHUMAN [physicians]
        THEN AT X1 CORE X2 OF CONJELEM- IS NHUMAN OR H-INST [rehab].
WCONJ11A =
        [* Rule out funny conjunct with any pronoun;]
        [* PRO conjoins PRO unless in SUBJECT ]
        IN Q-CONJ:
        IF ELEMENT- NVAR X1 EXISTS WHERE
        BOTH CORE X11 IS PRO
        AND X11 IS NOT OCCURRING AS SUBJECT
        THEN AT X1 CORE X2 OF CONJELEM- IS PRO.
WCONJ12 =
        [* Disallow LN CONJ LN for CONJ = COMMA. The following word ]
        [* sequence does not contain 2 LN's on 'dysfunction': ]
        [* 'dilated left atrium , moderate global lv dysfunction' ]
        [* 9/17/98 Possibly valid for other CONJ; possibly needs ]
        [* further constraints. ]
        IN Q-CONJ: IF BOTH IMMEDIATE-NODE IS COMMASTG
        @AND [at COMMASTG] IMMEDIATE-NODE IS LN X1
        THEN IN X1 CORE OF NPOS IS H-TXVAR
        [Urea, electrolytes and full blood count results are normal].
WCONJ13 =
        [* LNR BUT LNR requires an H-NEG somewhere: *ankle but knee ]
        [* OK: 'in ankle but not knee'; OK 'not ankle but knee', not]
        [* provided for in this restriction. ]
        [* 10/16/01 In 'He was discharged but presented again with similar pain']
        [* must disallow LVENR CONJ LVENR 'discharged but presented' to avoid ]
        [* 'discharged with similar pain'. Could restrict CONJ to 'but' (?). ]
        IN BUTSTG: BOTH IF ELEMENT- Q-CONJ HAS ELEMENT NVAR
        THEN BUTSTG SUBSUMES ADJ OR D OR N OR T:H-NEG
        AND IF CORE- OF ELEMENT- Q-CONJ IS VEN X1
        WHERE CORE- OF CONJELEM IS VEN X2
        THEN BOTH IF X1 IS H-PTVERB
        THEN X2 IS NOT H-TTGEN
        [discharged but presented]
        AND IF X1 IS H-TTGEN
        THEN X2 IS NOT H-PTVERB
        [example?].
WCONJ14 =
        [* Do not accept a conjunct having computed attribute of the ]
        [* H-CHANGE type if conjunct is a word itself part of an ]
        [* H-CHANGE type, i.e. is value of N-TO-RN-ATT of H-CHANGE. Cf]
        [* 001B.08.01 The patient has not noticed any recent increase ]
        [* in edema or change in pillow orthopnea over three weeks. ]
        [* To prevent '..increase in change in pillow orthpnea' on ]
        [* conjunction expansion, force 'change in ..' to be conjoined]
        [* at higher level: 'increase in edema or change in pillow...']
        IN LNR:
        IT IS NOT THE CASE THAT $CHANGE-OF-CHANGE IS TRUE.
   $CHANGE-OF-CHANGE =
        CORE- X-CORE [increase] OF PRESENT-ELEMENT- X-LNR IS H-CHANGE
        OR H-CHANGE-MORE OR H-CHANGE-LESS OR H-CHANGE-SAME;
        X-CORE HAS NODE ATTRIBUTE N-TO-RN-ATT
        [WITH VALUE X-VAL new RLS to come];
        AT X-LNR CORE- OF ELEMENT- RN IS PN X-PN [increase in edema];
        AT X-PN CORE-CONJUNCT X-CONJCORE [change] OF CORE- X-VAL [edema]
        OF NSTGO EXISTS;
        X-CONJCORE IS N:H-CHANGE OR H-CHANGE-MORE OR H-CHANGE-LESS OR
        H-CHANGE-SAME;
        X-CONJCORE HAS NODE ATTRIBUTE COMPUTED-ATT [change in orthopnea].
WCONJ15 =
        [* Do not accept a conjunct in LAR where the conjoined ADJ have ]
        [* incompatible medical classes, eg 'afebrile , systolic' ]
        [* X-ADJ1 is upper ADJ; X-ADJ2 is lower ADJ. to be generalized. ]
        [* Also do similar test in ADJADJ with punctuation ','. ]
        IN LAR: BOTH $1 AND $2.
   $1 = PRESENT-ELEMENT- X-LAR EXISTS;
        IF BOTH CORE- X-ADJ1 OF ELEMENT- AVAR IS H-NORMAL [afebrile/normal]
        AND X-ADJ1 HAS CORE-CONJUNCT X-ADJ2
        THEN X-ADJ2 IS NOT H-INDIC [unlikely: 'normal, feverish state'].
   $2 = IF AT X-LAR COELEMENT- ADJADJ X-ADJADJ EXISTS
        [in recursive structure]
        WHERE CORE- X-ADJ1 OF ELEMENT- LAR IS H-NORMAL
        THEN EITHER CORE- X-ADJ2 OF X-LAR IS 'CLINICAL'
        [unremarkable clinical course]
        OR X-ADJ2 IS NOT H-INDIC [unlikely: 'normal feverish state'].
WCONJ15A =
        [* Do not accept a conjunct in LAR where the conjoined ADJ have ]
        [* incompatible medical subclasses or values; e.g. one ADJ has a ]
        [* medical class and the other has H-NULL, e.g. 'right' H-PTAREA ]
        [* conjoined with 'only' H-NULL in 'Ankles show 1+ pitting edema]
        [* on the right and only trace edema on the left'. ]
        [* X-ADJ1 is upper ADJ; X-ADJ2 is lower ADJ. to be generalized. ]
        [* Also do not accept same ADJ's in ADJADJ with punctuation ','. ]
        [* In 'central monitoring, and arterial line monitoring' we don't]
        [* want a conjunct in APOS of 'monitoring, and arterial'. ]
        IN ADJADJ: IF $SETUP THEN [BOTH] $1 [AND $2 conflict WCONJ4A].
   $SETUP = CORE-ATT X1 OF CORE- X-ADJ1 EXISTS;
        CORE-CONJUNCT X-ADJ2 OF X-ADJ1 EXISTS;
        CORE-ATT X2 OF X-ADJ2 EXISTS.
   $1 = BOTH IF X1 HAS MEMBER H-NULL
        THEN X2 HAS MEMBER H-NULL
        AND IF X2 HAS MEMBER H-NULL
        THEN X1 HAS MEMBER H-NULL.
   $2 = BOTH IF X1 HAS MEMBER H-TXPROC [monitoring]
        THEN X2 DOES NOT HAVE MEMBER H-PTPART [arterial]
        AND IF X2 HAS MEMBER H-TXPROC
        THEN X1 DOES NOT HAVE MEMBER H-PTPART.
WCONJ15B =
        [* Restricts conjoined APOS in LN CONJ LN. Not ADJ CONJ QN]
        [* as cores of APOS: ]
        [* In 'Catheterization then revealed minor irregularities ]
        [* of the left main and a 95 % stenosis at the mid LAD' ]
        [* avoid LN AND LN = 'the left main and a 95 %' modifying ]
        [* 'stenosis'. ]
        [* Note: LEFT_MAIN in dict is ADJ as well as N for e.g. ]
        [* 'left main or 3-vessel CAD' where '3-vessel' is ADJ. ]
        IN Q-CONJ:
        IF BOTH CORE- OF ELEMENT- APOS X-LOWER IS QN [95 %]
        AND IMMEDIATE-NODE IS ANDSTG OR ORSTG OR COMMASTG
        THEN AT CONJELEM OF X-LOWER
        CORE- IS NOT ADJ: H-PTPART [left main].
WCONJ15C =
        [* Similar constraint as in WCONJ15B but applied in recursive ]
        [* ADJADJ with punctuation ',' instead of comma-conj. In this ]
        [* case the 2 entities in ADJADJ are LAR ('left circumflex') ]
        [* and QPERUNIT ('a 50 - 75 %'). The sentence: ]
        [* 'Catheterization then revealed minor irregularities of the ]
        [* left main and a 95 % stenosis at the mid LAD , a 50 % ostial ]
        [* stenosis of the D3 , a 25 % stenosis of the left circumflex ,]
        [* a 50 - 75 % stenosis at the mid RCA level and an ejection ]
        [* fraction of 63 %'. We wish to avoid a "pile-up format" ]
        [* containing ' Catheterization then revealed a 25 % stenosis of]
        [* the left circumflex , a 50 - 75 % stenosis at the mid RCA level']
        IN ADJADJ:
        IF VALUE IS ADJADJ X-ADJADJ
        [in recursive structure]
        WHERE COELEMENT- QPERUNIT EXISTS
        ['a 50 - 75 %' in the example]
        THEN CORE- OF X-ADJADJ IS NOT ADJ: H-PTPART
        ['left circumflex' in the example].
WCONJ16 =
        [* Special for: 'Initially started on Floxtat, and after second day of]
        [* therapy developed severe vomiting, diarrhea, and abdominal pain.' ]
        [* Prevent double initial SA + comma ('Initially started on Floxtat,')]
        [* conjoined to time phrase ('after second day...'); makes bad HIU's. ]
        IN Q-CONJ: NOT BOTH $HEAVY-SA AND $TIME-CONJUNCT.
   $HEAVY-SA = AT IMMEDIATE ANDSTG
        COELEMENT- SA EXISTS;
        EITHER ELEMENT- SA EXISTS WHERE IT- IS NOT EMPTY
        [double SA hence "heavy"]
        OR CORE- IS OF TYPE STRING
        [hence "heavy"].
   $TIME-CONJUNCT = VALUE [of Q-CONJ] IS SA;
        DO CORE-;
        STORE IN X-CORE;
        X-CORE IS PN;
        BOTH X-CORE HAS NODE ATTRIBUTE PHRASE-ATT X-PH-ATT
        AND X-PH-ATT HAS MEMBER TIME-PHRASE.
WCONJ17 =
        [* Disallow QN CONJ QN for CONJ = COMMA or AND if the nouns are]
        [* 'feet' and 'inches'. Do not create 2 HIUs ('height 5 feet' ]
        [* and 'height 3 inches' from 'height 5 feet , 3 inches'. ]
        IN Q-CONJ: NOT ALL OF $1, $2, $3.
   $1 = PRESENT-ELEMENT- X3 EXISTS;
        IMMEDIATE-NODE IS COMMASTG OR ANDSTG
        WHERE IMMEDIATE-NODE IS QN X1.
   $2 = IN X1 ELEMENT- N IS 'FEET'.
   $3 = IN X3 ELEMENT- N IS 'INCHES'.
WCONJ18 =
        [* Disallow P CONJ P in PN for CONJ = COMMA or AND if the Ps are]
        [* 'throughout' and 'without': In 'pulses are 2+ throughout and ]
        [* without bruits', do not create false 'throughout bruits'. ]
        IN Q-CONJ: NOT ALL OF $1, $2, $3.
   $1 = PRESENT-ELEMENT- X3 EXISTS;
        IMMEDIATE-NODE IS COMMASTG OR ANDSTG
        WHERE IMMEDIATE-NODE IS PN X1.
   $2 = IN X1 ELEMENT- P IS 'THROUGHOUT'.
   $3 = IN X3 ELEMENT- P IS 'WITHOUT'.
WCONJ20 =
        [* Disallow N CONJ N in NVAR in LNR for CONJ = COMMA/OR/AND if the Ns ]
        [* are incompatible PTPARTs to associate with specific symptom words. ]
        [* OK:'ears and sinus problems'; but don't conjoin 'ears' and 'sinus' ]
        [* in 'Unremarkable for ringing in the ears or sinus problems'.Parse ]
        [* gets 'Unremarkable for ringing in the ears or sinus', finds another]
        [* place for 'problems'. Use attrb NOT-FREE attached to 'ears'. It is ]
        [* assigned when the first PTPART is in an adjunct of an INDIC. Other ]
        [* conditions besides NOT-FREE are needed, e.g. host INDIC should not ]
        [* be GENERIC: OK 'problems in ears and sinus'.Need anatomic subets ]
        IN Q-CONJ: IF $PRE
        THEN $TEST-WORDS.
   $PRE = PRESENT-ELEMENT- X3 EXISTS;
        IMMEDIATE-NODE IS COMMASTG OR ANDSTG OR ORSTG;
        IMMEDIATE-NODE IS LNR X1;
        VALUE X4 [lower N] OF ELEMENT- NVAR OF X3 IS N:H-PTPART;
        CONJELEM X2 [upper N] OF X4 IS N:H-PTPART;
        X2 HAS NODE ATTRIBUTE NOT-FREE;
        X2 IS OCCURRING IN PN WHERE HOST- X-HOST IS H-INDIC;
        X-HOST IS NOT GENERIC.
$TEST-WORDS = IF X4 IS 'SINUS'
        THEN X2 IS NOT 'EARS'.
WCONJ21 =
        [* Disallow N1 CONJ N2 (for CONJ=',' or 'and') if N1 is an artery-name ]
        [* and N2 is the name of a vessel used to make a surgical bypass graft,]
        [* and if the word following N2 is 'to'. We are probably in a CABG sent]
        [* containing sequences of: graft-word 'to' artery-word ('SVG to OM2').]
        [* In 'CABG x 3 00/00/1997 with SVG to OM2 and PDA , LIMA to the LAD' ]
        [* without WCONJ21 we get HIUs: 'SVG to OM2'; 'SVG to PDA' - both of ]
        [* these are medically OK - but also 2 HIUs 'SVG to SVG to PDA' and ]
        [* 'SVG to SVG to LIMA to LAD' instead of a 3rd HIU 'LIMA to LAD'. ]
        [* The COMMA-CONJUNCT 'LIMA to LAD has to be on the same level of the ]
        [* parse tree as 'SVG TO OM2 and PDA', so we reject 'PDA' CONJ 'LIMA'.]
        [* NOTE: We here extend the notion of a sublanguage attribute to apply ]
        [* to words used in a particular way in a medical specialty or ]
        [* procedure. In this case the description of the cardiology procedure ]
        [* Coronary Artery Bypass Grafting (CABG) links the names of vessels ]
        [* forming the graft to the names of arteries receiving the graft, e.g.]
        [* 'LIMA to LAD'. In the dictionary the former receive the sublanguage ]
        [* attribute H-CARD-GRAFT, and the latter H-CARD-ARTERY. To keep track ]
        [* of these classes we maintain in the grammar LIST WCONJ21-GRAFT and ]
        [* LIST WCONJ21-ARTERY; these lists are called upon in WCONJ21. ]
        IN Q-CONJ:
        IF BOTH CORE- X1 OF NVAR HAS ATTRIBUTE H-CARD-GRAFT
        [X1 is N 'LIMA' of example, LIMA=left interior mammary artery]
        AND AT X1 WORD FOLLOWING PRESENT NODE IS 'TO'
        THEN IT IS NOT THE CASE THAT IMMEDIATE-NODE- [of Q-CONJ] IS COMMASTG
        OR ANDSTG
        WHERE CORE- X3 OF COELEMENT- NVAR HAS ATTRIBUTE H-CARD-ARTERY
        [X3 is N 'PDA' of example; PDA=posterior descending artery].
WCONJ22 =
        [* Disallow LNR CONJ LNR (for CONJ=',' or 'and') if lower N is ]
        [* 'history' and upper N is H-INDIC or H-DIAG in a PN itself an ]
        [* adjunct of 'history'. Avoids double history in an HIU, as in ]
        [* 'This patient is a 70 year old white female with a history of ]
        [* intermittent atrial fibrillation , history of coronary artery ]
        [* disease']
        IN Q-CONJ:
        IF CORE- X1 OF NVAR IS 'HISTORY'
        [in example, 'history' in 'history of 'coronary artery disease']
        THEN IF PRESENT-ELEMENT- [Q-CONJ] IS OCCURRING IN COMMASTG OR ANDSTG
        WHERE BOTH CORE- OF COELEMENT- NVAR X-NVAR IS H-INDIC
        OR H-DIAG ['atrial fibrillation' of example]
        AND X-NVAR IS OCCURRING IN PN X-PN
        WHERE ELEMENT- P IS 'OF'
        THEN IF HOST OF X-PN EXISTS@
        THEN PRESENT-ELEMENT- [host of X-PN] IS NOT 'HISTORY'
        ['history' in 'history of intermittent atrial fibrillation'].
— EKG RESTRICTIONS

DOPT-E1 =
        [* EKGSTG restriction]
        IN EKGSTG:
        EITHER THERE IS A N:E-LEAD AHEAD
        OR THERE IS A N:E-WV OR E-INTVL OR E-AX AHEAD.
DPOS-E1 =
        [* Restrict second RWVOPTS after first RWVOPTS = IN-LEADS. ]
        [* Second RWVOPTS if after a comma should not be QUANT. ]
        [* In '4 mm ST depression in L , 5 mm to 6 mm ST depression ]
        [* V2 through V5' we do not want the stretch '5 mm to 6 mm ]
        [* depression V2 through V5' to be second RWV -> RWVOPTS -> ]
        [* QUANT.]
        IN RWVOPTS RE QUANT:
        BOTH PRECEDING WORD IS ','
        AND BOTH IF PRESENT-ELEMENT- IS OCCURRING IN RWV
        WHERE COELEMENT- RWVOPTS EXISTS@
        THEN VALUE IS NOT IN-LEADS
        AND IF CONJELEM OF PRESENT-ELEMENT- EXISTS@
        THEN VALUE IS NOT IN-LEADS.
DPOS-E2 =
        [* Restrict VENPASS in RWVOPTS if HOST is N:E-LEAD. = 'I' ]
        [* 'I' is not to be N:E-LEAD in WVVAR if followed VEN:VSENT1, ]
        [* VSENT2, VSENT3 (and probably other classes), eg 'I thought']
        [* in 'pauses that I thought I was hearing'.]
        IN RWVOPTS RE VENPASS:
        IF HOST- IS 'I'
        THEN CURRENT WORD IS NOT VEN:VSENT1 OR VSENT2 OR VSENT3.
WPOS-E1 =
        [* Restrict *P in first element of IN-LEADS to one of ]
        [* 'in'/'on'/'at'/'over'/'across' (across precordial leads).]
        IN IN-LEADS AFTER FIRST ELEMENT:
        IF FIRST ELEMENT IS P @
        THEN IT- IS 'IN' OR 'ON' OR 'OVER' OR 'AT' OR 'ACROSS'.
WPOS-E2 =
        [* Allow *NULL in place of *P in first element of IN-LEADS only ]
        [* if followed by N or ADJ or D with attrb E-LEAD: ]
        [* '2 mm ST depressions leads V2 through V4', ('leads' is E-LEAD)]
        [* 'T wave inversions L, V2, V6', 'tall P-waves V4-V6', 'ST elev-]
        [* ations inferior leads', 'ST depressions laterally'. ]
        IN IN-LEADS AFTER FIRST ELEMENT:
        IF FIRST ELEMENT IS EMPTY
        THEN ONE OF $2, $3, $4.
   $2 = CURRENT WORD IS ADJ: E-LEAD [lateral, anterior, inferior].
   $3 = CURRENT WORD IS N: E-LEAD [L, V2, V6].
   $4 = CURRENT WORD IS D: E-LEAD [laterally].
WPOS-E3 =
        [* Restrict N in LWVR to an EKG word or to a pred word where ]
        [* either LN subsumes an EKG word or N is followed by such ]
        [* a word.]
        [* Note that E-LEAD is an EKG word but not a 'wave variant'. ]
        [* Hence it should not be the object of H-SHOW (e.g. 'showed']
        [* in 'Catheterization showed 2 out of 3 vessels occluded'), ]
        [* where one reading would have '2' analyzed as E-LEAD. ]
        IN WVVAR AFTER N:
        EITHER BOTH CORE-ATT X-COREATT OF ELEMENT- N HAS MEMBER E-WV
        OR E-INTVL OR E-AX OR E-LEAD
        [Right-sided EKG leads showed 1 mm elevation in lead V4-R]
        AND BOTH IF X-COREATT HAS MEMBER E-INTVL
        THEN IF IN COELEMENT- LN
        CORE- OF APOS IS QN@
        THEN ELEMENT- N IS NOT NTIME1
        [4 year interval =/E-INTVL]
        AND IF X-COREATT HAS MEMBER E-LEAD
        THEN X-COREATT IS NOT OCCURRING IN OBJECT
        WHERE CORE- OF COELEMENT VERB IS H-SHOW
        [Catheterization showed 2 out of 3 vessels occluded]
        OR BOTH X-COREATT HAS MEMBER H-CHANGE OR H-CHANGE-MORE
        OR H-CHANGE-LESS OR H-INDIC OR H-TXRES OR H-DESCR
        AND EITHER $LEFT OR $RIGHT.
   $LEFT = AT ELEMENT- NPOS OF COELEMENT- LN
        EITHER VALUE IS N:E-WV OR E-INTVL OR E-AX [Q-wave inversion]
        OR VALUE IS NNN WHERE VALUE IS N:E-WV OR E-INTVL OR E-AX
        [ST segment depression].
   $RIGHT = BOTH CURRENT WORD X1 IS 'OF' OR 'IN' [syntax from WPOS68]
        AND AT X1 NEXT WORD IS N:E-WV OR E-INTVL OR E-AX.
WPOS-E4 =
        [* Restricts N in options of LEADVAR to be N:E-LEAD:'V2 through V4']
        [* Restricts N in options of LEADVAR not to be N:E-LEAD for '1' if ]
        [* '1' should be taken as Q in QN, as in 'ST elevation in V2 , 1 TO]
        [* 2 MMS ST ELEVATION IN V1 AND V5'. ]
        IN LEADVAR: BOTH $1 AND $2.
   $1 = IF VALUE IS '1' OR '2' OR '3'
        THEN BOTH CURRENT WORD IS NOT N:NUNIT [1 mm ST depression]
        AND IF CURRENT WORD IS 'TO'
        THEN NEXT WORD IS NOT Q:QNUMBER [2 to 3 mm elevation].
   $2 = BOTH VALUE IS N:E-LEAD [1st element of all options in LEADVAR]
        AND IF THIRD ELEMENT X1 EXISTS@
        THEN BOTH PRESENT-ELEMENT- IS N:E-LEAD [V2 through V4]
        AND DO $ASSIGN-SEL.
   $ASSIGN-SEL = X-NEWLIST := CORE-SELATT OF X1;
        X-ELEAD := SYMBOL E-LEAD;
        X-NELEAD := NIL;
        PREFIX X-ELEAD TO X-NELEAD;
        X-NEWATT := INTERSECT OF X-NELEAD;
        AT X1 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-NEWATT.
WPOS-E5 =
        [* Restricts LLEADR so that LN does not capture part of a preceding]
        [* LWVR. In '4 mm ST depression in L , 5 mm to 6 mm ST depression ]
        [* V2 through V5' we do not want the LEADVAR = 'V2 through V5' to ]
        [* have LN = 'L , 5 mm to 6 mm ST depression'. LLEADR should not ]
        [* contain words with EKG attributes other than E-LEAD. ]
        IN LLEADR AFTER LEADVAR:
        IT IS NOT THE CASE THAT PRESENT-ELEMENT- SUBSUMES
        N: E-AX OR E-EKGPROC OR E-INTVL OR E-WV.
WPOS-E6 =
        [* Restrict conjoining of the end of one EKGSTG with beginning of ]
        [* another. E.g. in 'This showed flattening of T-waves in 1 , 2 , ]
        [* and F and slight inversion of T-waves in V5 and V6' there should]
        [* not be a conjoining of 'T-waves' and 'inversion' resulting in an]
        [* HIU with 'flattening inversion'. ]
        IN WVVAR AFTER N: IF $1 THEN NOT $2.
   $1 = PRESENT-ELEMENT- X3 EXISTS;
        CORE-ATT OF VALUE HAS MEMBER H-CHANGE OR H-CHANGE-MORE
        OR H-CHANGE-LESS OR H-INDIC OR H-TXRES OR H-DESCR;
        [e.g. 'inversion' H-TXRES]
        CONJELEM X4 OF X3 EXISTS; [upper WVVAR]
        X4 IS OCCURRING IN PN [e.g. 'of T-waves']
        WHERE BOTH P IS 'OF'
        AND CORE-ATT OF HOST- HAS MEMBER H-CHANGE OR H-CHANGE-MORE
        OR H-CHANGE-LESS OR H-INDIC OR H-TXRES OR H-DESCR
        [e.g. 'flattening' H-CHANGE-LESS].
   $2 = VALUE OF X4 IS E-AX OR E-EKGPROC OR E-INTVL OR E-WV
        [e.g. 'T-waves'].
WPOS-E7 =
        IN AVAR AFTER ADJ:
        [* Avoid taking 'L' as ADJ:H-PTAREA in LN in LLEADR where it ]
        [* should be N:E-LEAD, as in '4 mm ST depression in L , 5 mm ]
        [* to 6 mm ST depression in V2' ]
        IF VALUE IS 'L' [H-PTAREA = abbrev for 'left']
        THEN IMMEDIATE LN IS NOT OCCURRING IN LLEADR.
WPOS-E8 =
        IN LVENR AFTER VEN:
        [* Avoid taking VEN as verb when it should be left adjunct VEN ]
        [* in APOS preceding E-WV. In 'She had flipped T's in V4' the ]
        [* VEN 'flipped' is not part of a verb phrase 'had flipped'. ]
        [* The patient did not flip T's as in: 'She flipped pancakes'. ]
        IF VEN IS H-TXRES OR H-CHANGE-MORE OR H-CHANGE-LESS
        THEN CURRENT WORD IS NOT E-WV.
WPOS-E9 =
        [* Restrict 'I' not to be N:E-LEAD in LWVR in EKGSTG in ]
        [* SUBJECT; 'I' should be PRO in NVAR. Also do not accept]
        [* 'I' as N:E-LEAD in LWVR in OBJECT.]
        IN WVVAR AFTER N:
        NOT BOTH N IS 'I'
        AND BOTH N IS E-LEAD
        AND PRESENT-ELEMENT- IS OCCURRING IN SUBJECT OR OBJECT.
WPOS-E10 =
        [* Restrict 'I' not to be N:E-LEAD in NVAR in SUBJECT where ]
        [* 'I' should be PRO. Also do not accept it in OBJECT. Possibly]
        [* this has to be modified to account for an occurrence in ]
        [* EKGSTG, cf 2nd 'I' in 'It did not pick up the PVCs or the ]
        [* pauses that I thought I was hearing'.]
        IN NVAR AFTER N:
        VALUE IS NOT 'I'.
— MIN-WORD RESTRICTIONS

DMIN1 = IN SAOPTS, RNOPTS, RV RE PN:
        IF $MINPAR
        THEN THE CURRENT WORD IS NOT MAT:N: SAOPTS OR RNOPTS OR RV.
   $MINPAR = THIS IS THE MIN WORD.
DMIN2 =
        IN LT, LQ RE D:
        IF $MINPAR
        THEN THE CURRENT WORD IS NOT MAT:D: LV OR RV OR LT OR LQ.
DMIN2A =
        IN SAOPTS, LV, LA, RV RE LDR:
        IF $MINPAR
        THEN THE CURRENT WORD IS NOT MAT:D: SAOPTS.
DMIN3 =
        IN SAOPTS RE SUB1:
        IF $MINPAR
        THEN THE CURRENT WORD IS NOT MAT:SUB1: SAOPTS.
DMIN4 =
        IN SAOPTS RE NSTGT:
        IF $MINPAR
        THEN THE CURRENT WORD IS NOT MAT:NSTGT:SAOPTS.
— DMIN5 -- REMOVED 5/12/97 WHEN INT REMOVED FROM GRAMMAR & DICT
DMIN6 =
        IN SAOPTS RE TOVO:
        IF $MINPAR
        THEN THE CURRENT WORD IS NOT MAT:TOVO:SAOPTS.
— NOUN PHRASE RESTRICTIONS

DN50 =
        [* The right adjunct S-N is "a trap" if allowed in SA - swallows]
        [* all remaining words before NULLWH is disallowed ($NOT-SA). ]
        [* The right adjunct S-N is disallowed unless the first element ]
        [* is (a) a non definitely accusative pronoun (a book they read)]
        [* or (b) an article but not 'a' (the view the man held) or (c) ]
        [* a proper or chemical name (the book John reads). Also, ]
        [* S-N must not be within yet another S-N, and if S-N adjoins a ]
        [* noun phrase, then in the left adjuncts of the host N either ]
        [* QPOS is not empty or TPOS is not empty; but T is not TDEM or ]
        [* INDEF or TPOSS: in 'since her last clinic visit she continues]
        [* to...' the part 'she continues to...' is not S-N on 'visit' ]
        [* preceded by 'her' (TPOSS). OK 'the visit she described was..']
        [* less likely 'her visit she described was ..' ]
        IN RNOPTS RE OPTION S-N: ALL OF $NOT-SA, $FIRST, $HOST, $S-N.
   $NOT-SA = NOT $SA.
   $SA = ASCEND TO SAOPTS PASSING THROUGH STRING.
   $FIRST = ONE OF $PRO, $T IS TRUE.
   $PRO = EITHER BOTH THE CURRENT WORD X1 IS PRO
        AND X1 IS NOT ACCUSATIVE
        OR X1 IS D:DLTPRO.
   $T = BOTH X1 IS T
        AND X1 IS NOT 'A'.
   $HOST = HOST- X10 IS N OR PRO [PRO restricted; DN51];
        CORE-ATT DOES NOT HAVE MEMBER NTIME1 OR H-TMLOC OR H-TMDUR
        OR H-TMREP;
        IF X10 IS N
        @THEN
        EITHER BOTH X10 IS PLURAL [symptoms we saw today]
        AND X10 IS GENERIC
        [symptoms, problems; maybe too tight]
        OR IN LEFT-ADJUNCT OF X10 [in LN]
        BOTH EITHER APOS IS NOT EMPTY
        [status post five-vessel bypass , she says]
        OR EITHER TPOS X2 IS NOT EMPTY
        [since her last clinic visit she continues to...]
        OR QPOS IS NOT EMPTY
        AND CORE- OF TPOS IS NOT TDEM OR INDEF
        [that,this,these,those; a,an].
   $S-N = PRESENT-ELEMENT- IS NOT OCCURRING IN S-N.
DN51 =
        [* Block 'he who..' etc. but OK 'the one that..'; 'any of these' ]
        [* Also, NTIME2 ('yesterday', 'today', 'tomorrow') take no right ]
        [* adjuncts: In 'She is scheduled to see Radiation Oncology later ]
        [* today to discuss radiation' the phrase 'to discuss radiation' ]
        [* is not an adjunct of 'today'. Exception: a time adjunct WHENS. ]
        IN RN RE RNOPTS:
        BOTH IF HOST X1 IS PRO
        THEN EITHER X1 IS 'ONE' OR 'OTHER' OR 'ALL' [all that apply]
        OR X1 IS INDEFINITE
        AND IF X1 IS NTIME2
        THEN CURRENT WORD IS 'WHEN'.
DN52 =
        [* No APPOS on APPOS; stregthen to disallow all RNOPTS in APPOS ]
        [* and set RN to nil if next to RNOPTS whose value is APPOS. ]
        [* Note: In the first test the RN is beneath APPOS; in the 2nd ]
        [* second test the RN is a possible second adjunct in above RN. ]
        [* 3/10/2002 Second test prevents parse of:'Pacemaker , VVI , ]
        [* for sinus bradycardia' by disallowing 'for sinus bradycardia']
        [* as second RN on 'Pacemaker'. Comment out til needed. ]
        IN RN RE RNOPTS:
        [BOTH] PRESENT-ELEMENT- IS NOT OCCURRING IN APPOS
        [AND IF COELEMENT- RNOPTS EXISTS @]
        [ THEN VALUE IS NOT APPOS].
WN4 =
        [* OK: 'all the tests' ('all'=Q:QALL); not OK: 'two the tests']
        IN LT AFTER Q:
        Q IS QALL OR QHALF.
WN8 =
        IN NPOS AFTER OPTION NNN :
        [* 5/22/00 Must have empty NPOS if current words is '.' or ';'.]
        [* Noun left adjunct of noun is (usually) not plural; ]
        [* 4/4/96 must allow some plurals since not using APPOS in RN. ]
        [* 9/17/97 disallow NNN = N:H-TTMED followed by DS. DS IS CORE.]
        [* 5/22/00 disallow NNN = 'PERCENT' or `PER CENT' preceded by Q]
        [* Force e.g. '8 percent' to be QN.]
        CURRENT WORD IS NOT '.' OR ';' [avoid needless LNR computations];
        BOTH IF CORE X1 IS N
        THEN $PLURAL
        AND BOTH IF X1 IS DS
        THEN NOT $MEDDOSE
        AND IF X1 IS 'PERCENT' OR 'PER'_'CENT'
        THEN WORD PRECEDING PRESENT NODE IS NOT Q.
   $PLURAL = IF X1 IS PLURAL
        THEN EITHER X1 IS H-TXVAR
        [electrolytes results are normal]
        OR X1 IS 'LEADS' [electrocardiogram:'leads V2-V4']
        OR 'EYES' OR 'EARS'
        [head, eyes, ears, nose, throat examination].
   $MEDDOSE = AT X1 GO LEFT;
        TEST FOR NNN;
        ELEMENT- N HAS ATTRIBUTE H-TTMED.
WN11 =
        [* No left adjuncts of pronouns - simple WN11 MDPAR6]
        IN LNR AFTER NVAR:
        IF CORE X4 IS PRO
        THEN BOTH IF X4 IS 'THAT' OR 'THIS' OR 'ONE'
        THEN IF BOTH CURRENT WORD IS N
        AND IMMEDIATE SUBJECT EXISTS
        THEN EITHER CURRENT WORD IS [also] TV OR W
        [eg 'this needs to be done']
        [eg 'this MAY be degenerative']
        OR IF BOTH CURRENT WORD IS N
        AND IMMEDIATE NSTGT EXISTS
        THEN CURRENT WORD IS N:NTIME2
        [* allow 'I have done this today'; 'today' NTIME2]
        AND EITHER X4 IS 'ONE' [each one was negative]
        OR IN LEFT-ADJUNCT OF X4 [* each that was negative]
        ALL OF $TPOSNULL, $QPOS-BOTH, $APOSNULL, $NPOSNULL.
   $TPOSNULL = TPOS IS EMPTY.
   $QPOS-BOTH = EITHER QPOS X3 IS EMPTY
        OR CORE- OF X3 IS 'BOTH' ['Both he and his wife'].
   $APOSNULL = APOS IS EMPTY.
   $NPOSNULL = NPOS IS EMPTY.
WN50 =
        [* Conditions for accepting an Adjective as RN.]
        IN RNOPTS, RNSUBJ AFTER ADJINRN:
        BOTH ALL OF $VEN-VING, $ABOVE, $A-LITTLE, $PRIOR
        AND ONE OF $LIT, $LEFTADJ, $RIGHTADJ, $ATT, $CONJOIN, $INDEF IS TRUE.
   $VEN-VING = THE CORE- X1 OF ADJINRN IS NOT VEN OR VING.
   $ABOVE = NOT BOTH
        AT X1
        WORD STARTING PRESENT NODE IS [also] P
        [e.g. 'above']
        AND CURRENT WORD IS Q [above 90 %] OR ADJ OR N.
   $A-LITTLE = AT X1
        NOT BOTH WORD STARTING PRESENT NODE IS D:DLA
        AND WORD STARTING PRESENT NODE IS ADJ [a_little]
        [force 'a little' to be adverb in LA].
   $PRIOR = IF X1 IS 'PRIOR'
        THEN RIGHT-ADJUNCT OF X1 IS EMPTY
        [In 'Pt admitted the day prior with MI' ]
        [RA of 'prior' =/ 'with MI'. ].
   $LIT = X1 IS 'PALPABLE'
        [no adenopathy palpable].
   $LEFTADJ = BOTH X1 HAS LEFT-ADJUNCT X2,
        AND X2 IS NOT EMPTY.
   $RIGHTADJ = BOTH X1 HAS RIGHT-ADJUNCT X2
        WHERE PRESENT-ELEMENT- IS NOT EMPTY
        AND IF X1 IS 'LEFT'
        THEN IT IS NOT THE CASE THAT
        BOTH HOST- X1 IS H-PT
        AND X1 IS OCCURRING IN SUBJECT
        [In 'The patient left against medical advice']
        ['left' is verb not ADJ. ].
   $ATT = ONE OF $AINRN, $ANATOMY, $AMT, $COMPARATIVE.
   $AINRN = BOTH X1 IS AINRN
        AND PRESENT-ELEMENT- IS NOT OCCURRING IN RNSUBJ [too short].
   $ANATOMY = BOTH X1 IS H-PTAREA OR H-PTPART
        AND BOTH CURRENT WORD IS NOT N: H-PTPART OR H-PTAREA
        AND CORE-ATT OF HOST HAS MEMBER H-INDIC OR H-DIAG OR
        H-PTPART OR H-PTAREA.
   $AMT = BOTH X1 IS ADJ: H-AMT [orthopnea, two-pillow]
        AND BOTH CORE-ATT OF HOST HAS MEMBER H-INDIC OR H-DIAG
        AND CURRENT WORD IS NOT N:H-INDIC OR H-TXRES
        OR H-DIAG OR H-PTMEAS OR H-TXVAR
        [fever, two-pillow orthopnea (two-pillow=/ADJINRN].
   $COMPARATIVE = X1 IS ADJ: COMPARATIVE [for a while LONGER].
   $INDEF = THE HOST IS PRO:INDEFINITE.
   $CONJOIN = AT X1,
        BOTH IMMEDIATE AVAR EXISTS @
        AND ITERATE GO RIGHT UNTIL $CONJ-TEST SUCCEEDS.
   $CONJ-TEST = PRESENT-ELEMENT- IS OF TYPE CONJ-NODE
        WHERE ELEMENT- Q-CONJ EXISTS.
— NULLC RESTRICTIONS
— DNULLC-INDEX
— DNULLC1 SUBJECT MUST BE NULLC
— DNULLC2 SUBJECT CAN BE NULLC
— DNULLC3 TENSE CAN BE NULLC
— DNULLC4 VERB CANNOT BE NULLC
— DNULLC5 VERB CAN BE NULLC
— DNULLC6 OBJECT CAN BE NULLC
— DNULLC7 NSTGO CAN BE NULLC
— DNULLC8 NSTGO MUST BE NULLC
DNULLC1 =
        [* Subject must be NULLC (not other options) when preconjelem is ]
        [* NULLWH ]
        IN SUBJECT RE NSTG, NULLWH: NOT $1.
   $1 = CONJELEM- HAS VALUE NULLWH.
DNULLC2 =
        [* Subject can be NULLC in Q-CONJ; must be followed by W/TV/V: ]
        [* 'She has fever and () will be admitted' ]
        [* 'She had fever and () was admitted' ]
        [* 'She will be admitted and () have surgery'. ]
        IN SUBJECT RE NULLC:
        IMMEDIATE-NODE- IS Q-CONJ;
        CURRENT WORD IS W OR TV OR V.
DNULLC3 =
        [* NULLC in TENSE is needed for conjoined infinitive in ASSERTION ]
        [* as tested in WVC1: 'Patient will be admitted and have MRI'. ]
        [* Also want TENSE=NULLC (not NULL) when followed by TV in Q-CONJ ]
        [* so pointers will be correct and so WVC1 is simpler. ]
        IN TENSE RE NULLC:
        IMMEDIATE-NODE- X1 IS Q-CONJ;
        EITHER BOTH ELEMENT- SUBJECT X2 IS NOT EMPTY [She went and he too]
        AND EITHER $1 OR $2 IS TRUE
        OR X2 HAS VALUE NULLC ['Patient will be admitted and have MRI'].
   $1 = AT X2 GO RIGHT;
        SA IS NOT EMPTY.
   $2 = AT X1 IMMEDIATE-NODE- IS ASWELLASSTG [X was normal as well as Y]
        OR INADDITIONTOSTG
        [on Mevacor, Isordil and Cardizem in addition to aspirin]
        [9/5/2002 - why should TENSE = NULLC in this case?? ].
DNULLC4 =
        [* Restrictions on NULLFRAG option of VERB should not be ]
        [* circumvented in conjunct by accepting NULLC instead. ]
        IN VERB RE NULLC:
        IF CONJELEM X1 EXISTS
        THEN VALUE OF X1 IS NOT NULLFRAG.
DNULLC5 =
        [* Subj-Vb-O CONJ Subj is allowed only if Subj and SA are not empty:]
        [* 'He left and she too, He left and also she', *'He left and she'. ]
        [* 5/29/97 OK empty SA if CONJ is AS_WELL_AS: 'Lasix was stopped as ]
        [* well as captopril'. ]
        [* Another case of VERB=NULLC is where SUBJ=NULLC & TENSE=NULLC; ]
        [* TENSE is tested in WVC1:'Patient will be admitted and have MRI'. ]
        [* 7/29/98 Too broad; allow only AS_WELL_AS as CONJ. ]
        [* 5/28/02 Also allow IN_ADDITION_TO as CONJ: 'Aspirin was given in ]
        [* addition to captopril'. ]
        IN VERB RE NULLC:
        IMMEDIATE-NODE- IS Q-CONJ X1;
        IMMEDIATE-NODE- IS ASWELLASSTG OR INADDITIONTOSTG;
        IN X1 [Q-CONJ]
        EITHER BOTH ELEMENT- SUBJECT X2 IS NOT EMPTY
        AND EITHER $1 OR $2 IS TRUE
        OR BOTH ELEMENT- TENSE HAS VALUE NULLC
        AND ELEMENT- SUBJECT HAS VALUE NULLC.
   $1 = AT X2 GO RIGHT;
        SA IS NOT EMPTY.
   $2 = AT X1 IMMEDIATE-NODE- IS ASWELLASSTG OR INADDITIONTOSTG.
DNULLC6 =
        IN OBJECT RE NULLC:
        IMMEDIATE-NODE- IS Q-CONJ;
        VALUE OF VERB IS NULLC.
DNULLC7 =
        IN NSTGO RE NULLC: BOTH $OBJ AND $PN.
   $OBJ =
        [* 'The pain that she felt and reported';]
        [* *'She felt pain and reported.' ]
        BOTH IMMEDIATE Q-CONJ EXISTS
        AND AT IMMEDIATE OBJECT CONJELEM- HAS VALUE NULLWH.
   $PN =
        [* Must be under conjunction but PN and P NULLC is not ok; ]
        [* also P NULLWH and P NULLC ia rare. *'The man whom we talked]
        [* to and about']
        NEITHER IMMEDIATE PN EXISTS NOR IMMEDIATE Q-CONJ EXISTS.
DNULLC8 =
        [* Object must be NULLC (not other options) when preconjelem is]
        [* NULLWH]
        IN NSTGO RE NULLWH:
        IF IMMEDIATE OBJECT EXISTS WHERE CONJELEM- X1 EXISTS
        THEN CORE OF X1 IS NOT NULLWH.
— OPTIMIZATION RESTRICTIONS
DOPT1 =
        [* VING restriction]
        IN VINGO, PSVINGO, PVINGO, SVINGO, NPVINGO, TQVINGO:
        THERE IS A VING AHEAD.
— DOPT2 REMOVED; COVERED (BETTER) BY WPOS21
DOPT3 =
        [* Avoid getting into ASSERTION, BESHOW, etc.instead of INTRODUCER]
        [* when the current word is ':']
        IN LNR RE LN:
        CURRENT WORD IS NOT ':'.
— DOPT4 FRENCH
— DOPT5 FRENCH
DOPT6 =
        IN RWV RE RWVOPTS:
        CURRENT WORD IS NOT '.' OR ';' OR '-' OR ':'.
DOPT7 =
        IN RN RE RNOPTS:
        BOTH CURRENT WORD X1 IS NOT '.' OR ';' OR '-' OR ':' OR ','
        AND BOTH X1 IS NOT TV:VBE OR VHAVE OR VDO
        AND X1 IS NOT 'YEAR'_'OLD'
        [needed for endless backup on long history sentences ]
        [starting 'Patient is an 85 year old female with ...'.].
DOPT7A =
        IN SA, SA-LAST RE SAOPTS:
        BOTH CURRENT WORD X1 IS NOT '.' OR ';' OR '-' OR ':'
        AND BOTH X1 IS NOT TV:VBE OR VHAVE OR VDO
        AND X1 IS NOT 'YEAR'_'OLD'
        [needed for endless backup on long history sentences ]
        [starting 'Patient is an 85 year old female with ...'.].
DOPT7B =
        IN APOS RE ADJADJ:
        ALL OF $1, $2, $3, $4.
   $1 = CURRENT WORD IS NOT '.' OR ';' OR ','
        OR 'WHO' OR 'WHICH' OR 'THAT'.
   $2 = CURRENT WORD IS NOT TV:VBE OR VHAVE OR VDO.
   $3 = IF CURRENT WORD X1 IS PRO [in particular 'one' or 'the_above']
        THEN EITHER X1 IS [also] Q [allow 'one month' =QN in ADJADJ]
        OR X1 IS [also] ADJ
        [allow 'the above' as ADJ: 'the above findings'].
   $4 = IF CURRENT WORD IS P
        THEN EITHER CURRENT WORD IS [also] ADJ OR VING
        OR CURRENT WORD IS [also] D:DLA OR DLV.
DOPT7C =
        IN QPOS RE LQR:
        ALL OF $1, $2, $3, $4.
   $1 = CURRENT WORD IS NOT '.' OR ';' OR ','
        OR 'WHO' OR 'WHICH' OR 'THAT'.
   $2 = CURRENT WORD IS NOT TV:VBE OR VHAVE OR VDO.
   $3 = IF CURRENT WORD IS PRO
        THEN EITHER CURRENT WORD IS 'ONE' OR 'BOTH'
        OR CURRENT WORD IS PRO:INDEFINITE [some, all, none].
   $4 = IF CURRENT WORD IS P
        THEN EITHER CURRENT WORD IS [also] D:DLQ
        OR CURRENT WORD IS ADJ:APREQ [the past 2 visits].
DOPT7D =
        IN NPOS RE NNN:
        ALL OF $1, $2, $3, $4, $5.
   $1 = [BOTH] CURRENT WORD IS NOT '.' OR ';' OR ','
        OR 'WHO' OR 'WHICH' OR 'THAT'
        [AND NEXT WORD IS NOT '.' OR ';' OR ',']
        [ OR 'WHO' OR 'WHICH' OR 'THAT' prevents parse of]
        ['No CVA or spinal tenderness' NEXT WORD = 'or'].
   $2 = BOTH CURRENT WORD IS NOT TV:VBE OR VHAVE OR VDO
        AND NEXT WORD IS NOT TV:VBE OR VHAVE OR VDO.
   $3 = CURRENT WORD IS NOT PRO.
   $4 = IF CURRENT WORD IS P
        THEN CURRENT WORD IS 'POST'
        [patient's post myocardial infarction course].
   $5 = CURRENT WORD IS NOT 'SECOND'
        [In 'the second time', 'second' is not N, the time unit].
DOPT7E =
        IN RA RE PQUANT, PN, PVINGO, TOVO, TOSTG, TOVO-N, THATS:
        BOTH CURRENT WORD IS NOT '.' OR ';' OR ','
        AND CURRENT WORD IS NOT TV:VBE OR VHAVE OR VDO.
— DOPT8 -> DAOPT8; TO BE 1ST RESTRICTION ON NODE, NEEDED BY 'EDIT'
DOPT9 =
        [* There is a 'TO' ahead in the sentence]
        IN OBJECT RE TOVO, NTOVO[, FORTOVO]:
        BOTH THERE IS A 'TO' AHEAD
        AND THERE IS A V AHEAD.
DOPT9A =
        [* There is a 'TO' ahead in the sentence]
        IN RA, RNOPTS RE TOVO:
        BOTH THERE IS A 'TO' AHEAD
        AND THERE IS A V AHEAD.
DOPT10 =
        [* There is a VEN ahead in the sentence]
        IN SVEN: THERE IS A VEN AHEAD.
DOPT11 =
        [* There is an 'as' ahead in the sentence]
        IN SASOBJBE: THERE IS A 'AS' AHEAD.
DOPT12 =
        [* Avoid LNR computation in INTRODUCER if no ':' or '-'ahead.*]
        [* Note the use of a numbered option in housing; adjust the *]
        [* number if other options are added earlier in INTRODUCER. *]
        IN INTRODUCER RE OPTION 4:
        THERE IS A ':' OR '-' AHEAD.
DOPT13 =
        [* Avoid LNR computation in NSTGO if current word is 'be'.This *]
        [* occurs when 'to' is taken as a preposition following a verb: *]
        [* 'He is observed to be restless'.*]
        IN NSTGO RE NSTG:
        CURRENT WORD IS NOT 'BE'.
DOPT14 =
        IN NSTG RE LNR:
        BOTH CURRENT WORD IS NOT '.' OR ';' OR ',' OR 'WHAT' OR 'WHO'
        OR 'WHICH'
        AND NONE OF $V, $TV, $VING, $VEN.
   $V = CURRENT WORD IS V:VBE.
   $TV = CURRENT WORD IS TV:VBE.
   $VING = CURRENT WORD IS VING:VBE.
   $VEN = CURRENT WORD IS VEN:VBE.
DOPT15 =
        [* To start a QN-OF, there must be an 'OF' ahead in the sentence]
        IN QN-OF: THERE IS A 'OF' AHEAD.
DOPT16 =
        [* To start PNTHATS, there must be a 'that' ahead in the sentence]
        IN PNTHATS: THERE IS A 'THAT' AHEAD.
DOPT17 =
        [* Avoid NSTGT computation if no time or date word lies ahead *]
        IN NSTGT RE NSTG:
        EITHER THERE IS A N:NTIME1 OR NTIME2 OR NMONTH OR H-TTGEN AHEAD
        OR THERE IS A DT AHEAD.
DOPT18 =
        [* Avoid REG-ADJ in RQ in LQR in QN. Only valid in QPERUNIT. ]
        [* 'Pulse 64 and regular'. ]
        IN RQ RE REG-ADJ:
        IMMEDIATE QPERUNIT EXISTS.
DOPT19 =
        [* To start BPART the current word must be H-PTPART/H-PTAREA or ]
        [* the next word must be a H-PTPART/H-PTAREA; 'swelling, knees';]
        [* 'swelling, mostly knees'.]
        IN BPART: EITHER CURRENT WORD IS N OR ADJ: H-PTPART OR H-PTAREA
        OR NEXT WORD IS N OR ADJ: H-PTPART OR H-PTAREA.
DOPT20 =
        [* To start PQUANT OR QUANT a Q must lie ahead in the sentence]
        IN PQUANT, QUANT: THERE IS A Q AHEAD.
DOPT20A =
        [* Cannot start ADJINRN with Q; QN should be in QUANT in RN]
        IN ADJINRN: CURRENT WORD IS NOT Q.
DOPT20B =
        [* Cannot start ADJADJ with N unless N is NTIME1 or NPREQ since ]
        [* the only option beginning with N is NQ where N=NTIME1 or NPREQ.]
        [* See WPOS59. Must allow for multiply classed words ADJ/N. ]
        [* Must allow for multiply classed words Q/N where N is for EKG ]
        [* leads '1', '2', '3']
        IN ADJADJ: IF BOTH CURRENT WORD IS N
        AND CURRENT WORD IS NOT [also] ADJ [systolic=ADJ/N]
        OR Q [N is for EKG leads '1', '2', '3']
        THEN CURRENT WORD IS N:NTIME1 OR NPREQ.
DOPT21 =
        [* Cannot start QN, QN-OF. QPERUNIT, MORE-QN with a Noun or a T. ]
        [* Cannot start QN, QN-OF. QPERUNIT, MORE-QN with a P, but check ]
        [* multiply classified words. In principle, cannot start QN with N ]
        [* but if a Q is also N then we have to allow QN to start with ]
        [* an N for those words, in order to let the Q be matched in QN. ]
        [* Q/N words are exceptional cases and if not in a special subclass]
        [* (see E-LEAD below) then best is to list them, e.g. a_few. ]
        [* Also list as literal 'second'=Q/N for 'second set' to be QN in ]
        [* NVAR in 'We should obtain a second set of enzymes'. ]
        [* With the addition of EKG grammar in which certain numbers are ]
        [* also the names of EKG leads N:(E-LEAD), e.g. 1, 2, 3, these N/Q ]
        [* words are a case of the exception to the "no-nouns-start-QN" ]
        [* rule, so as not to prevent the creation of QN: 'height 5 feet, ]
        [* 3 inches'. ]
        [* Also must allow N: H-PTAREA for e.g. '8:00' in '8:00 am' where ]
        [* '8;00' is Q in QN but would be blocked by carrying in addition ]
        [* N:H-PTAREA for e.g. 'tumor at 8:00'. ]
        IN QN, QN-OF:
        BOTH CURRENT WORD IS NOT 'WITH' OR 'OF'
        AND BOTH CURRENT WORD IS NOT T
        AND IF CURRENT WORD IS [also] N
        THEN EITHER CURRENT WORD IS N:E-LEAD OR H-PTAREA
        [T-waves flattened in 1, 2, amd F] [tumor at 8:00]
        OR CURRENT WORD IS 'A'_'FEW' [a few pounds]
        OR 'SECOND' [second set].
DOPT22 =
        [* Avoid long backing up into SAOPTS=VENPASS if preceding word is ]
        [* 'who' or 'which' and current word is TV/VEN, e.g. 'presented' in ]
        [* 'The patient was an 85 year old female with a history of ]
        [* hypertension who presented with a two-week history of shortness ]
        [* of breath, chest tightness , and nausea on exertion'. ]
        [* The back-up here results when 'hypertension' is rejected as host ]
        [* of WHS-N by WWH1 because it is not NHUMAN as required when WH-word]
        [* is 'who'. Test also applies in first SA of ASSERTION in WHS-N. ]
        IN SAOPTS RE VENPASS:
        IF BOTH PRECEDING WORD IS 'WHO' OR 'WHICH'
        AND BOTH CURRENT WORD IS VEN
        AND CURRENT WORD IS TV [e.g. 'presented']
        THEN AT IMMEDIATE SA NEITHER $POST-SUBJ NOR $PRE-SUBJ.
   $POST-SUBJ = GO LEFT; TEST FOR SUBJECT.
   $PRE-SUBJ = NOT DO PREVIOUS-ELEMENT-.
DOPT29 =
        [* Conditions for accepting the option PDATE, ]
        [* Note: this restriction constrains LDATE to be null ]
        IN PDATE:
        EITHER $PREP OR $NO-PREP.
   $PREP =
        GO TO CURRENT WORD; STORE IN X1;
        EITHER X1 IS P: H-TMPREP
        OR BOTH $P AND $NEXT.
   $P = [* same list in DPOS12]
        X-PREP := LIST DOPT29-PREP;
        X-LIST := HEAD OF ATTRIBUTE-LIST OF X1;
        X-LIST HAS MEMBER X-PREP.
   $NEXT = GO TO X1; GO TO NEXT WORD; STORE IN X1;
        ONE OF $1, $2, $3, $4.
   $1 = X1 IS N:NMONTH.
   $2 = X1 IS DT.
   $3 = X1 IS 'THE'; GO TO X1;
        GO TO NEXT WORD;
        EITHER PRESENT-ELEMENT- IS 'PRESENT'
        OR PRESENT-ELEMENT- IS DT.
   $4 = X1 IS 'MID' OR 'EARLY' OR 'LATE'; GO TO X1;
        GO TO NEXT WORD; PRESENT-ELEMENT- IS DT.
   $NO-PREP = GO TO CURRENT WORD; STORE IN X1;
        ONE OF $1, $2, $3, $4.
— PAREN RESTRICTIONS

DPAREN1 =
        [* Special paren options OK only allowed following '(' *]
        IN RNOPTS RE PAREN-NSTG:
        PRECEDING WORD IS '('.
WPAREN1 =
        [* Restricts nounphrase right modifier of N in parens ]
        IN PAREN-NSTG:
        EITHER CORE-ATT OF CORE X1 HAS MEMBER H-RESULT OR H-PTMEAS OR H-INDIC OR
        H-DIAG OR H-PTPART OR H-TXPROC OR H-TMLOC OR H-TMDUR OR NUNIT
        OR H-PTAREA OR H-DESCR OR H-TXVAR OR H-NULL OR H-AMT OR H-INST
        OR X1 IS VO [Special population groups (check all that apply)].
— POSITION RESTRICTIONS

— DPOSINDEX
DPOSINDEX = IN ENDMARK:
[* DPOS1 restricts adverbs in LA]
[* DPOS2 restricts adverbs in LQ]
[* DPOS3 restricts adverbs in LT]
[* DPOS4 restricts adverbs in LDATE]
[* DPOS5 restricts adverbs in LV]
[* DPOS5A restricts adverbs in LD]
[* DPOS5B restricts adverbs in LW]
[* DPOS6 restricts options PN and PQUANT in RA of LAR]
[* DPOS7 restricts adverbs in RN]
[* DPOS7A restricts QUANT in RN to be adjuncts of particular N]
[* DPOS7B restricts PERUNIT in RNOPTS: no NULL]
[* DPOS7C restricts WHENS in RNOPTS: HOST is NTIME1/H-TTGEN/QN]
[* DPOS8 restricts adverbs in RQ]
[* DPOS9 restricts adverbs in RV]
[* DPOS9A restricts ADJ/D in RV to be instead ADJ on upcoming N]
[* DPOS9B restricts adverbs in RW]
[* DPOS10 restricts adverbs in LP]
[* DPOS11 pushes SA to the lowest position possible]
[* DPOS11A restricts adverbs in SA]
[* DPOS11B restricts nouns allowed in NSTGT in SA]
[* DPOS11D restricts RNSUBJ in SA-LAST]
[* DPOS11E restricts RSUBJ in SA]
[* * DPOS12 restricts P in PDATE: replaced by WPOS116]
[* * DPOS13 restricts SAOPTS in SACONJ to a small subset; now DAPOS13]
[* DPOS14 restricts NULLFRAG in VERB]
[* DPOS15 A2 NOTER...is not SA but FRAGMENT ***FRENCH ONLY]
[* DPOS16 restricts VENPASS in RNOPTS: not after VHAVE]
[* DPOS16A restricts VENPASS in SA after COMMA in VENO]
[* DPOS16B restricts VENPASS in SA (not SA following VBE)]
[* DPOS17 restricts RV to be NIL if HOST=VBE]
[* DPOS18 restricts SAOPTS in post-VERB SA if VERB=VBE]
[* DPOS19 restricts HOST of BPART in RN: 'pain left hand']
[* DPOS20 restricts TPOS in LN in BPART to nil: 'pain lt arm']
[* DPOS21 restricts ADJADJ in BPART: OK PTAREA/PTPART/DESCR]
[* * DPOS22 NOW DAPOS22. RESTRICT RNOPTS in LNR in INTRODUCER]
[* * DPOS23 old OFSTG]
[* DPOS24 restricts NSTGO not to start with PRO:NOMINATIVE]
[* DPOS25 restricts BPART in RNOPTS, must be only in first RNOPTS]
[* DPOS26 restricts NQ in RNOPTS: N=H-PTFUNC --> HOST ~H-PTFUNC]
[* * DPOS27 replaced by WPOS70 10/18/96]
[* DPOS28 restricts PN or TOVO in RV: not same P or 'to' if could start OBJ]
[* DPOS28A restricts PN or TOVO in POST-V SA: not P or 'to' if can start OBJ]
[* DPOS29 restricts NVAR=DS: nO NPOS=H-TTMED; force NVAR+RN]
[* DPOS30 restricts NULL in WHEN-PHRASE: HOST is 'TIME']
[* DPOS31 restricts WHERES in RNOPTS: HOST is H-INST]
[* DPOS32 restricts ADJINRN in RNOPTS: not VING or VEN]
[* DPOS33 restricts SA: must be NULL after NULL TENSE]
[* DPOS34 restricts VINGO in SA: no VINGO on OBJLIST of VERB]
[* DPOS34A restricts VENPASS in SA-LAST: not if it could be OBJECT]
[* DPOS35 restricts PN WITH P='NOTABLE_FOR: not in STRING-INITIAL position]
[* DPOS36 restricts RNOPTS=APPOS: after COMMA and HOST=H-INST or H-DEVMED]
[* DPOS37 restricts FORTOVO in RNSUBJ in SA-LAST: adjoins HOST NSENT1]
[* DPOS38 restricts FORTOVO in RV: ADJOINS N:NSENT1 in SUBJ of HOST V]
[* DPOS39 restricts options of RA in LAR in APOS in LN]
[* DPOS40 restricts option TOVO-N of RNOPTS: 'no organomegaly to palpate']
[* DPOS41 restricts QUANT in RNOPTS: not if LN of HOST contains Q:QNUMBER]
[* DPOS42 restricts TIME-ADJ in QUANT; if NON-NULL follows TIME-PHRASE node]
[* DPOS43 restricts WHS-N AS RN: HOST=/NTIME1 unless time word ahead]
[* DPOS44 restricts option NSTGT in RNOPTS from adjoining NHUMAN, H-INST,]
[* DPOS45 restricts 'BETWEEN' in LQ to after 'TO': 'to between 80 and 100']
TRUE.
DPOS1 =
        [* Restricts adverbs in LA to DLA or DLV: 'very sleepy', ]
        [* 'slightly decreasing; *'ago sleepy',*'ago decreasing' ]
        IN THE LA RE OPTION LDR:
        EITHER CURRENT WORD IS D: DLA OR DLV
        OR NEXT WORD IS D: DLA OR DLV.
DPOS2 =
        [* Restrcts adverbs in LQ to DLQ - 'quite a few'; *'very a few']
        IN LQ RE OPTION D: CURRENT WORD IS D: DLQ.
DPOS3 =
        [* Restricts adverbs in LT to DLT - 'all_of the'; *'very the']
        IN LT RE OPTION D: CURRENT WORD IS D: DLT.
DPOS4 =
        [* Restricts adverbs in LDATE to DLQ ]
        IN LDATE RE D: CURRENT WORD IS D: DLQ.
DPOS5 =
        [* Restricts adverbs in LV to DLV or DRV: 'poorly monitored' *]
        [* and disallows locative adverbs in LV: *'along goes'. *]
        IN LV RE OPTION LDR:
        EITHER BOTH CURRENT WORD IS D: DLV OR DRV
        AND CURRENT WORD IS NOT D: DLOC1 OR DLOC2 OR DLOC3
        OR BOTH CURRENT WORD IS D:DLD
        AND BOTH NEXT WORD IS D: DLV OR DRV
        AND NEXT WORD IS NOT D: DLOC1 OR DLOC2 OR DLOC3.
DPOS5A =
        [* Restricts adverbs in LD to DLD: ]
        [* 'truly very unusual'; 'truly' DLD]
        IN LD RE D: CURRENT WORD IS D: DLD.
DPOS5B =
        [* Restricts adverbs in LW to DLW: ]
        [* 'He just can say a few words'; 'just' DLW]
        IN LW RE D: CURRENT WORD IS D: DLW.
DPOS6 =
        [* Restricts options in RA of LAR: not allowed in APOS]
        IN RA RE PN, PQUANT, TOVO, PVINGO, TOVO-N, THATS, TOSTG:
        PRESENT-ELEMENT IS NOT OCCURRING IN APOS.
DPOS7 =
        [* Restricts adverbs in LDR in RNOPTS]
        IN RNOPTS RE LDR:
        BOTH CURRENT WORD X1 IS D: DRN
        AND NOT ALL OF $THERE-WERE, $IN-Q-CONJ, $PRESUBJ-SA.
   $THERE-WERE = BOTH X1 IS 'THERE'
        AND NEXT WORD IS TV:VBE OR VHAVE
        [there were, there is, etc.; also 'there has been'].
   $IN-Q-CONJ = ASCEND TO Q-CONJ PASSING THROUGH PN; STORE IN X3.
   $PRESUBJ-SA = VALUE OF X3 IS SA
        WHERE BOTH NOT $1 AND NOT $2.
   $1 = GO LEFT [fails if SA is string-initial].
   $2 = GO RIGHT [fails if SA has a right sibling].
DPOS7A =
        [* Certain nouns can have adjunct QUANT in clinical sublanguage: ]
        [* 'incision 6 cm long','fever 100'.When QUANT->QPERUNIT->QNUMBER]
        [* with host H-INDIC, as in 'fever 100, there may be a problem ]
        [* if the word + number requires another analysis. This happened ]
        [* in 'Discharge on postoperative day 3', 'discharge' is taken as]
        [* H-INDIC (discharge=H-TTGEN/H-INDIC),RN->PN='on ... day' plus ]
        [* 2nd RN = QUANT->QPERUNIT->QNUMBER='3'. QUANT must be rejected ]
        [* to force 'day 3' to be taken as NQ in NVAR. Or 'discharge' has]
        [* to be disambiguated beforehand, or disallow NVAR->N='day' when]
        [* next word is QNUMBER. 4/5/01 Will try latter in WPOS67. ]
        [* 1/11/2002 For 'PTFUNC in PTPART' e.g. 'blood pressure in the ]
        [* right arm' the following QUANT belongs on PTFUNC not PTPART. ]
        [* Avoid wrong COMPUTED-ATT: In 'blood pressure in the right arm ]
        [* 174/120' COMP-ATT /= 'arm 174/120']
        IN RNOPTS RE QUANT:
        BOTH HOST- X-N IS N: H-PTFUNC OR H-PTMEAS OR H-PT [age] OR H-PTAREA
        OR H-PTPART OR H-INDIC OR H-DIAG OR H-TTMED OR H-AMT
        OR H-CHANGE OR H-CHANGE-MORE OR H-CHANGE-LESS
        OR H-CHANGE-SAME
        OR H-TXVAR OR H-TXSPEC OR H-TTSURG OR H-RESP
        AND IF X-N IS H-PTPART
        THEN IF X-N IS OCCURRING IN PN [e.g. 'in the arm']
        @THEN HOST- [of PN] IS NOT H-PTFUNC
        [In 'blood pressure in the right arm 174/120']
        [ COMP-ATT /= 'arm 174/120'].
DPOS7B =
        IN PERUNIT RE NULL:
        IMMEDIATE-NODE- IS NOT RNOPTS.
DPOS7C =
        [* WHENS in RNOPTS adjoins only N=NTIME1/NTIME2/H-TTGEN or QN: ]
        [* 'On the day/visit when xrays were taken..'; 'yesterday at which ]
        [* time she was given aspirin', 'for 6 months at which time he..'. ]
        [* OR H-TTSURG: 'had a recent biopsy at which time she was found to]
        [* have an inflitrating ductal carcinoma..']
        IN RNOPTS RE WHENS:
        EITHER HOST X-HOST IS NTIME1 OR NTIME2 OR H-TTGEN OR H-TTSURG
        OR EITHER X-HOST IS DT
        OR X-HOST IS QN WHERE ELEMENT- N IS NTIME1 OR H-TTGEN.
DPOS8 =
        [* Restricts adverbs in RQ to DRQ ]
        IN RQ RE D: CURRENT WORD IS D: DRQ.
DPOS9 =
        [* Restricts adverbs in RV to DRV or some DSA; 2 D allowed *]
        IN RV RE LDR: EITHER $1 OR $2.
$1 = EITHER CURRENT WORD IS D: DRV
        OR BOTH CURRENT WORD IS D: DSA
        AND CURRENT WORD IS D: H-TMDUR OR H-TMLOC OR H-TMREP OR
        H-CHANGE-MORE OR H-CHANGE-LESS [titrated upwards].
$2 = BOTH CURRENT WORD IS D
        AND EITHER NEXT WORD IS D: DRV
        OR BOTH NEXT WORD IS D: DSA
        AND NEXT WORD IS D: H-TMDUR OR H-TMLOC OR H-TMREP.
DPOS9A =
        [* Try to get ADJ/D in RV to be not D but ADJ on upcoming N: ]
        [* 'We have not arranged further review'. 'further' ADJ/D ]
        IN RV RE LDR: NOT ALL OF $ADJ-D, $NEXT, $OBJ.
   $ADJ-D = BOTH CURRENT WORD IS D AND CURRENT WORD IS ADJ.
   $NEXT = NEXT WORD IS N.
   $OBJ = HOST HAS ATTRIBUTE OBJLIST:NSTGO OR NPN OR NPVINGO OR NTOVO.
DPOS9B =
        [* Restricts adverbs in RW to DRW: 'He can almost, ]
        [* when necessary, walk by himself', 'almost' DRW. ]
        IN RW RE D: CURRENT WORD IS D: DRW.
DPOS10 =
        [* Adverb in LP=DLP: 'probablement en rapport avec',]
        [* 'tout_de_suite apre2s', 'surtout dans le...' ]
        [* 6/12/97 OK PN='well into the night'; not OK PN= ]
        [* 'well until the night'. ]
IN LP RE OPTION LDR:
        BOTH CURRENT WORD IS D: DLP
        AND IF CURRENT WORD IS 'WELL'
        THEN NEXT WORD IS NOT 'UNTIL'.
DPOS11 =
        [* PUSHES SA TO THE LOWEST POSITION POSSIBLE. THE RESTRICTION ]
        [* SEARCHES THE RIGHT-MOST NON-EMPTY EDGE OF THE LEFT ADJACENT]
        [* SUBTREE FOR A NON-EMPTY SA.]
        IN SA, SA-LAST RE SAOPTS:
        IF PREVIOUS-ELEMENT- IS NOT SAOPTS
        THEN IF BOTH $CHK-PREVIOUS-NODE
        @AND PRESENT-ELEMENT- IS NOT SA
        THEN $NO-EMPTY-SA.
   $CHK-PREVIOUS-NODE =
        ITERATE GO LEFT UNTIL PRESENT-ELEMENT- X-NODE IS NOT EMPTY SUCCEEDS.
   $NO-EMPTY-SA =
        AT X-NODE ITERATE $GO-TO-NEXT-NODE
        [* SEARCHES FOR SA IN THE ADJACENT BRANCH *]
        [* OR SUCCEEDS. *]
        UNTIL EITHER PRESENT-ELEMENT- IS SA
        OR PRESENT-ELEMENT- IS IDENTICAL TO X-NODE SUCCEEDS;
        IF PRESENT-ELEMENT- IS SA
        THEN PRESENT-ELEMENT- IS NOT EMPTY.
   $GO-TO-NEXT-NODE =
        [* DEPTH-FIRST RIGHT-TO-LEFT TRAVERSE *]
        [* ALONG THE PATH OF RIGHT-MOST NON-EMPTY NODE. *]
        EITHER LAST-ELEMENT- EXISTS
        OR ITERATET GO UP UNTIL $UP-FILLED-NODE SUCCEEDS.
   $UP-FILLED-NODE =
        [* IF COMPLETED A FILLED NODE, *]
        [* DON'T GO LEFT FOR MORE *]
        EITHER BOTH PRESENT-ELEMENT- IS EMPTY
        AND GO LEFT
        OR PRESENT-ELEMENT- IS IDENTICAL TO X-NODE.
DPOS11A =
        [* Restricts adverbs in SA to DSA:'Finally he left';`he left then']
        [* Restricts adverbs in SA-LAST to DSA OR DRV - 'He left finally',]
        [* 'He answered questions appropriately'., but not DRV and DLOC3: ]
        [* NOT 'Test was obtained on.' ]
        [* Allows H-NEG adverbs 'not', 'never' in SACONJ: ]
        [* E.g. 'diaphoresis but not shortness of breath'. ]
        IN SAOPTS RE OPTION LDR: ALL OF $DSA, $SA-LAST, $SACONJ.
   $DSA = IF PRESENT-ELEMENT- IS NOT OCCURRING IN SA-LAST OR SACONJ
        THEN EITHER CURRENT WORD IS D:DSA
        OR BOTH CURRENT WORD IS D:DLD
        AND NEXT WORD IS D:DSA.
   $SA-LAST = IF PRESENT-ELEMENT- IS OCCURRING IN SA-LAST
        THEN BOTH EITHER CURRENT WORD X1 IS D:DSA OR DRV
        OR BOTH CURRENT WORD X1 IS D:DLD
        AND NEXT WORD IS D:DSA OR DRV
        AND IF X1 IS D:DRV
        THEN BOTH X1 IS NOT D:DLOC3
        AND NOT BOTH WORD PRECEDING PRESENT NODE IS ','
        AND X1 IS 'BACK' ['back' = troublemaker]
        [In 'She denies interval cough , back or bone pain']
        ['back' DRV is not SA-LAST leaving 'or bone pain'. ].
   $SACONJ = IF PRESENT-ELEMENT- IS OCCURRING IN SACONJ
        THEN EITHER CURRENT WORD IS D:H-NEG [not, never]
        OR EITHER CURRENT WORD IS D:DSA OR DRV
        OR BOTH CURRENT WORD IS D:DLD
        AND NEXT WORD IS D:DSA OR DRV.
DPOS11B =
        [* was DOPT6 in MDPAR6; potential time phrase with no preposition]
        IN SAOPTS, RV RE NSTGT: ONE OF $1, $2, $3, $4.
   $1 = EITHER THE CURRENT WORD X-WORD IS N: NTIME2 [today, tomorrow]
        OR X-WORD IS T OR D OR ADJ OR VING:TIMETAG OR NTIME2
        [this visit, yesterday evening, next morning, the following day]
        [his entire stay].
   $2 = AT X-WORD
        BOTH ITERATET GO TO NEXT WORD UNTIL VERIFY $N-TEST SUCCEEDS
        AND $N-AHEAD.
   $N-TEST = PRESENT-ELEMENT- IS N X2.
   $N-AHEAD = EITHER X2 IS N: NTIME1 [last week]
        OR X2 IS 'ADMISSION' OR 'DISCHARGE' OR 'HOSPITALIZATION'
        OR 'VISIT'[this admission, last visit].
   $3 = BOTH X-WORD IS Q:QNUMBER
        AND BOTH NEXT WORD IS N:NUNIT
        AND NEXT WORD IS N:NTIME1 OR TIMETAG [2 days.../3 times_a_day].
   $4 = BOTH X-WORD IS N:NTIME1
        AND NEXT WORD IS Q:QNUMBER [day 2 post myocardial infarction].
— DPOS11C REPLACED BY MORE COMPLETE DPOS28A
— NEW DPOS11C IS FOR 'ENOUGH...THAT' CONSTRUCTION
DPOS11C =
        [* THATS occurs post-object only and must be preceded by 'enough':]
        [* 'There are enough suspicious elements that clarification is indicated']
        IN SAOPTS RE THATS:
        IMMEDIATE SA-LAST EXISTS
        WHERE IMMEDIATE ASSERTION SUBSUMES 'ENOUGH'.
DPOS11D =
        [* RNSUBJ is post-object only: A VQ scan was undertaken which]
        [* was normal]
        IN SAOPTS RE RNSUBJ:
        IMMEDIATE SA-LAST EXISTS.
DPOS11E =
        [* RSUBJ is T/Q in subclass QROVING or is PRO:PROSELF and is ]
        [* not STRING INITIAL: they ALL were negative, she lowered the ]
        [* the dose HERSELF. ]
        IN SAOPTS RE RSUBJ:
        BOTH EITHER CURRENT WORD IS T:QROVING
        OR EITHER CURRENT WORD IS Q:QROVING
        OR CURRENT WORD IS PRO:PROSELF
        AND IF IMMEDIATE-NODE IS SA@
        THEN VERIFY GO LEFT.
— DPOS13 -> DAPOS13 TO BE FIRST EXECUTED RESTRICTION IN SA, HAS EDIT
DPOS14 =
        [* accept as fragment a subject ending before '.' or ';' ]
        [* or '#' or '(', or after ','. ]
        IN VERB RE OPTION NULLFRAG: ALL OF $1, $2, $3.
   $1 = EITHER CURRENT WORD IS '.' OR ';' OR ',' OR '#' OR '(' OR '-'
        OR 'AND' ['heart rate 75 and afebrile'; want 'afebrile'=FRAG]
        [don't want BESHOW = 'heart rate afebrile';]
        [note when AND is current at NULLFRAG, conj options have been tried]
        OR PRECEDING WORD IS ','.
   $2 = IMMEDIATE-NODE IS ASSERTION
        WHERE IMMEDIATE-NODE IS CENTER.
   $3 = COELEMENT- TENSE IS EMPTY.
DPOS16 =
        [* Force VEN to VENO if preceding word is VHAVE (avoir) ]
        [* Force VENPASS to OBJECTBE if preceding word is VBE ]
        [* Prevent 'left' as passive modifier of patient-subject: ]
        [* 'The patient left against medical advice'. ]
        IN RNOPTS RE VENPASS: ALL OF $1, $2, $3.
   $1 = PRECEDING WORD IS NOT VHAVE.
   $2 = PRECEDING WORD IS NOT TV:VBE.
   $3 = IF CURRENT WORD IS 'LEFT'
        THEN IT IS NOT THE CASE THAT
        BOTH HOST- X1 IS H-PT
        AND X1 IS OCCURRING IN SUBJECT.
DPOS16A =
        [* Force VEN to VENO if preceding word is comma and this ]
        [* potential VENPASS modifier is in VENO. The likelihood ]
        [* is 2 conjoined VENOs, e.g. in 'decreased her walking, ]
        [* stopped playing tennis' unlikely that 'stopped...' is ]
        [* VENPASS in SA-LAST in VENO = 'decreased her walking', ]
        [* or is in SA-LAST following an OBJECT = VENO (same ex. ]
        IN SAOPTS, RNSUBJ RE VENPASS: NOT ALL OF $1, $2.
   $1 = PRESENT-ELEMENT- X3 IS OCCURRING IN SA-LAST
        WHERE EITHER IMMEDIATE VENO EXISTS
        OR PREVIOUS-ELEMENT- IS OBJECT
        WHERE VALUE IS VENO.
   $2 = PRECEDING WORD IS ','.
DPOS16B =
        [* Force VENPASS to OBJECTBE (not SA following verb 'be'). ]
        [* In 'The patient was continued on heparin through 10/11/00' ]
        [* the phrase 'continued on heparin' is not VENPASS in SAOPTS.]
        IN SAOPTS RE VENPASS:
        NOT $1.
   $1 = ITERATE ASCEND TO SA UNTIL $EMBEDDED FAILS;
        GO LEFT;
        TEST FOR VERB;
        CORE- IS VBE.
   $EMBEDDED = GO LEFT; TEST FOR SAOPTS.
DPOS17 =
        [* Disqualify version of WPOS28; RV=0 if host=VBE]
        IN RV RE OPTIONS PDATE, PN, PQUANT, PVINGO, QN, LDR, NSTGT:
        HOST IS NOT VBE.
DPOS18 =
        [* Extension of DPOS17; SAOPTS of post-RV SA are limited if verb=VBE. ]
        [* This helps objects of VBE from being split into adjunct + object. ]
        [* It is needed for new H-RESP idiomatic prepostions, e.g. 'relieved_by' ]
        [* as in 'Pain which is relieved by sitting forward'. Analysis is not ]
        [* 'Pain which is forward' + SA=PVINGO='relieved by sitting' after 'is'. ]
        [* Note post-VBE RV is empty by DPOS17. In the example, both DPOS17 and ]
        [* DPOS18 are needed to to get 'relieved...forward' as PVINGO in OBJBE. ]
        IN SAOPTS RE OPTIONS PDATE, PN, PVINGO, TOVO:
        IF IMMEDIATE-NODE- IS SA
        @THEN IT IS NOT THE CASE THAT PREVIOUS-ELEMENT- IS OF TYPE VERBAL
        WHERE CORE- IS VBE.
DPOS19 =
        [* Host of BPART in RNOPTS=H-INDIC/H-DIAG/H-PTPART/H-PTAREA/H-TTSURG]
        [* H-TESTVIEW/H-PTFUNC: ]
        [* 'pain left arm'/ 'soles both feet'/'graft unknown vessels']
        [* 2/10/00 add H-TESTVIEW for 'AP pelvis' ]
        [* 3/25/00 add H-PTFUNC for '2+ pulses bilaterally'. ]
        IN RNOPTS RE BPART:
        HOST- IS H-INDIC OR H-DIAG OR H-PTPART OR H-PTAREA OR H-TTSURG
        OR H-TESTVIEW OR H-PTFUNC [2+ pulses bilaterally]
        OR H-TXPROC [Mammogram, bilateral].
DPOS20 =
        [* TPOS = NULL if in LN in BPART: pain left arm;?pain the lt arm]
        IN TPOS RE LTR:
        NOT $1.
   $1 = AT IMMEDIATE LN IMMEDIATE BPART EXISTS.
DPOS21 =
        [* ADJADJ in BPART: only H-PTAREA/H-PTPART/H-DESCR; no QN or NQ ]
        IN APOS RE ADJADJ:
        IF AT IMMEDIATE LN IMMEDIATE BPART EXISTS
        THEN CURRENT WORD IS ADJ:H-PTAREA OR H-PTPART
        OR H-DESCR [unknown vessel].
— DPOS22 -> DAPOS22 TO BE FIRST EXECUTED RESTRICTION IN RNOPTS
DPOS24 =
        [* Avoid computation of NSTGO at nominative PRO: 'until I...' ]
        IN NSTGO RE NSTG:
        CURRENT WORD IS NOT PRO:NOMINATIVE.
DPOS25 =
        [* restrict BPART in RNOPTS, must be contiguous to host or 2nd RN ]
        [* after comma, or (8/22/01) in conjunct of RN=BPART as in 'Many ]
        [* ectopic foci, ventricular and atrial'. DCONJ5 permits RN CONJ RN ]
        [* by assigning node attribute LAST-NODE to RN in LNR; this allows ]
        [* DCONJ0 to generate CONJ RN. Now DPOS25 must allow BPART to be not]
        [* contiguous to host but only for RN = BPART on both sides of CONJ.]
        [* 12/1/97 Also both no BPART within BPART, and if BPART=H-PTPART, ]
        [* then host=/H-PTPART: OK 'pain in knee, rt; *'pain in knee, elbow']
        [* where 'elbow' is BPART of 'knee'. Must extend for the case when ]
        [* another word precedes the H-PTPART, e.g. 'external' in ]
        [* 'HEENT: Unremarkable without lesions in the oropharynx, external ]
        [* nose, lips or ears']
        IN RNOPTS RE BPART: BOTH $1 AND $2.
   $1 = EITHER $CONTIG OR $CONJUNCT.
   $CONTIG = AT IMMEDIATE-NODE [RN] GO LEFT; STORE IN X-TEST;
        TEST FOR NVAR OR COMMASTG [Had surgery, unknown vessel].
   $CONJUNCT = BOTH IMMEDIATE-NODE X-RN IS OCCURRING IN Q-CONJ
        WHERE IMMEDIATE-NODE IS ANDSTG @
        [ectopic foci, ventricular and ...]
        AND CORE- OF COELEMENT- RN IS BPART [ventricular].
   $2 = BOTH IMMEDIATE RN IS NOT OCCURRING IN BPART
        AND IF HOST- IS H-PTPART
        THEN NONE OF $A, $B[, $C].
   $A = CURRENT WORD IS N:H-PTPART [elbow].
   $B = NEXT WORD IS N:H-PTPART [external nose].
DPOS26 =
        [* restrict NQ in QUANT in RNOPTS:if N=H-PTFUNC then host is not]
        [* H-PTFUNC; in 'BP 130/70, HR 150', 'BP' does have adjunct NQ ]
        [* 'HR 150'. ]
        IN QUANT RE NQ:
        IF BOTH CURRENT WORD IS N:H-PTFUNC
        AND IMMEDIATE-NODE IS RNOPTS@
        THEN HOST IS NOT N:H-PTFUNC.
DPOS28 =
        [* Restricts PN in RV: not same P (or 'to') as could start verb object.]
        [* Analysis of 'They asked to see his mother' is not 'They asked his ]
        [* mother' with RV=TOVO= 'to see'. Re $EXCEPTIONS, this is needed for ]
        [* 'It was explained to her in detail that this was against our advice']
        [* where 'to her in detail' must be allowed in RV so 'that this was...']
        [* can be PASSOBJ of 'explained' even though PN (P='to') is also a ]
        [* possible PASSOBJ of 'explained'. Actually, want PNTHATS = PASSOBJ. ]
        [* When a conjunct Q-CONJ of VENPASS is being built, the RV in LVENR in]
        [* Q-CONJ must have a path to Q-CONJ and then to VENPASS via IMMEDIATE ]
        [* VENPASS (or to prove it is not in VENPASS in $ACTIVE). Had to update]
        [* routine IMMEDIATE (X). Problem was with BUTSTG in ]
        [* 'She was started on aspirin but vehemently refused to take this'. ]
        IN RV RE PN, PQUANT, PDATE: ALL OF $LXR, $ACTIVE, $PASSIVE.
   $LXR = IMMEDIATE-NODE IS OF TYPE VERBAL.
   $ACTIVE = IF IT IS NOT THE CASE THAT IMMEDIATE VENPASS EXISTS
        THEN IF CURRENT WORD IS P X1
        THEN ALL OF $A,$C.
   $A = IF HOST HAS ATTRIBUTE OBJLIST: PN: PVAL X2
        THEN LISTS X1 AND X2 HAVE NO COMMON ATTRIBUTE.
   $C = NOT BOTH CURRENT WORD IS 'TO'
        AND BOTH HOST- HAS ATTRIBUTE OBJLIST: TOVO
        AND THERE IS A V AHEAD.
   $PASSIVE = IF IMMEDIATE VENPASS EXISTS
        THEN IF CURRENT WORD IS P X1
        THEN [EITHER $EXCEPTIONS OR] ALL OF $1, $2, $3.
   $EXCEPTIONS = BOTH CURRENT WORD IS 'TO' [explained TO her in detail]
        AND BOTH HOST- HAS ATTRIBUTE POBJLIST: PNTHATS OR THATS
        AND THERE IS A 'THAT' AHEAD.
   $1 = IF EITHER HOST HAS ATTRIBUTE POBJLIST: PN: PVAL X2
        OR HOST HAS ATTRIBUTE POBJLIST: PNTHATS: PVAL X2
        THEN LISTS X1 AND X2 HAVE NO COMMON ATTRIBUTE.
   $2 = NOT BOTH CURRENT WORD IS 'AS'
        AND HOST- HAS ATTRIBUTE POBJLIST: ASOBJBE.
   $3 = NOT BOTH CURRENT WORD IS 'TO'
        AND BOTH HOST- HAS ATTRIBUTE POBJLIST: TOVO
        AND THERE IS A V AHEAD.
DPOS28A =
        [* Restricts PN in post-V SA not same P (or 'to') as ]
        [* could start verb object. Analysis of 'They asked ]
        [* to see his mother' is not 'They asked his mother' ]
        [* with SA=TOVO='to see' in SA between vb and object.]
        IN SAOPTS RE PN, TOVO:
        IF AT IMMEDIATE SA $POST-V IS TRUE
        THEN ALL OF $ACTIVE, $PASSIVE.
   $POST-V = GO LEFT; TEST FOR VERBAL;
        EITHER RIGHT-ADJUNCT X11 OF CORE- X10 IS EMPTY
        OR X11 IS PDATE
        ['Patient presented on 02/01/2001 with chest discomfort';]
        [the verb 'presented' should have 'with chest discomfort']
        [as OBJECT, not post-V SA].
   $ACTIVE = IF IT IS NOT THE CASE THAT IMMEDIATE VENPASS EXISTS
        THEN IF CURRENT WORD IS P X1
        THEN ALL OF $A,$C.
   $A = IF X10 HAS ATTRIBUTE OBJLIST: PN: PVAL X2
        THEN LISTS X1 AND X2 HAVE NO COMMON ATTRIBUTE.
   $C = NOT BOTH CURRENT WORD IS 'TO'
        AND BOTH X10 HAS ATTRIBUTE OBJLIST: TOVO
        AND THERE IS A V AHEAD.
   $PASSIVE = IF IMMEDIATE VENPASS EXISTS
        THEN IF CURRENT WORD IS P X1
        THEN ALL OF $1, $2, $3.
   $1 = IF X10 HAS ATTRIBUTE POBJLIST: PN: PVAL X2
        THEN LISTS X1 AND X2 HAVE NO COMMON ATTRIBUTE.
   $2 = NOT BOTH CURRENT WORD IS 'TO'
        AND BOTH X10 HAS ATTRIBUTE POBJLIST: TOVO
        AND THERE IS A V AHEAD.
   $3 = NOT BOTH CURRENT WORD IS 'AS'
        AND X10 HAS ATTRIBUTE POBJLIST: ASOBJBE.
DPOS29 =
        [* Rejects NVAR=DS + NPOS=H-TTMED; force NVAR+RN:'dilantin 500 mg']
        IN NVAR RE DS:
        IN COELEMENT- LN NPOS DOES NOT SUBSUME N:H-TTMED.
DPOS30 =
        [* restricts NULL in WHEN-PHRASE: host is 'time' ]
        IN WHEN-PHRASE RE NULL:
        BOTH HOST- X10 IS 'TIME' ['the last time he was here']
        AND BOTH IN LEFT-ADJUNCT OF X10
        CORE- OF TPOS IS NOT TDEM [that,this,these,those]
        AND PRECEDING WORD IS NOT ','.
DPOS31 =
        [* restricts WHERES in RNOPTS to host H-INST: 'in ZZZ where he ..']
        [* or to host H-TTGEN: 'He agreed to see the patient in followup ]
        [* where he anticipates performing upper endoscopy'. ]
        IN RNOPTS RE WHERES:
        HOST- IS H-INST OR H-TTGEN.
DPOS32 =
        [* restricts ADJINRN in RNOPTS: not VING or VEN: 'The patient seen]
        [* in the ER..' has RNOPTS=VENPASS, not RNOPTS=ADJINRN. ]
        IN RNOPTS RE ADJINRN:
        CURRENT WORD IS NOT VING OR VEN.
DPOS33 =
        [* restricts SA: must be NULL after NULL TENSE ]
        IN SA RE SAOPTS:
        NOT BOTH $PREVIOUS-NODE AND $EMPTY.
   $PREVIOUS-NODE = GO LEFT; TEST FOR TENSE; STORE IN X-TENSE.
   $EMPTY= X-TENSE IS EMPTY.
DPOS34 =
        [* Restricts VINGO in post-verb SA: not if verb has possible ]
        [* object VINGO. Analysis of 'suggest obtaining MRI tomorrow' ]
        [* is not 'suggest tomorrow' with post-verb SA='obtaining MRI']
        IN SAOPTS RE VINGO:
        IF IMMEDIATE SA EXISTS [note occurrence in SA-LAST allowed]
        THEN IF PREVIOUS-ELEMENT- IS OF TYPE VERBAL X1
        THEN IF IT IS NOT THE CASE THAT IMMEDIATE VENPASS EXISTS
        THEN IT IS NOT THE CASE THAT
        HOST- HAS ATTRIBUTE OBJLIST: VINGO.
DPOS34A =
        [* Restricts VENPASS in post-object SA (SA-LAST): not if verb ]
        [* has object DSTG where the D could be left adjunct of VEN ]
        [* and current word is VEN and verb could have VENPASS object.]
        [* Analysis of 'She felt much improved following this intervention']
        [* is not 'She felt much' with SA-LAST='improved following this ]
        [* intervention.' ]
        IN SAOPTS RE VENPASS:
        IF BOTH IMMEDIATE SA-LAST X-SA EXISTS
        AND CURRENT WORD IS VEN
        THEN IF AT X-SA PREVIOUS-ELEMENT- X1 IS OBJECT
        WHERE CORE- IS D:DLV
        [Note to be object D was also DEVAL, e.g. 'much']
        THEN IT IS NOT THE CASE THAT AT X1
        CORE- OF COELEMENT- VERBAL HAS ATTRIBUTE OBJLIST:VENPASS.
DPOS34B =
        [* Restricts VENPASS in RNSUBJ in SA-LAST: not if verb ]
        [* has object DSTG where the D could be left adjunct of VEN ]
        [* and current word is VEN and verb could have VENPASS object.]
        [* Analysis of 'She felt much improved following this intervention']
        [* is not 'She felt much' with SA-LAST='improved following this ]
        [* intervention.' ]
        IN RNSUBJ RE VENPASS:
        IF BOTH IMMEDIATE SA-LAST X-SA EXISTS
        AND CURRENT WORD IS VEN
        THEN IF AT X-SA PREVIOUS-ELEMENT- X1 IS OBJECT
        WHERE CORE- IS D:DLV
        [Note to be object D was also DEVAL, e.g. 'much']
        THEN IT IS NOT THE CASE THAT AT X1
        CORE- OF COELEMENT- VERBAL HAS ATTRIBUTE OBJLIST:VENPASS.
DPOS35 =
        [* Restricts PN = 'Notable_for ...' from occurring in pre-Subj SA]
        [* because this often splits a conjoined string of findings. E.g.]
        [* in 'Notable for no stroke , coronary artery disease , angina ,]
        [* diabetes or hypercholesterolemia' the pre-subj PN was ]
        [* 'Notable for no stroke , coronary artery disease , angina ,' ]
        [* while the SUBJECT (with NULLFRAG VERB and OBJECT) was ]
        [* 'diabetes or hypercholesterolemia', which lost 'notable for' ]
        [* and most importantly also the negation. This PN should be FRAG]
        [* Same for 'significant_for' and 'remarkable_for'. ]
        IN SAOPTS RE PN:
        NOT BOTH CURRENT WORD IS 'NOTABLE'_'FOR' OR 'SIGNIFICANT'_'FOR'
        OR 'REMARKABLE'_'FOR'
        AND IT IS NOT THE CASE THAT $1.
   $1 = GO UP; TEST FOR SA; GO LEFT.
DPOS36 =
        [* The host of apposition APPOS is of the same class as the ]
        [* apposition noun. We allow only H-INST: 'Dr. YYY002, her ]
        [* family practioner,' or H-DEVMED: 'Pacemaker, VVI,' or ]
        [* H-PT: 'The patient, MR XXX'. APPOS must be preceded by ',']
        [* Both these tests are also in WPOS102 with test of APPOS. ]
        [* Also DCONJ5$NEXT-WORD allows comma after NVAR for APPOS. ]
        [* 4/28/04 remove H-DEVMED. In 'PCI 10/05/98 : laser , balloon ]
        [* , stent of the proximal RCA' neither 'ballon' nor 'stent' ]
        [* should be taken as APPOS on 'laser'. ]
        IN RNOPTS RE APPOS:
        ALL OF $AFTER-COMMA, $HOST.
   $AFTER-COMMA = THE WORD PRECEDING THE PRESENT NODE IS ','.
   $HOST = HOST- IS N:H-INST [OR H-DEVMED] OR H-PT.
DPOS37 =
        [* FORTOVO in RNSUBJ in SA-LAST adjoins host NSENT1; e.g. in ]
        [* 'Plans were made yesterday for him to be discharged today']
        [* FORTOVO = 'for him to be discharged' is RNSUBJ of 'plans'.]
        IN RNSUBJ RE FORTOVO:
        BOTH IMMEDIATE STRING IS VENPASS@
        AND HOST- IS N:NSENT1.
DPOS38 =
        [* FORTOVO in RV in VENPASS adjoins SUBJECT N:NSENT1 in COELEMENT ]
        [* SUBJECT of host verb, i.e.the ULTIMATE-SUBJECT of that verb. ]
        [* Thus, in 'Plans were made for him to be discharged' we desire ]
        [* FORTOVO = 'for him to be discharged' in RV in VENPASS = 'made' ]
        [* in OBJECTBE in OBJECT where ULTIMATE-SUBJECT is 'plans'. ]
        IN RV RE FORTOVO:
        BOTH IMMEDIATE STRING IS VENPASS
        WHERE IT- IS OCCURRING IN OBJECT@
        AND CORE- OF ULTIMATE-SUBJECT IS N:NSENT1.
DPOS39 =
        [* Restricts options of RA in LAR in APOS in LN]
        IN RA RE PDATE, PQUANT, FORTOVO, PN, PVINGO, TOVO, TOSTG, TOVO-N,
        THATS, ASSERTION, WHETHS:
        IT IS NOT THE CASE THAT IMMEDIATE APOS EXISTS.
DPOS40 =
        [* Restricts option TOVO-N of RNOPTS: 'no organomegaly to palpate']
        [* 'the wrong thing to do'; to be extended]
        IN RNOPTS RE TOVO-N:
        EITHER BOTH HOST- X1 IS H-INDIC
        AND NEXT WORD IS 'PALPATE' [no organomegaly to palpate]
        OR NEXT WORD IS 'DO' [the wrong thing to do].
DPOS41 =
        [* Restricts QUANT in RNOPTS: not if LN of HOST contains Q:QNUMBER.]
        [* In '50% and 70% lesions in the circ, 60% and 80% lesions in the ]
        [* RAD' don't accept '60%' as RN of 'circ' or of first 'lesions'.]
        IN RNOPTS RE QUANT:
        IF WORD PRECEDING PRESENT NODE IS ','
        THEN NEITHER LEFT-ADJUNCT OF HOST- ['circ'] SUBSUMES Q:QNUMBER
        NOR BOTH X2 IS OCCURRING IN PN ['in the circ']
        @AND IN LEFT-ADJUNCT OF HOST- [first 'lesions']
        PRESENT-ELEMENT- [LN] SUBSUMES Q:QNUMBER.
DPOS42 =
        [* Restricts TIME-ADJ in QUANT to occur only after a ]
        [* preceding element QN/NQ/QPREUNIT that carries the ]
        [* node attribute PHRASE-ATT = TIME-PHRASE. E.g. NQ ]
        [* in QUANT in PQUANT: 'until hospital day three, at ]
        [* which time ...' where 'at which time' starts a ]
        [* WHENS in TIME-ADJ]
        IN TIME-ADJ RE PDATE, WHENS, PN: BOTH $1 AND $2.
   $1 = GO LEFT;
        BOTH PRESENT-ELEMENT- HAS NODE ATTRIBUTE PHRASE-ATT X-PH-ATT
        AND X-PH-ATT HAS MEMBER TIME-PHRASE.
   $2 = IF CURRENT WORD IS P [usual start of PN]
        THEN EITHER THERE IS AN N:NTIME1 AHEAD
        OR THERE IS A 'WHEN' OR 'WHILE' OR 'BEFORE' OR 'AFTER' AHEAD.
DPOS43 =
        [* Restricts WHS-N as RN: HOST=/NTIME1 unless time word ahead ]
        [* in 'He had chest pain a month later which was felt to be ]
        [* pericarditis' the stretch 'which was felt to be pericarditis' ]
        [* is not an adjunct of 'month'. But in 'He had chest pain a month]
        [* later which was when he first came to the ER' the stretch ]
        [* 'which was when he first came to the ER' is an RN on 'month'. ]
        [* Note that this restriction requires that we find a slot for ]
        [* WHS-N as adjunct of the 'chest pain' in OBJECT, occurring after]
        [* NSTGT = 'a month later'. We add option NSTGT to RNOPTS. ]
        IN RNOPTS RE WHS-N:
        IF HOST IS NTIME1 [e.g. 'month']
        THEN EITHER THERE IS AN N:NTIME1 AHEAD
        OR THERE IS A 'WHEN' OR 'WHILE' OR 'BEFORE' OR 'AFTER' AHEAD.
DPOS44 =
        [* Restricts option NSTGT in RNOPTS from adjoining NHUMAN, H-INST, ]
        [* which are types without a time dimension. NSTGT in RNOPTS is ]
        [* needed for conjoining LNRs that contain a time adjunct, e.g. ]
        [* 'today' in 'will obtain medication levels today as well as ]
        [* liver function tests'. NSTGT in RNOPTS is also needed in 'He ]
        [* had chest pain a month later which was felt to be pericarditis' ]
        [* so that WHS-N = 'which was felt to be pericarditis' can adjoin ]
        [* 'chest pain'. ]
        IN RNOPTS RE NSTGT:
        HOST IS NOT NHUMAN OR H-INST.
DPOS45 =
        [* Restricts 'BETWEEN' in LQ to after 'to':'to between 80 and 100']
        [* In other contexts 'between' is a normal Preposition. ]
        [* Note: the literal BETWEEN must be first option of LQ. ]
        IN LQ RE OPTION 'BETWEEN':
        PRECEDING WORD IS 'TO'.
WPOSINDEX = IN ENDMARK:
[* WPOS1 restricts compound noun NPOS + NVAR ]
[* WPOS2 restricts noun in PERUNIT in QUANT]
[* WPOS3 restricts preposition in P strings in OBJECT and PASSOBJ]
[* WPOS3A restricts DP in DP strings in OBJECT and PASSOBJ]
[* WPOS4 restricts preposition in PN in OBJBE]
[* WPOS4A restricts adverb D in LDR in OBJBE]
[* WPOS4B restricts adverb D in Q-OF in WHS-N for 'some of which']
[* WPOS5 restricts preposition in PQUANT and HOST if in RN]
[* WPOS6 restricts preposition in PVO ***FRENCH ONLY]
[* WPOS7 restricts noun in QN]
[* WPOS7A restricts QN-OF=ADJADJ for e.g. '2 days of abdominal pain']
[* WPOS8 restricts noun in QPER]
[* WPOS10 restricts NSTGT; simplified from EG86M restriction]
[* WPOS10A restricts NSTGT; simplified from EG86M restriction]
[* WPOS10B restricts LN to be empty before NTIME2: 'xray today' /= cpd noun]
[* WPOS11 restricts adjective in ADJPREQ in LQ]
[* WPOS12 restricts quantities in LQR in QPERUNIT in QUANT]
[* WPOS13 restricts noun in NSTGF]
[* WPOS14 restricts noun in SUBJECT]
[* WPOS15 restricts noun or ADJECTIVE in INTRODUCER]
[* WPOS16 * removed redundant form of WPOS12]
[* WPOS17 restricts the pronoun in OBJBE: not in SUB0 (* 'as she')]
[* WPOS18 restricts the noun or adjective in OBJBE]
[* WPOS18A restricts the noun or adjective in NSTGF, ASTGF]
[* WPOS18B restricts the noun in SUBJECT before NULLFRAG VERB]
[* WPOS19 not in use]
[* WPOS20 restricts noun in PROC in BESHOW]
[* WPOS21 restricts BESHOW: not both PROC and BESUBJ empty]
[* WPOS21A restricts SUBJECT in BESUBJ of BESHOW]
[* WPOS22 restricts noun in FTIME ***FRENCH ONLY]
[* WPOS23 restricts adverb in DSTG as object and in ND as object *E]
[* WPOS24 restricts adverb in NEGV ***FRENCH ONLY]
[* WPOS24A restricts QUE in NEGV ***FRENCH ONLY]
[* WPOS25 restricts article DE ***FRENCH ONLY]
[* WPOS26 restricts VING in VINGO of NVINGO ***FRENCH ONLY]
[* * WPOS27 restricts ADJ/D:DLA (a_little) in LA: must be D before ADJ]
[* WPOS28 restricts adverb in RV]
[* WPOS29 restricts verb in PVO in FRAGMENT ***FRENCH ONLY]
[* WPOS29A rare PVO-N FRAGMENT ***FRENCH ONLY]
[* WPOS30 restricts NISTG ***FRENCH ONLY]
[* WPOS31 restricts adverb in LDR in RNOPTS]
[* WPOS32 restricts VENO in OBJECTBE ***FRENCH ONLY]
[* WPOS33 restricts VERB in VENPASS ***FRENCH ONLY]
[* WPOS34 restricts PN in RA]
[* WPOS35 restricts PD ***ENG; restricts LT = PART=DE *E/***FRENCH]
[* WPOS36 restricts N to NSCALE in IN-DIM of SCALESTG]
[* WPOS37 restricts verb in TVO FRAGMENT **ENGLISH ONLY]
[* WPOS38 restricts the noun in OBJBE in BESHOW (WMED15)]
[* WPOS39 restricts NPOS ***ENG; restricts DES as P *E/***FRENCH]
[* WPOS39A restricts NPOS for NVAR = VING: elderly man lying...]
[* WPOS39B restricts NNN in SUBJ: 'EXAMINATION REVEALED'IS not NNN]
[* WPOS39C restricts NPOS to NULL if CORE of NVAR = 'affects'.]
[* WPOS39D restricts NPOS/NNN]
[* WPOS39E restricts NPOS/NNN]
[* WPOS39G restricts NNN: should not include VEN:H-SHOW in RN in SUBJ]
[* WPOS40 restricts the adjective in SCALESTG]
[* *WPOS41 restricts the adjective in ADJINRN; see WN50 *E]
[* WPOS42 restricts ':' not to occur in SUBJECT]
[* WPOS43 no time words in OBJECT after 'il (y) a' ***FRENCH]
[* WPOS44 restricts adjunct VINGO containing H-PTLOC: adjoins H-INDIC *E *F]
[* WPOS44A restricts PN containing H-PTLOC:HOST = H-INDIC; ]
[ also PN: P = in_that]
[* WPOS44B restricts WHS-N containing H-PTLOC: HOST = H-INDIC]
[* WPOS45 for expressions like 'maximum 1 par an' in OBJBE]
[* WPOS46 restricts PN in RN when P = DE/DES & N = H-INDIC *F]
[* WPOS46A-WPOS50 ***FRENCH]
[* WPOS51 restricts VENPASS in RNOPTS if VEN = VHAVE:'pt had']
[* WPOS52 restricts ADJINRN in RNOPTS: not VING/VEN,some ADJ]
[* WPOS52A restricts VEN = AVAR: not 'had' or 'been' after VHAVE]
[* WPOS53 restricts VENPASS: not OK if VEN has no POBJLIST]
[* WPOS54 force Q + N to QN in ADJADJ: '78 year old lady']
[* WPOS54A restricts QN in NVAR: nil NPOS: 'This 28 year old is...']
[* WPOS54B restricts QN in RN: contains 'old'? then HOST is H-PT or H-FAMILY]
[* WPOS55 restricts ADJ after Q or PERUNIT: 'pulse 96 regular']
[* WPOS56 restricts NULL in REG-ADJ in RQ; avoid double NULL]
[* WPOS57 restricts VENPASS in RN and SA to have >1 word]
[* WPOS57A restricts empty OBJECT/PASSOBJ not to have preceding NULL SA]
[* WPOS58 restricts VINGO in RN and SA to have >1 wordx, some exceptions]
[* WPOS59 restricts N in NQ to be NPREQ or NTIME1;]
[* WPOS60 restricts RSUBJ to T/Q:QROVING or PRO:PROSELF]
[* WPOS61 restricts BPART: CORE = H-PTAREA/H-PTPART: 'pain left arm']
[* WPOS62 restricts BPART: CORE in RN = H-PTAREA/H-PTPART]
[* WPOS62A restricts BPART: CORE of ADJ option is 'left'/'right'.]
[* WPOS63 restricts RNOPTS: no PN = 'with radiation..' on BPART HOST]
[* WPOS64 restricts VING, VEN in AVAR re 'following': no VHAVE, VBE, VDO]
[* WPOS65 restricts N in option A <*N> in PERUNIT is NTIME1:'(6 units) a day']
[* WPOS66 restricts Q in LA to before ADJ = H-INDIC:'4+ SICK']
[* WPOS66A restricts QN in LA is before ADJ = H-INDIC:'100 % stenotic']
[* WPOS67 restricts NVAR: not NUNIT if after Q; force QN ']
[* WPOS68 restricts NVAR: not 'past' if before 'history' ']
[* WPOS69 restricts TENSE in C1SHOULD and VDO before 'well']
[* WPOS70 restricts P/='to' in PN in RA or RV if V/VEN takes OBJ/POBJ = TOVO]
[* WPOS71 restricts VEN in NNN: not VDO,VBE,VHAVE]
[* WPOS72 restricts N/ADJ in NPOS; reject N, force APOS]
[* WPOS72A restricts N/ADJ in NVAR; not N if current word = N]
[* WPOS72B restricts NPOS; no bodypart NPOS in conjunct LN pre N:H-PTPART]
[* WPOS73 restricts TQ in TQVINGO; T/Q = QROVING ('each','all')]
[* WPOS74 restricts VING as NVAR: must be intransitive or NPOS non-empty]
[* WPOS75 restricts Q10S as VALUE of NVAR to be Q:QTENS]
[* * WPOS76 restricts Q:QTENS as value of NVAR in Q-DATE]
[* WPOS77 restricts Q:QTENS in LQR: *10S MG, *WARD 20S, ...]
[* WPOS78 restricts Q:QTENS in DATEVAR->LDATER:'in the 70S']
[* * WPOS79 restricts Q:QTENS in T-QPERUNIT in QUANT]
[* WPOS80 restricts VENPASS in RNOPTS in SUBJECT:'revealed']
[* WPOS80A restricts VINGO in RNOPTS if VING is H-SHOW: HOST/ = H-INST]
[* WPOS81 restricts VENPASS in SAOPTS in pre-SUBJECT SA:]
[* WPOS81A restricts VENPASS in RNOPTS in SUBJECT:'received']
[* WPOS81B restricts VENPASS in RNOPTS in SUBJECT:'failed']
[* WPOS81C restricts VENPASS in RNOPTS in SUBJECT:'stopped']
[* WPOS81D restricts VENPASS in RNOPTS in SUBJECT:'increased']
[* WPOS82 restricts TV in TVO: not 'left' pre PTPART or Q]
[* WPOS83 restricts QN-TIME in LP: must have upcoming P = TMPREP]
[* WPOS83A restricts NQ-TIME in LP to before P = TMPREP: 'day 2 post MI']
[* WPOS84 restricts QN in NVAR in SUBJECT. not TIME-PHRASE]
[* WPOS85 restricts VENPASS in RN in SUBJECT. not H-RESP]
[* WPOS86 restricts TV in VVAR: not 'left' pre PTPART; SUBJ not E-WV]
[* WPOS87 restricts SUB1 if OK for SUB3: 'while eating..']
[* WPOS88 restricts NTIME in RNOPTS and SAOPTS to NTIME2 (e.g. 'today')]
[* WPOS89 restricts PN (N = H-INDIC) in RNOPTS: HOST/=QN of time]
[* WPOS89A restricts PN (P = 'with', N = H-INDIC): not adjunct of N:H-INST]
[* WPOS90 restricts N/TV word in NVAR: no TV = H-OBSERVE with ]
[ NPOS = 'patient']
[* WPOS91 restricts PN if P = 'status post']
[* WPOS92 restricts TOVO as RN of various N ]
[* WPOS93 restricts PQUANT in RV of V with PN OBJECT; prefer P+Q+A+N]
[* WPOS94 restricts P in PVINGO in OBJBE to H-RESP: relieved_by, etc.]
[* WPOS95 restricts sentence-initial PN, P = 'status post' must be FRAGMENT]
[* WPOS96 restricts WHS-N starting with 'that' when deep in PN in RV]
[* WPOS97 restricts N in NVAR for some LN adjoinings: *'the Tuesday']
[* * WPOS98 restricts N in QTH in QVAR to N:NTH:'24th to 28th week']
[* WPOS99 restricts APOS starting with VEN: 'suggested','developed',..]
[* WPOS100 restricts SVO across conjunction, special case]
[* WPOS101 restricts double RN = PN where both Ps = 'of', with words between]
[* WPOS102 restricts APPOS in RNOPTS: only pairs of H-INST, H-PT, H-DEVMED]
[* WPOS103 restricts LNR = she'/'he' to H-PT (not H-FAMILY) in certain SECTION]
[* WPOS104 restricts TPOS = her'/'his' to H-PT (not H-FAMILY) in ]
[ certain SECTION]
[* WPOS105 restricts WHS-N if SUBJECT = NULLWH & verb is ]
[ H-SHOW:'which revealed']
[* WPOS106 restricts LQR in QPOS before N:NUNIT; prefer QN-OF or QN]
[* WPOS107 restricts N in N-PRE-S in WHS-N:'cultures, which results were..']
[* WPOS108 restricts PN in STRING-INITIAL SA: not P = H-NEG if OR ahead; FRAG.]
[* WPOS108A restricts VINGO in STRING-INITIAL SA: not VING = H-PTVERB]
[* WPOS109 restricts VENPASS. temporary for 'on oxygen and stopped smoking']
[* WPOS110 restricts option THIS-THAT of LA: 'had not been this elevated']
[* WPOS111 restricts NSTGO object of 'last' to be a time noun:]
[ 'lasted an hour']
[* WPOS112 restricts HOST of 'radiate': cannot be a bodypart.]
[* WPOS113 restricts 'diastolic','systolic' as N, also 'radiating']
[* WPOS114 restricts PVINGO in RNOPTS/RV/RA]
[* WPOS115 restricts QN in SA-LAST to have PHRASE-ATT = TIME-PHRASE]
[* WPOS116 restricts P of PDATE: only certain P and HOST =/ H-INST]
[* WPOS117 restricts BESHOW: allow ASSERTION after ':' or '-' in BESHOW.]
[* WPOS118 restricts QPERUNIT: not 'V' (Roman 5) as RN of N: 'no N,V or edema']
[* WPOS119 restricts NVAR = 'try': allow only if TPOS /= 0, or APOS->'another']
TRUE.
WPOS1 =
        [* Restriction on NPOS-NVAR combinations]
        IN NVAR:
        IF BOTH CORE IS N X1
        AND AT COELEMENT- LN CORE X2 OF NPOS EXISTS
        THEN NEITHER $LEFT NOR $BAD-PAIRS.
   $LEFT = BOTH X1 IS 'LEFT'
        AND X2 IS H-PT [The patient left with his prescriptions].
   $BAD-PAIRS = ONE OF $1, $2, $3, $4, $5.
   $1 = BOTH X1 IS H-TTMED
        AND X2 IS H-PT [(give) this lady aspirin].
   $2 = BOTH X1 IS H-PTFUNC
        AND AT X2 GO RIGHT; [NNN = N VEN; eg 'CVS revealed']
        VEN IS H-SHOW [CVS revealed pulse 148/min =LNR].
   $3 = BOTH X1 IS NTIME1
        AND X2 IS H-INST ['in ZZZ late January':X2=ZZZ, X1=January].
   $4 = BOTH X1 IS H-PTPART
        AND EITHER X2 IS H-DIAG ['DJD left hip': X1=hip, X2 DJD]
        OR X2 IS 'LEFT' ['DJD left hip': X1=hip, X2 left {as noun}].
   $5 = BOTH X1 IS 'CAUSES'
        AND X2 IS H-TTMED [Darvocet causes nausea].
WPOS1A =
        [* Restriction on 2 Ns in NNN, like NPOS-NVAR combinations in WPOS1]
        IN NNN:
        IF BOTH ELEMENT- NNN HAS COELEMENT- N X1
        AND VALUE OF ELEMENT- NNN IS N X2
        THEN NEITHER $LEFT NOR $BAD-PAIRS.
   $LEFT = BOTH X1 IS 'LEFT'
        AND X2 IS H-PT [The patient left town with his prescriptions].
   $BAD-PAIRS = ONE OF $1, $2, $3, $4, $5.
   $1 = BOTH X1 IS H-TTMED
        AND X2 IS H-PT [(give) this lady aspirin tablets].
   $2 = BOTH X1 IS H-PTFUNC
        AND AT X2 GO RIGHT; [NNN = N VEN; eg 'CVS revealed']
        VEN IS H-SHOW [CVS revealed pulse value 148/min =LNR].
   $3 = BOTH X1 IS NTIME1
        AND X2 IS H-INST ['in ZZZ late January':X2=ZZZ, X1=January].
   $4 = BOTH X1 IS H-PTPART
        AND EITHER X2 IS H-DIAG ['DJD left hip': X1=hip, X2 DJD]
        OR X2 IS 'LEFT' ['DJD left hip': X1=hip, X2 left {as noun}].
   $5 = BOTH X1 IS 'CAUSES'
        AND X2 IS H-TTMED [Darvocet causes nausea].
WPOS2 =
        [* The noun in PERUNIT must have attribute NUNIT and if in RN, ]
        [* then host is restricted as in WPOS5 for PQUANT: '20 globules ]
        [* blancs / champs', '1 comprime1 / jour', ]
        [* Also for 'blood pressure of 68 / palpation', allow N=palpation]
        IN PERUNIT:
        IF PRESENT-ELEMENT- IS NOT EMPTY
        THEN BOTH IF N EXISTS
        @THEN EITHER PRESENT-ELEMENT- IS NUNIT
        OR PRESENT-ELEMENT- IS 'PALPATION' OR 'PALP'
        ['blood pressure of 68 / palpation']
        AND IF ASCEND TO RNOPTS PASSING THROUGH QN @
        THEN HOST IS H-TXVAR OR H-TXSPEC OR H-INDIC OR H-PTFUNC
        OR H-PTMEAS OR H-PTPART OR H-PTAREA OR H-AMT
        OR H-TTMED OR H-RESP
        [same list as DPOS7B for QUANT].
WPOS3 =
        IN PN, PVINGO, PSVINGO, P1, PQUANT AFTER P:
        [* The P in OBJECT or PASSOBJ must be named as attribute of verb]
        [* for objects containing P. For PN, If PN is RV or SA then ]
        [* disqualify if P is named as attribute of PN object of verb ]
        [* or as DP attribute of DP2 object of verb: 'coughed up sputum']
        [* For PN,PVINGO in RV or SA, P is not 'of'. 4/23/98 ]
        [* $ACTPNSA and $PASSPNSA attempt to do for SA PN the same as is]
        [* done for RV PN (not same P as needed for OBJECT or PASSOBJ). ]
        ALL OF $OBJ-PTEST, $POBJ-PTEST, $RV-PNTEST, $SA-PNTEST.
   $OBJ-PTEST =
        IF EITHER IMMEDIATE-NODE X10 OF PRESENT-ELEMENT X1 IS OBJECT
        OR BOTH X10 IS PNN OR PNVINGSTG OR NPN OR VINGSTGPN OR PSVINGO
        OR PNTHATS OR NPVINGSTG OR NPSVINGO OR NPVINGO OR DP1PN X1
        AND IMMEDIATE-NODE OF X10 IS OBJECT X10
        THEN DO $PTEST.
   $PTEST = IF AT X10, $OBJ-PN-PVAL IS TRUE
        THEN BOTH PRESENT-ELEMENT- HAS ELEMENT P X3
        AND $COMMON-ATTRB23 IS TRUE.
   $POBJ-PN-PVAL = THE CORE X11 OF THE VERB-COELEMENT HAS
        ATTRIBUTE POBJLIST:X1:PVAL X2.
   $COMMON-ATTRB23 = LISTS X2 AND X3 HAVE A COMMON ATTRIBUTE.
   $POBJ-PTEST = IF X10 [IMMEDIATE-NODE] IS PASSOBJ
        THEN IF AT X10 $POBJ-PN-PVAL IS TRUE
        THEN BOTH PRESENT-ELEMENT- HAS ELEMENT P X3
        AND $COMMON-ATTRB23 IS TRUE.
   $OBJ-PN-PVAL = THE CORE X11 OF THE VERB-COELEMENT HAS
        ATTRIBUTE OBJLIST:X1:PVAL X2.
   $RV-PNTEST = IF BOTH X10 IS RV
        AND PRESENT-ELEMENT- IS PN OR PVINGO OR PSVINGO X12
        THEN AT X10 ALL OF $NOT-OF-RV,$PASSPN,$PASSNPN,
   $ACTPN,$ACTNPN.
   $NOT-OF-RV = AT X12 ELEMENT P IS NOT 'OF'.
   $PASSPN = IF BOTH IMMEDIATE-NODE X11 IS LVENR
        AND IMMEDIATE-NODE OF X11 IS VENPASS
        THEN AT HOST IF $POBJ-PNPVAL
        THEN $NOCOMMONP1 IS TRUE.
   $POBJ-PNPVAL = EITHER PRESENT-ELEMENT- HAS ATTRIBUTE POBJLIST: PN: PVAL X1
        OR PRESENT-ELEMENT- HAS ATTRIBUTE POBJLIST: PVINGO: PVAL X1.
   $NOCOMMONP1 = AT X12, LISTS P AND X1 HAVE NO COMMON ATTRIBUTE. (GLOBAL)
   $PASSNPN = IF BOTH THE PREVIOUS-ELEMENT- IS PASSOBJ X11
        WHERE VALUE IS NULLOBJ
        AND AT CORE OF VERB-COELEMENT OF X11
   $POBJ-PNPVAL IS TRUE
        THEN $NOCOMMONP1 IS TRUE [He was removed from office].
   $ACTPN = IF BOTH IMMEDIATE-NODE X11 IS NOT VENPASS
        AND BOTH IMMEDIATE-NODE OF X11 IS NOT VENPASS
        AND THE PREVIOUS-ELEMENT- IS NOT OBJECT
        THEN AT HOST BOTH $P-TEST AND $DP-TEST.
   $P-TEST = IF $OBJ-PNPVAL IS TRUE
        THEN $NOCOMMONP1 IS TRUE.
   $OBJ-PNPVAL = PRESENT-ELEMENT- HAS ATTRIBUTE OBJLIST:PN:PVAL X1.
   $DP-TEST = IF PRESENT-ELEMENT- HAS ATTRIBUTE OBJLIST: DP2: DPVAL X1
        THEN $NOCOMMONP1 IS TRUE.
   $ACTNPN = IF BOTH THE PREVIOUS-ELEMENT- IS OBJECT X11 WHERE VALUE IS
        NSTGO
        AND AT X11 $OBJ-NPN-PVAL IS TRUE
        THEN $NOCOMMONP1 [They removed him from office].
   $OBJ-NPN-PVAL = CORE OF VERB-COELEMENT HAS ATTRIBUTE
        OBJLIST:NPN:PVAL X1.
   $SA-PNTEST = IF BOTH X10 IS SAOPTS
        AND PRESENT-ELEMENT- IS PN OR PVINGO X12
        THEN AT X10 ALL OF $NOT-OF-SA, $ACTPNSA, $PASSPNSA.
   $NOT-OF-SA = AT X12
        IF ELEMENT P IS 'OF'
        THEN IMMEDIATE SA OF X10 IS STRING INITIAL
        [Of these options, she elected to have surgery]
        [*She elected to have surgery of these options].
   $ACTPNSA =
        IF AT IMMEDIATE-NODE OF X10
        BOTH PREVIOUS-ELEMENT- IS VERB OR LVINGR OR LVENR
        OR LVR X7
        AND IMMEDIATE-NODE IS NOT VENPASS
        THEN BOTH $GET-LAST-V
        AND IF $OBJ-PNPVAL
        THEN $NOCOMMONP1.
   $GET-LAST-V =
        CORE- X-VERB-CORE OF X7 EXISTS;
        DO $GET-LAST-VERB.
   $GET-LAST-VERB =
        EITHER ITERATE $CONJOINED-VERBS OR TRUE;
        DO CORE-;
        STORE IN X-LAST-VERB.
   $CONJOINED-VERBS =
        EITHER $ASCNT [*In CORE routine, if in VVAR go up one ]
        OR TRUE;
        PRESENT-ELEMENT- HAS NODE ATTRIBUTE POSTCONJELEM;
        STORE IN X-POSTCONJ.
   $PASSPNSA =
        IF AT X10
        IMMEDIATE VENPASS EXISTS
        WHERE ELEMENT- LVENR X7 EXISTS
        THEN BOTH $GET-LAST-V
        AND IF AT X-LAST-VERB $POBJ-PNPVAL IS TRUE
        THEN $NOCOMMONP1.
WPOS3A =
        IN DP1, DP2, DP3, DP1PN AFTER DP:
        [* The DP in OBJECT or PASSOBJ strings beginning with DP must be]
        [* the DP named as the value of the DPVAL attribute of these ]
        [* strings on the OBJLIST attribute of the governing verb. ]
        BOTH $OBJ-DPTEST AND $POBJ-DPTEST.
   $OBJ-DPTEST =
        IF IMMEDIATE-NODE X10 OF PRESENT-ELEMENT X1 IS OBJECT
        THEN IF AT X10, $OBJ-DPVAL IS TRUE
        THEN BOTH PRESENT-ELEMENT- HAS ELEMENT DP X3
        AND $COMMON-ATTRB23 IS TRUE.
   $OBJ-DPVAL = CORE X11 OF THE VERB-COELEMENT HAS ATTRIBUTE
        OBJLIST:X1:DPVAL X2.
   $COMMON-ATTRB23 = LISTS X2 AND X3 HAVE A COMMON ATTRIBUTE.
   $POBJ-DPTEST =
        IF X10 [IMMEDIATE-NODE] IS PASSOBJ
        THEN IF AT X10 $POBJ-DPVAL IS TRUE
        THEN BOTH PRESENT-ELEMENT- HAS ELEMENT DP X3
        AND $COMMON-ATTRB23 IS TRUE.
   $POBJ-DPVAL = CORE X11 OF COELEMENT LVENR HAS ATTRIBUTE
        POBJLIST:X1:DPVAL X2.
WPOS4 =
        [* Certain prepositions are restricted in PN in OBJBE]
        IN OBJBE AFTER PN:
        AT PN IF P IS 'OF'
        THEN EITHER CORE- X1 OF NSTGO IS 'SIZE' ['of same size']
        OR 'NATURE' OR 'TYPE' ['of unclear nature']
        OR 'ORIGIN' ['of frontal origin']
        OR 'DEGREE' ['of mild degree']
        OR BOTH CORE-ATT OF X1 HAS MEMBER H-DIAG OR H-INDIC
        OR H-TTSURG
        AND AT IMMEDIATE OBJECT CORE- OF COELEMENT- SUBJECT
        IS NSENT1 [impression is of COAD]
        OR H-TMLOC [Past medical history is of COAD]
        [PMH is of left diaphragmatic hernia repair].
WPOS4A =
        [* Certain adverbs are allowed in LDR in OBJBE: 'was down/up']
        IN OBJBE AFTER LDR:
        BOTH CORE X1 IS DPRED
        AND AT X1 IF VALUE OF RIGHT-ADJUNCT IS PQUANT OR QPERUNIT
        THEN X1 IS H-AMT OR H-CHANGE OR H-CHANGE-MORE OR
        H-CHANGE-LESS OR H-CHANGE-SAME
        [NS: RD has no PQUANT or QPERUNIT].
WPOS4B =
        [* Restricts adverb D in Q-OF in WHS-N for 'some of which';]
        [* 'some_of'=D:DLT. Note: <Q-OF> also has option <*Q> OF : ]
        [* 'Two of his brothers also had atherosclerotic disease'. ]
        IN Q-OF AFTER D:
        BOTH ELEMENT- D X1 IS DLT
        AND X1 IS H-AMT [some_of, a_bit_of].
WPOS4C =
        [* Wfdness restr, same constraints as DPOS11A ]
        [* Restricts adverbs in SA to DSA - 'Finally he left'; ]
        [* Restricts adverbs in SA-LAST to DSA OR DRV - 'He left finally',]
        [* 'He answered questions appropriately'. ]
        [* Allows H-NEG adverbs 'not', 'never' in SACONJ: ]
        [* E.g. 'diaphoresis but not shortness of breath'. ]
        IN SAOPTS AFTER LDR:
        EITHER CORE X1 IS 'NOT'
        WHERE X1 IS OCCURRING IN SACONJ
        OR EITHER X1 IS D:DSA
        OR BOTH X1 IS D:DRV
        AND IMMEDIATE-NODE IS SA-LAST.
WPOS5 =
        [* For PQUANT: test P and host if in RN: 'fie2vre a2 38' ]
        [* Also reject PQUANT if current word in N because more ]
        [* likely this is a PN containing non-empty QPOS, as in ]
        [* 'His pain began on 04/04/00 , when he developed substernal ]
        [* chest pain and obtained relief with three sublingual ]
        [* nitroglycerin'. Here PQUANT = 'with three' leaves ]
        [* 'sublingual nitroglycerin' to be object of 'began'. Another]
        [* solution would be to put PN before PQUANT in RNOPTS but ]
        [* there are reasons for the given order of options. ]
        IN PQUANT:
        IF IMMEDIATE RNOPTS EXISTS@
        THEN BOTH HOST IS H-TXVAR OR H-TXSPEC OR H-INDIC OR H-PTFUNC
        OR H-PTMEAS OR H-PTPART OR H-PTAREA OR H-AMT
        OR H-DIAG OR H-TTSURG
        OR H-TTMED OR H-RESP [BP response down to the 140s]
        OR H-CHANGE OR H-CHANGE-MORE OR H-CHANGE-LESS
        OR H-CHANGE-SAME
        [same list as DPOS7A for QUANT]
        OR H-AGE ['age of 12']
        AND CURRENT WORD IS NOT N
        [e.g. 'sublingual_nitroglycerin' of above example].
WPOS7 =
        [* N in QN must be NUNIT, eg 'four years', 'five feet'. ]
        [* Or N in QN is 'lead' and QN is in EKGSTG: '12 lead ecg'.]
        [* Exception to NUNIT: OK N='pulse' for '92 pulse , blood ]
        [* pressure 131/66'.]
        IN QN AFTER N:
        EITHER N X1 IS 'PULSE' OR 'PULSES'
        OR BOTH X1 IS NUNIT
        AND IF X1 IS 'LEAD'
        THEN CURRENT WORD IS N:E-EKGPROC.
WPOS7A =
        [* QN-OF is special string for e.g. '2 days of abdominal pain'. ]
        [* We need 'pain' to be core of the LNR for WCONJ9 to succeed in ]
        [* in e.g. 'Fatigue and 2 days of abdominal pain'. Restricts N in]
        [* QN-OF and words to follow with same tests as in WPOS10$NOT-RV.]
        [* 4/10/01 Extend QN-OF to EKG for e.g. '2 mm of ST depression'. ]
        [* 12/18/01 Extend QN-OF for 'Drinks 2-3 ounces of alcohol per day'.]
        [* Should perhaps be done by WCOMP-ATT-RN with HOST-=QN; no go today]
        IN QN-OF:
        IN QN
        BOTH ELEMENT- N X1 IS NUNIT [day,week,year = N:(NTIME1, NUNIT)]
        AND ONE OF $EKG, $AMT, $TIME.
   $EKG = BOTH CURRENT WORD IS NOT NTIME1
        AND $E-CURRENT
        ['2 mm of ST depression', *'2 minutes of ST depression'].
   $E-CURRENT = GO TO CURRENT WORD;
        STORE IN X-TMP;
        X-TMP IS N:E-INTVL OR E-WV OR E-AX
        ['one millimeter of ST elevation'].
   $AMT = BOTH X1 IS NOT NTIME1
        AND $INDIC-CURRENT.
   $INDIC-CURRENT = GO TO CURRENT WORD;
        STORE IN X-TMP;
        X-TMP IS N:H-INDIC
        [2-3 ounces of alcohol per day].
   $TIME = BOTH ELEMENT- N IS NTIME1
        AND ONE OF $CURRENT, $NEXT, $OTHER-NEXT.
   $CURRENT = GO TO CURRENT WORD;
        STORE IN X-TMP;
        X-TMP IS N:H-INDIC OR H-DIAG ['one hour of pain'].
   $NEXT = GO TO CURRENT WORD;
        STORE IN X-TMP;
        X-TMP IS ADJ:H-PTPART;
        GO TO X-TMP;
        GO TO NEXT WORD;
        STORE IN X-TMP;
        X-TMP IS N:H-INDIC OR H-DIAG ['one hour of abdominal pain'].
   $OTHER-NEXT =
        GO TO CURRENT WORD;
        STORE IN X-TMP;
        X-TMP IS N:H-PTPART;
        GO TO X-TMP;
        GO TO NEXT WORD;
        STORE IN X-TMP;
        X-TMP IS N:H-INDIC OR H-DIAG
        ['1 hour of chest pain'].
WPOS8 =
        [* N in QPER must be NUNIT]
        IN QPER AFTER N: N IS NUNIT.
WPOS9 =
        [* No nominative pronoun in object position; no pronoun ]
        [* THIS or THAT or HER or ONE or BOTH before an ADJ or N ]
        [* unless ADJ or N word is also TV or W: 'This may be...' ]
        [* 9/16/98 removed the "unless" exception til needed; e.g.]
        [* in 'on her left side' 'left' is ADJ/TV; we do not want ]
        [* parse with 'on her' + 'left side'.]
        [* 1/14/02 Must allow some N/TV after THIS/THAT, e.g.'This]
        [* needs to be done'. OK if THIS/THAT=SUBJECT and N/TV has]
        [* TV:(SINGULAR),e.g.'needs'. Maybe treat HER as special. ]
        [* WPOS9 seems to overlsp WN11. Perhaps combine them. ]
        [* 10/14/98 Empty LN before PRO='this' or 'that' except OK]
        [* TPOS with core DLTPRO: 'even this', 'only that'. ]
        [* 8/30/99 ADJ/D OK after 'this': `This later returned to ]
        [* normal. LATER ADJ/D]
        [* 7/3/2002 WPOS11 does better on THIS/THAT/ONE. Hold test]
        [* of HER/BOTH til needed and add to WN11 then.]
        IN LNR AFTER NVAR:
        IF CORE- IS PRO X1
        THEN IF IMMEDIATE-NODE OF IMMEDIATE-NODE IS NSTGO
        THEN X1 IS NOT NOMINATIVE.
WPOS10 =
        [* Simplify WPOS10 IN MDPAR6, restrict NSTGT ]
        [* 9/30/98 restrict SUBJECT not to be OK NSTGT]
        [* 12/30/00 restrict NSTGT in RV not to include H-INDIC/H-DIAG ]
        [* so that RV does not capture time OBJECT as in ]
        [* 'The patient experienced one hour of abdominal pain'. ]
        IN LNR AFTER NVAR: ALL OF $NOT-SUBJ, $NOT-RV, $YES-NSTGT.
   $NOT-SUBJ =
        IF IMMEDIATE-NODE X2 OF IMMEDIATE-NODE IS SUBJECT
        THEN ALL OF $NOT-NTIME2, $NOT-NTIME1, $NOT-QN.
   $NOT-NTIME2 = IF CORE X1 IS NTIME2
        WHERE LEFT-ADJUNCT OF X1 IS EMPTY [today]
        THEN CURRENT WORD IS TV:VBE [Today is his first visit].
   $NOT-NTIME1 = IF X1 IS NTIME1 [OR H-TTGEN prevents 'studies were made']
        THEN EITHER CURRENT WORD IS TV:VBE
        [Patient thought day was 02/28/1998]
        OR EITHER AT LN CORE- OF TPOS IS T
        ['THIS' OR 'THAT' OR 'A' OR 'AN' OR 'THE']
        [ OR 'HIS' OR 'HER' replaced by T]
        ['A date/time for surgery was arranged']
        OR X1 IS 'HR' [HR=heart rate; 'heart rate 97'].
   $NOT-QN = NOT $QN.
   $QN =
        X1 IS QN [5/27/96 all Q+N are to be QN, not QPOS+NVAR]
        WHERE AT ELEMENT- N X10
        BOTH X10 IS NTIME1 OR H-TTGEN OR TIMETAG X-ATTRB
        [TIMETAG is for e.g. 'times_a_day' = NUNIT, TIMETAG]
        AND ONE OF $RIGHT, $LEFT, $SPECIAL.
   $RIGHT = EITHER COELEMENT- SCALESTG EXISTS
        WHERE IT- IS NOT EMPTY
        [e.g.'ago' in '3 days ago']
        OR WORD FOLLOWING PRESENT NODE IS
        P OR ADJ OR D OR VING:TIMETAG OR H-TMPREP.
   $LEFT = AT IMMEDIATE NVAR OF X1
        COELEMENT- LN SUBSUMES T OR ADJ OR VING:TIMETAG
        ['the first 3 days' in 'the first 3 days she had a fever']
        [ Note: $NOT-QN in $NOT-SUBJ will fail 'the first 3 days ]
        [ were difficult'].
   $SPECIAL = X-ATTRB IS TIMETAG [e.g. 'times_a_week'].
   $NOT-RV =
        IF X2 IS NSTGT
        THEN NOT BOTH IMMEDIATE-NODE OF X2 IS RV
        WHERE HOST- IS H-PTVERB
        [e.g. 'experienced'; HOST test may not be needed]
        AND BOTH CORE- [of LNR] IS QN
        WHERE N IS NTIME1 ['hour','day']
        AND BOTH CURRENT WORD IS 'OF'
        AND ONE OF $NEXT, $NEXT2, $OTHER-NEXT2
        [must check sent words because LNR=LN+NVAR here].
   $NEXT = GO TO NEXT WORD;
        STORE IN X-TMP;
        X-TMP IS N:H-INDIC OR H-DIAG ['one hour of pain']
        OR H-TTMED ['continue 30 days of Plavix].
   $NEXT2 = GO TO NEXT WORD;
        STORE IN X-TMP;
        X-TMP IS ADJ:H-PTPART;
        GO TO X-TMP; GO TO NEXT WORD;
        STORE IN X-TMP;
        X-TMP IS N:H-INDIC OR H-DIAG
        ['one hour of abdominal pain'].
   $OTHER-NEXT2 =
        GO TO NEXT WORD;
        STORE IN X-TMP;
        X-TMP IS N:H-PTPART;
        GO TO X-TMP;
        GO TO NEXT WORD;
        STORE IN X-TMP;
        X-TMP IS N:H-INDIC OR H-DIAG
        ['1 hour of chest pain'].
   $YES-NSTGT =
        IF X2 IS NSTGT
        THEN ONE OF $NTIME2, $NTIME1, $QN.
   $NTIME2 = CORE X1 IS NTIME2 [yesterday]
        WHERE LEFT-ADJUNCT OF X1 IS EMPTY.
   $NTIME1 = BOTH X1 IS NTIME1 OR H-TTGEN [day, visit]
        AND BOTH ONE OF $TIMETAG, $Q-TIMES, $FOLLOW-UP, $NN
        AND IF X1 IS H-TTGEN
        THEN X1 IS NOT 'CARE' OR 'DIAGNOSTIC' OR 'CLARIFICATION'
        OR 'EVALUATION'
        [In 'patient was also offered to have a primary care ]
        [physician assigned to him', NSTGT =/ 'a primary care']
        [Must generalize for H-TTGEN words OK for time phrase.]
        [In 'She did have some preoperative evaluation , including ]
        [carotid ultrasound which showed no hemodynamically significant ]
        [stenosis in the bilateral carotids', NSTGT='some preoperative ]
        [evaluation' (evaluation H-TTGEN) leaves 'She did have carotids']
        [as main ASSERTION.].
   $TIMETAG =
        AT LN
        EITHER ONE OF $SUB-T, $SUB-D, $SUB-ADJ, $SUB-VING
        [this visit, yesterday evening, next morning, the following day]
        [These most likely are NSTGT, but OK SUBJECT with 'this','that']
        OR EITHER ONE OF $P, $ADJ, $D, $VING
        OR CURRENT WORD IS 'OF' [the night of admission].
   $SUB-T = PRESENT-ELEMENT- X10 SUBSUMES T:TIMETAG.
   $SUB-D = PRESENT-ELEMENT- X10 SUBSUMES D:TIMETAG.
   $SUB-VING = PRESENT-ELEMENT- X10 SUBSUMES VING:TIMETAG.
   $SUB-ADJ = PRESENT-ELEMENT- X10 SUBSUMES ADJ:TIMETAG.
   $P = CURRENT WORD IS P:TIMETAG OR H-TMPREP.
   $ADJ = CURRENT WORD IS ADJ:TIMETAG OR H-TMPREP.
   $D = CURRENT WORD IS D:TIMETAG OR H-TMPREP.
   $VING = CURRENT WORD IS VING:TIMETAG OR H-TMPREP.
   $Q-TIMES = BOTH X1 IS 'TIME' OR 'TIMES'
        AND IN LEFT-ADJUNCT OF X1
        EITHER TPOS IS 'THIS' OR 'THAT' OR 'THESE'
        OR 'THOSE' [This time she...]
        OR QPOS IS NOT EMPTY [Many times he...].
   $FOLLOW-UP = X2 IS OCCURRING IN BESHOW
        WHERE BESUBJ SUBSUMES 'FOLLOWUP' OR 'FOLLOW-UP' OR
        'FOLLOW_UP' OR 'FOLLOW UP' OR 'FOLLOW'_'UP'.
   $NN = BOTH X1 IS NTIME1
        AND IN LEFT-ADJUNCT OF X1
        CORE- OF NPOS IS NTIME2 [tomorrow morning].
WPOS10A =
        [* Simplify WPOS10A IN MDPAR6 ]
        IN NSTGT:
        IF RIGHT-ADJUNCT OF CORE IS ADJINRN
        @THEN CORE IS TIMETAG
        [Note WPOS10A is needed because WPOS10 is executed after NVAR ]
        [so does not check the word following NVAR except by CURRENT WORD,]
        [e.g. 'before' in 'the day before' or 'later' in 'some time later'].
WPOS10B =
        [* Restricts LN to be empty before NTIME2:'xray today' =/ LN+NVAR]
        [* in 'We will order an xray today'. Problem remains:'just today']
        IN NVAR:
        IF CORE- IS NTIME2 [= today/tomorrow/yesterday]
        THEN COELEMENT- LN IS EMPTY.
WPOS11 =
        [* Allow ADJ before Q only if it has attribute APREQ. '..in the last]
        [* two visits' - 'last' APREQ]
        IN LQ AFTER ADJPREQ:
        IN ELEMENT- ADJPREQ
        VALUE IS ADJ:APREQ.
WPOS12 =
        [* Allow quantities to be specified in QUANT if they are QNUMBER: ]
        [* 'pulse is 76', *'pulse is all'.Also, restrict QPERUNIT as RN; ]
        [* In 'no edema, 2+ pulses upper extremity' '2+' is not RN of 'edema']
        [* 11/2/2001 Force Q:QTENS to option Q10S in NVAR so WPHRASE-Q10S can]
        [* assign TIME-PHRASE or AGE-PHRASE or QUANT-PHRASE.]
        [* 9/13/2002 Disallow 'I' as Q in QPERUNIT in RNOPTS if next word is ]
        [* TV or W and 'I' occurs after a comma; 'I' is the pronoun subject ]
        [* of the verb, as in 'Cellulitis after a bite , I reassured her'. ]
        IN QPERUNIT AFTER LQR:
        BOTH BOTH CORE- X1 OF LQR IS Q:QNUMBER
        AND X1 IS NOT QTENS
        AND IF IMMEDIATE RNOPTS EXISTS
        WHERE WORD PRECEDING PRESENT NODE IS ','
        THEN BOTH CURRENT WORD IS NOT N:H-PTFUNC
        ['pulses'in 'no edema, 2+ pulses']
        AND IF X1 IS 'I'
        THEN CURRENT WORD IS NOT TV OR W
        ['reassured' in 'cellulitis after a bite, I reassured her'].
WPOS13 =
        [* Simplified restriction for NSTGT]
        IN NSTGF: CORE IS NOT NTIME1 OR NTIME2.
WPOS14 =
        [* A word with attribute NTIME1 or NTIME2 cannot be core of SUBJECT or]
        [* BESUBJ unless current word is VBE: 'Yesterday was her first visit'.]
        [* SUBJECT is PRO:ACCUSATIVE only if SUBJECT is in SVINGO, SVO, SVEN: ]
        [* 'see him taking his pills', 'I will have her see the nurse', 'She ]
        [* decided to have them removed', or is in FORTOVO:' for him to be ]
        [* discharged'; or is in SOBJBE: 'found him wet'. ]
        [* 6/28/01 No SUBJECT = 'I' as N: E-LEAD: 'I will see her' does]
        [* not have subject N:E-LEAD.]
        [* 12/9/03 Allow any BESUBJ before ':'. If parser has reached BESHOW ]
        [* in the grammar then whatever precedes the colon has to be accepted.]
        [* For example as in 'ESTIMATED BLOOD LOSS : Minimal' and 'TOURNIQUET ]
        [* TIME : 89 minutes'. ]
        IN SUBJECT, BESUBJ:
        IF PRESENT-ELEMENT- IS BESUBJ
        WHERE WORD FOLLOWING PRESENT NODE IS ':' OR '-'
        THEN TRUE
        ELSE
        BOTH IF BOTH CORE- X1 IS NTIME1 OR NTIME2
        AND X1 IS NOT 'HR' [allow HR = 'heart rate' as subject]
        [HR is both NTIME1 for 'hour' and H-PTFUNC for 'heart rate']
        THEN CURRENT WORD IS TV:VBE
        AND BOTH IF X1 IS ACCUSATIVE
        THEN BOTH PRESENT-ELEMENT- IS SUBJECT@
        AND EITHER IT- IS OCCURRING IN SVINGO OR SVEN OR FORTOVO
        OR SOBJBE
        [witness them administering the test,]
        [have them looked into ]
        [for him to be discharged ]
        [found him wet]
        OR IT- IS OCCURRING IN ASSERTION
        WHERE IMMEDIATE SVO EXISTS
        [have her see a nurse]
        AND IF BOTH X1 IS 'I'
        AND X1 IS N:E-LEAD
        THEN X1 IS OCCURRING IN WVVAR.
WPOS15 =
        IN INT-PHRASE:
        IF CORE- X1 OF FIRST ELEMENT EXISTS
        THEN ONE OF $DATE, $ATTRB.
   $DATE = X1 IS DT.
   $ATTRB = IF CORE-ATT X2 OF X1 EXISTS [must succed if X1 is literal]
        THEN X2 HAS MEMBER
        H-PTPART OR H-PTFUNC OR H-TXCLIN OR H-PTSPEC
        OR H-FAMILY [Family History: She has no family history of CAD]
        OR H-TXSPEC [CBC: heme 9.2]
        OR H-TMLOC [PMH, Date_of_birth : 10/18/22]
        OR H-TMDUR [Course in the Emergency Room : ...]
        OR H-TXPROC OR H-TXCLIN OR H-TTSURG
        OR H-TTGEN OR H-TTCOMP [Anesthesia: spinal]
        OR H-DIAG [Glaucoma: She ...; PREOPERATVE DIAGNOSIS: ...]
        OR H-ALLERGY [ALLERGIES: Drug sensitivity to Darvon]
        OR H-INDIC [Weakness: He...; PROBLEM lIST: ...]
        OR H-DESCR [General: Elderly female in no acute distress]
        OR H-DIET [DIET: cardiac]
        OR H-RECORD [Original report].
WPOS17 =
        [* Disallow PRO as OBJBE in SUB0, e.g. SUB0 = 'as she' in ]
        [* 'Plan is to observe her for a while longer, and as she has ]
        [* presented this way previously, possibly discharge to home.']
        IN OBJBE:
        IF CORE X1 IS PRO
        THEN PRESENT-ELEMENT- IS NOT OCCURRING IN SUB0.
WPOS18 =
        [* Appropriate subclass in predicate]
        [* Restrict some WPOS18 preds to PLAN in SECT-NAME in SECTION ]
        [* e.g. names of tests to be performed, in $PLAN.]
        IN OBJBE:
        IF CORE X1 IS N OR ADJ OR PRO
        THEN ALL OF $PRED-CORE, $NEVER-PRED, $IF-NO-SUBJ.
   $PRED-CORE = CORE-ATT X2 OF X1 EXISTS.
   $NEVER-PRED =
        EITHER X1 HAS NODE ATTRIBUTE COMPUTED-ATT [broken arm]
        OR IF X1 IS H-PTPART [arm]
        THEN EITHER $NOT-LONE-PTPART
        OR BOTH X1 IS ADJ ['pulmonary_related']
        AND BOTH IF CORE-ATT OF ULTIMATE-SUBJECT EXISTS@
        THEN IT- HAS MEMBER H-INDIC OR H-DIAG
        [fever was felt to be pulmonary related]
        AND IF CORE-ATT OF ULTIMATE-HOST EXISTS@
        THEN IT- HAS MEMBER H-INDIC OR H-DIAG.
   $NOT-LONE-PTPART = AT X1 NOT BOTH LEFT-ADJUNCT IS EMPTY
        AND RIGHT-ADJUNCT IS EMPTY.
   $IF-NO-SUBJ =
        IF IT IS NOT THE CASE THAT
        EITHER IMMEDIATE OBJECT EXISTS [not in fragment]
        OR COELEMENT BESUBJ EXISTS WHERE PRESENT-ELEMENT- IS NOT EMPTY
        THEN BOTH $CHECK-ATT AND $PLAN.
   $CHECK-ATT =
        EITHER $PRED-VALUE
        OR EITHER BOTH AT X1 [the noun whose core-att is X2]
        X2 HAS MEMBER H-PT OR H-TXCLIN OR H-PTPART
        OR H-PTAREA OR H-FAMILY [mother in her 60s]
        AND RIGHT-ADJUNCT OF X1 IS NOT EMPTY
        [patient pre1sentant une douleur...]
        [61 year old with RA]
        OR BOTH X1 [the noun whose core-att is X2] IS H-PTFUNC
        AND AT X1
        EITHER PRESENT-ELEMENT- SUBSUMES 'SOUNDS'
        ['Heart sounds 1 and 2.']
        OR RIGHT-ADJUNCT OF X1 IS PQUANT
        ['Heart rate in the 90s'].
   $PRED-VALUE = X-PRED := LIST WPOS18-PRED;
        X2 HAS MEMBER X-PRED.
   $PLAN = IF X2 HAS MEMBER H-TXSPEC OR H-TXVAR OR H-TXPROC OR H-TXCLIN
        THEN IF IMMEDIATE-STRING IS OCCURRING IN ONESENT
        WHERE ELEMENT- SECTION EXISTS@
        THEN THE SECOND ELEMENT OF SECT-NAME IS 'PLAN' OR
        'ADMINISTRATION'.
WPOS18A =
        IN NSTGF, ASTGF:
        THE CORE X1 EXISTS;
        ALL OF $PRED-CORE, $NEVER-PRED1, $CHECK-ATT1.
   $PRED-CORE = CORE-ATT X2 OF X1 EXISTS.
   $NEVER-PRED1 = EITHER X1 HAS NODE ATTRIBUTE COMPUTED-ATT [broken arm]
        OR IF X1 IS H-PTPART [arm]
        THEN EITHER $NOT-LONE-PTPART OR $4.
   $NOT-LONE-PTPART = AT X1 NOT BOTH LEFT-ADJUNCT IS EMPTY
        AND RIGHT-ADJUNCT IS EMPTY.
   $CHECK-ATT1 = ONE OF $1, $2, $3, $4.
   $1 = X-PRED := LIST WPOS18-PRED;
        X2 HAS MEMBER X-PRED;
        IF X2 HAS MEMBER H-TXSPEC OR H-TXVAR OR H-TXPROC
        THEN IF IMMEDIATE-STRING OF X1 IS OCCURRING IN ONESENT
        WHERE ELEMENT- SECTION EXISTS@
        THEN THE SECOND ELEMENT OF SECT-NAME IS 'PLAN'.
   $2 = BOTH AT X1 [the noun whose core-att is X2]
        X2 HAS MEMBER H-PT OR H-TXCLIN OR H-PTPART OR H-PTAREA
        OR H-FAMILY [mother in her 60s]
        AND RIGHT-ADJUNCT OF X1 IS NOT EMPTY
        [patient pre1sentant une douleur...]
        [61 year old with RA].
   $3 = BOTH X1 [the noun whose core-att is X2] IS H-PTFUNC
        AND AT X1
        EITHER PRESENT-ELEMENT- SUBSUMES 'SOUNDS'
        ['Heart sounds 1 and 2.']
        OR RIGHT-ADJUNCT OF X1 IS PQUANT
        ['Heart rate in the 90s'].
   $4 = EITHER X1 IS 'CODE' [DNR status : full code]
        OR 'PULMONARY' [problem 1 : pulmonary]
        OR 'CHEST' OR 'PELVIS' OR 'HIP'[for xrays]
        OR 'CARDIAC' [Diet: cardiac]
        [to be generalized]
        OR BOTH X1 IS 'SPINAL' [12/18/99 Ortho 'anesthsia: spinal']
        AND BOTH IMMEDIATE ASTGF IS OCCURRING IN FRAGMENT
        WHERE AT IMMEDIATE CENTER COELEMENT- INTRODUCER EXISTS@
        AND VALUE OF ELEMENT- INT-PHRASE [under INTRODUCER] IS LNR
        WHERE CORE- IS 'ANESTHESIA'.
WPOS18B =
        [* restricts the noun in SUBJECT before NULLFRAG verb; ]
        [* prevents, e.g. H-PTPART word from being a fragment. ]
        [* Exception is made for multi-attribute nouns which ]
        [* have H-PTPART as one of their attributes, e.g ]
        [* 'femoral' in 'Allergies : Femoral , Codeine'. The ]
        [* word 'femoral' is both N:H-PTPART and N:H-TTMED. ]
        [* Note that in a conjunct of ASSERTION at VERB, this ]
        [* restriction uses COELEMENT (not COELEMENT-) to reach]
        [* SUBJECT. ]
        IN VERB AFTER NULLFRAG: [BOTH $WRITE-TREE AND] $DO-TEST IS TRUE.
   $WRITE-TREE =
        WRITE ON INFO IDENTIFICATION;
        WRITE ON INFO ' WPOS18B ';
        WRITE ON INFO PARSE TREE WITH WORD FORMS.
   $DO-TEST =
        BOTH EITHER THE CORE- X1 OF COELEMENT- SUBJECT IS N OR PRO OR VING
        OR X1 IS QN [61 year old]
        AND ALL OF $PRED-CORE, $NEVER-PRED, $CHECK-ATT.
   $PRED-CORE = CORE-ATT X2 OF X1 EXISTS.
   $NEVER-PRED = EITHER X1 HAS NODE ATTRIBUTE COMPUTED-ATT [broken arm]
        OR IF BOTH X1 IS H-PTPART [arm, femoral]
        AND $LONE-PTPART [e.g. 'arm', NOT: 'arm in a sling']
        THEN $MULTI-ATT.
   $LONE-PTPART = AT X1 BOTH LEFT-ADJUNCT IS EMPTY
        AND RIGHT-ADJUNCT IS EMPTY.
   $MULTI-ATT = X-SUBLIST := LIST H-PTPART-LIST;
        [X-SUBLIST is used by COMPLEMENT to find the members]
        [of the argument of COMPLEMENT (here X-ALL) that are]
        [not members of X-SUBLIST]
        X-ALL := CORE-SELATT OF X1;
        [STORE IN X-CORE-SELATT; just for testing]
        X-ALL HAS MEMBER H-PTPART;
        COMPLEMENT OF X-ALL IS NOT NIL
        [H-PTPART is not the only sublanguage attrb on CORE-SELATT.]
        [WPOS18B will pass, but not resolve: Meds: femoral, codeine].
   $CHECK-ATT = ONE OF $1, $2, $3.
   $1 = X-PRED := LIST WPOS18-PRED;
        X2 HAS MEMBER X-PRED;
        IF X2 HAS MEMBER H-TXSPEC OR H-TXVAR OR H-TXPROC
        THEN IF IMMEDIATE-STRING OF X1 IS OCCURRING IN ONESENT
        WHERE ELEMENT- SECTION EXISTS@
        THEN THE SECOND ELEMENT OF SECT-NAME IS 'PLAN' OR 'LAB'.
   $2 = BOTH AT X1 [the noun whose core-att is X2]
        X2 HAS MEMBER H-PT OR H-TXCLIN OR H-PTPART OR H-PTAREA
        OR H-FAMILY [mother in her 60s]
        AND EITHER RIGHT-ADJUNCT OF X1 IS NOT EMPTY
        OR LEFT-ADJUNCT OF X1 IS NOT EMPTY
        [patient pre1sentant une douleur...]
        [61 year old with RA]
        [Well-developed, well-nourished, white female].
   $3 = BOTH X1 [the noun whose core-att is X2] IS H-PTFUNC
        AND AT X1
        EITHER PRESENT-ELEMENT- SUBSUMES 'SOUNDS'
        ['Heart sounds 1 and 2.']
        OR RIGHT-ADJUNCT OF X1 IS PQUANT
        ['Heart rate in the 90s'].
WPOS20 =
        [* Restriction for BESHOW]
        IN PROC:
        IF PRESENT-ELEMENT- IS NOT EMPTY
        THEN BOTH CORE X1 OF NSTG IS N: H-TXPROC OR H-TXCLIN OR H-TXSPEC
        OR H-TESTVIEW
        AND AT RIGHT-ADJUNCT-POS X2 OF X1 DO $ACCEPT-RN.
   $ACCEPT-RN =
        IF VALUE X3 OF VALUE OF X2 IS ADJINRN
        @THEN BOTH THE CORE X-CORE EXISTS
        AND $CHECK-CORE
        [ELSE IF X3 IS PN
        @THEN BOTH AT ELEMENT- NSTGO THE CORE X-CORE EXISTS
        AND $CHECK-ATT -in WPOs18- 1/14/00 unclear why here]
.
   $CHECK-CORE =
        X-CORE IS NOT H-NORMAL OR H-INDIC OR H-DIAG OR H-TXRES.
WPOS21 =
        [* Restriction on BESHOW: Must have subj-pred structure ]
        [* and no comma: 'intravenous hydration , syncope workup']
        [* is not BESHOW.]
        IN BESHOW AFTER BESUBJ:
        BOTH IT IS NOT CASE THAT
        BOTH PROC IS EMPTY
        AND BESUBJ IS EMPTY
        AND IF BESUBJ IS NOT EMPTY
        THEN NEITHER BESUBJ SUBSUMES ','
        NOR CURRENT WORD IS ','.
WPOS21A =
        [* Restricts subject in BESHOW]
        [* But allows any subject if word following BESUBJ is ':' ]
        [* as in 'ESTIMATED BLOOD LOSS : Minimal' and 'TOURNIQUET ]
        [* TIME : 89 minutes'. ]
        IN BESHOW :
        IF BESUBJ X10 IS NOT EMPTY
        @THEN EITHER AT X10
        WORD FOLLOWING PRESENT NODE IS ':' OR '-'
        OR BOTH THE CORE-ATT X1 OF CORE X2 OF X10 EXISTS
        AND BOTH IF X1 HAS MEMBER H-NORMAL [OR H-RESULT]
        OR H-INDIC OR H-DIAG [OR H-INST]
        THEN EITHER X2 IS 'COMPLICATIONS'
        ['Complications NONE']
        OR 'ETIOLOGY'
        [hyponatremia etiology unclear]
        OR X10 HAS COELEMENT VINGO OR VENPASS
        [COPD also not recognized]
        AND IF X2 IS H-INST
        [need H-INST=BESUBJ for 'OPC clinic 2 wks.']
        THEN CURRENT WORD IS NOT H-INST
        [not ZZZ = BESUBJ + Respiratory clinic= OBJBE].
WPOS21B =
        [* ':' must be present between nonempty PROC and nonempty BESUBJ]
        IN BESHOW AFTER BESUBJ:
        IF BOTH BESUBJ IS NOT EMPTY
        AND PROC X1 IS NOT EMPTY
        THEN THE LAST-ELEMENT- OF X1 IS ':'.
WPOS23 =
        [* Adverb object is DEVAL ('Il va mieux').]
        [* Adverb in ND object is DLOC1 ('put it there, put it down').]
        IN DSTG: BOTH IF IMMEDIATE-NODE X1 IS OBJECT
        THEN CORE IS DEVAL
        AND IF X1 IS ND
        THEN CORE IS DLOC1.
WPOS28 =
        [* After verb VBE disallow adverb right adjuncts of verb; after]
        [* verb with attrb OBJLIST:DSTG ('do','stain'), disallow adverb]
        [* of type DEVAL (e.g.'well'): 'He did well and had no pain' ]
        [* --/-> 'did and had no pain' with 'well' the RV of 'did'. ]
        [* Conjoined adverbs should be of like type, e.g. locatives: ]
        [* *'slowly and there', OK 'here and there' ]
        [* After verb VHAVE disallow adverb right adjuncts of verb 11/15/99]
        [* In '..has poorly controlled asthma' NOT 'poorly'=RV of 'has'. ]
        IN RV AFTER LDR:
        ALL OF $BE-DEVAL, $DRV, $CONJOINED.
   $BE-DEVAL = BOTH THE HOST X1 IS NOT VBE OR VHAVE
        AND IF X1 HAS ATTRIBUTE OBJLIST: DSTG
        THEN CORE OF LDR IS NOT DEVAL.
   $DRV = BOTH CORE- X3 IS NOT DVERY
        AND IF X3 IS DRV
        THEN IF X3 IS [ALSO] DLOC3
        THEN X1 IS VMOTION OR H-VTEST [titrated upwards].
   $CONJOINED = IF AT X3 COELEMENT- CONJ-NODE EXISTS
        WHERE ELEMENT- Q-CONJ HAS CORE- X30
        THEN BOTH IF X3 IS DLOC1 [OR DLOC2 OR DLOC3]
        THEN X30 IS DLOC1 [OR DLOC2 OR DLOC3]
        AND IF X30 IS DLOC1 [OR DLOC2 OR DLOC3]
        THEN X3 IS DLOC1 [OR DLOC2 OR DLOC3].
WPOS31 =
        [* restricts adverb in LDR in RNOPTS:*'here and on' ]
        [* and if D is also P and current word is 'the' then ]
        [* prefer P, i.e. disallow D. In 'Patient had fever ]
        [* throughout the day and early morning hours', ]
        [* 'throughout' is not D in RN, leaving a single time]
        [* phrase 'the day and early morning hours'. ]
        [* But also disallow adverb before a modified article]
        [* as in 'throughout most of the night'; 'throughout']
        [* should be P not D before 'most_of'. ]
        IN RNOPTS AFTER LDR:
        BOTH CORE X1 IS NOT DLOC3 [*here and on]
        AND IF AT X1 WORD STARTING PRESENT NODE IS [also] P
        [e.g. throughout]
        THEN CURRENT WORD IS NOT T [the,a].
WPOS34 =
        [* Selection on PN in RA: *'profonde du flanc' 5C.1.7]
        IN RA AFTER PN:
        IF BOTH CORE X1 OF NSTGO IS H-PTPART OR H-PTAREA
        AND IT IS NOT THE CASE THAT
        X1 HAS NODE ATTRIBUTE COMPUTED-ATT
        THEN CORE OF HOST IS H-INDIC OR H-TXCLIN OR H-NORMAL OR H-TXPROC.
WPOS35 =
        [* 'Pt was discharged from here...']
        [* Need further constraints, e.g. ]
        [* 'since last' /= PD in 'since last seen'.]
        IN SAOPTS AFTER PD:
        AT PD
        BOTH P IS H-TMPREP
        AND BOTH CORE- X1 OF LDR IS H-TMLOC
        AND AT X1 WORD STARTING PRESENT NODE IS NOT [also] ADJ
        [PD /= 'since last'; 'last' = D, ADJ].
WPOS36 =
        IN IN-DIM: N IS NSCALE.
WPOS37 =
        [* Restricts TVO fragment; VERB is not plural; ]
        [* assumption is that implied subject is the patient or caregiver.]
        IN TVO AFTER VERB:
        IF CORE X1 OF VERB X2 IS TV
        THEN BOTH COELEMENT- TENSE OF X2 IS EMPTY
        AND X1 IS NOT PLURAL.
WPOS37A =
        [* Restricts VO fragment; 'clear'/= V in 'clear to auscultation]
        IN VO AFTER LVR:
        CORE OF LVR IS NOT 'CLEAR'.
WPOS38 =
        [* WMED15 in MDPAR6. Restricts nouns in OBJBE position in FRAGMENT ]
        [* prohibiting BESHOW analysis for, e.g., 'Hematology 1 week.' ]
        [* syncope workup TXCLIN]
        IN BESHOW:
        IF ELEMENT OBJBE X1 EXISTS
        THEN CORE OF X1 IS NOT N:NTIME1 OR NTIME2 OR H-TXCLIN OR H-TXPROC
        [syncope workup INDIC TXCLIN].
WPOS39 =
        [* Restricts the noun in NPOS when the core of NNN is 'patient': ]
        [* Not 'patient denied fever, cough' with 'patient denied' in NPOS]
        [* because 'denied' will not be distributed to 'cough'.]
        [* Must allow 'patient instructions', 'patient complaints'.]
        IN NNN:
        PRESENT-ELEMENT- X-NNN EXISTS;
        IF VALUE IS N X3
        THEN IF AT X-NNN IMMEDIATE-NODE- IS NPOS
        THEN IF X3 IS 'PATIENT'
        [not 'patient denied' as cpd NPOS]
        THEN EITHER CURRENT WORD IS N: H-TTGEN [patient instructions]
        OR H-PT [Patient XXX was admitted] [XXX = H-PT]
        OR EITHER BOTH CURRENT WORD IS N:H-INDIC
        AND CURRENT WORD IS N:GENERIC
        [complaints, problems, symptoms]
        OR CURRENT WORD IS SPWORD
        [patient and family education...].
WPOS39A =
        [* Restricts the combination of N in NPOS with core of NVAR=VING: ]
        [* Not NVAR='elderly male lying' in 'elderly male lying on his side']
        [* Also force 'dressing'=N, not 'dressing'=VING, in 'sterile ]
        [* compression dressing'; 'compression' is H-INDIC, though not here. ]
        [* Another case is 'feeling flushed'.]
        IN NVAR AFTER VING:
        BOTH IN ELEMENT- NPOS OF COELEMENT- LN
        IF ELEMENT- NNN EXISTS@
        THEN VALUE IS NOT H-INDIC OR H-DIAG OR H-PT
        AND IF ELEMENT- VING IS 'FEELING'
        THEN NOT BOTH COELEMENT- LN IS EMPTY
        AND CURRENT WORD IS VEN [feeling flushed].
WPOS39B =
        [* Restricts NNN in NPOS in LN under SUBJECT; NNN should not ]
        [* have value 'use' as in 'Use nitroglycerin'. Perhaps should ]
        [* generalize to disallow any N/V in this position. But risky.]
        [* Restricts NNN in NPOS in LN under SUBJECT; NNN should not ]
        [* subsume VEN: H-SHOW. In 'Examination revealed hemiparesis' ]
        [* 'Examination revealed'is not NNN in NPOS in LN of 'hemiparesis']
        [* Also if SUBJECT is in a conjoined ASSERTION, i.e. the SUBJECT ]
        [* under Q-CONJ, then NNN should not subsume a noun that is also ]
        [* a verb (e.g. reports) as this likely the verb of the conjoined ]
        [* ASSERTION. In 'He admits to being sedentary, and reports stable]
        [* dyspnea on exertion' we do not want 'reports stable' as NNN on ]
        [* 'dyspnea' to form an LNR 'reports stable dyspnea on exertion' ]
        [* accepted as SUBJECT with VERB and OBJECT=NULLFRAG; better if ]
        [* 'reports' is VERB.]
        IN NNN:
        IF IMMEDIATE LN IS OCCURRING IN SUBJECT X-SUBJ
        THEN BOTH VALUE IS NOT 'USE'
        AND BOTH PRESENT-ELEMENT- DOES NOT SUBSUME VEN: H-SHOW
        [examination revealed]
        AND IF X-SUBJ IS OCCURRING IN Q-CONJ
        THEN AT PRESENT-ELEMENT-
        WORD STARTING PRESENT NODE IS NOT [also] TV
        [reports stable dyspnea].
WPOS39C =
        [* Not NVAR='affects' in 'Her attitude affects results in therapy']
        [* Not NVAR='report' in 'Both he and his wife report that he has ]
        [* begun his regular walking exercise program', i.e. *'wife report']
        [* Not NVAR='complaining' in 'Pt presented to clinic complaining..']
        [* Not NVAR='states' in 'Further history from the wife states that..']
        IN NVAR:
        BOTH IF BOTH EITHER PRESENT-ELEMENT- X1 IS OCCURRING IN SUBJECT
        OR EITHER CONJELEM OF X1 IS OCCURRING IN SUBJECT
        ['Both he and his wife report that he has...' ]
        OR X1 IS OCCURRING IN PN
        WHERE HOST- IS OCCURRING IN SUBJECT
        ['Further history from the wife states that..']
        AND IN COELEMENT- LN OF X1
        NPOS IS NOT EMPTY [most likely the intended SUBJECT]
        THEN VALUE IS NOT 'AFFECTS' OR 'REPORT' OR 'STATES'
        AND VALUE IS NOT 'COMPLAINING'.
WPOS39D =
        [* Restricts NNN in NPOS for 'heart regular rate'. NNN should not ]
        [* subsume 'heart regular' as adjunct of 'rate'so that 'heart' ]
        [* (not 'rate') will be host of 'without skip or murmur' in 'Heart]
        [* regular rate without skip or murmur'. ]
        [* Also prevent LNRs like 'fever last night' where NNN='fever last']
        [* by excluding 'last' from NNN. ]
        [* Also prevent LNRs like 'medications included dexamethasone' ]
        [* where NNN='medications included' by excluding H-BECONN from NNN;]
        [* 'included'= H-BECONN.]
        [* Also disallow first N in NNN ='%' if preceding word is Q:QNUMBER]
        [* which gave wrong parse for 'LAD < 25 % proximal , 25 % mid , ]
        [* serial 25 % distal lesions' with NPOS = N ADJ = '% distal'. ]
        IN NNN:
        BOTH $HEART AND $OTHER.
   $HEART = NOT BOTH PRESENT-ELEMENT- SUBSUMES 'HEART'
        AND PRESENT-ELEMENT- SUBSUMES 'REGULAR'.
   $OTHER =
        BOTH NEITHER PRESENT-ELEMENT- SUBSUMES 'LAST'
        [LNR =/ fever last night]
        NOR PRESENT-ELEMENT- SUBSUMES VEN:H-BECONN
        AND IF BOTH IMMEDIATE-NODE IS NPOS [first NNN in NPOS]
        AND WORD STARTING PRESENT NODE IS '%' OR 'PERCENT' OR 'PER CENT'
        THEN WORD PRECEDING PRESENT NODE IS NOT Q:QNUMBER [25 %].
WPOS39E =
        [* Restricts NNN in NPOS for 'coronary artery disease status post ]
        [* angioplasty'. NNN should not subsume N ADJ where N is the idiom]
        [* 'coronary artery disease' and ADJ is 'status post'. All forms ]
        [* of 'status post' are both ADJ and P (also D), so the test is not]
        [* accept in NNN an ADJ that is also P, actually don't accept any P]
        IN NNN:
        IF AT VALUE [N] GO RIGHT @
        THEN WORD STARTING PRESENT NODE IS NOT [also] P.
WPOS39F =
        [* Restricts NNN in NPOS: should not be 'normal'. We defined 'normal']
        [* to be noun only for such occurrences as 'above the normal'. This ]
        [* means that N='normal' should not be a modifier, only ADJ='normal' ]
        [* in e.g. 'normal left vein'.Then 'normal vein' can be a coputed-att]
        [* as is needed in 'He was subsequently taken to the cath lab which ]
        [* revealed mild LAD and circumflex disease, normal left vein'. ]
        [* Other cases: ]
        [* Restricts NNN in NPOS: should not be 'coronary'. 'Coronary' is ]
        [* N: H-DIAG in 'Pt had a coronary' but is ADJ:H-PTPART in 'coronary ]
        [* disease'. Note 'coronary' in 'in the coronary' can be N:H-PTPART. ]
        [* See also WATT-CORONARY. ]
        [* Restricts NNN in NPOS: should not be 'subdural'. 'Subdural' is ]
        [* N: H-DIAG in 'chronic subdurals' but is ADJ:H-PTPART in 'subdural ]
        [* space'. 'Subdural' H-DIAG is shortened form of 'subdural hematoma.]
        IN NNN:
        BOTH VALUE IS NOT 'NORMAL'
        AND BOTH VALUE IS NOT 'CORONARY'
        AND VALUE IS NOT 'SUBDURAL'.
WPOS39G =
        [* Restricts NNN in NPOS: should not include VEN:H-SHOW if in an RN ]
        [* in SUBJECT, e.g. 'demonstrated' in 'ECG at admission demonstrated]
        [* atrial flutter'. NNN /= 'admission demonstrated'. ]
        IN NNN: IF PRESENT-ELEMENT- SUBSUMES VEN:H-SHOW [demonstrated]
        THEN AT IMMEDIATE LN IT IS NOT THE CASE THAT
        IMMEDIATE PN EXISTS WHERE IMMEDIATE SUBJECT EXISTS.
WPOS40 =
        [* '19 month old', '3 months ago' ]
        IN SCALESTG:
        BOTH IF VALUE X1 IS ADJ
        THEN X1 IS ASCALE OR COMPARATIVE
        AND BOTH IF X1 IS D
        THEN X1 IS TIMETAG [ago]
        AND IF VALUE X2 IS IN-DIM
        THEN AT X2 ELEMENT- N IS NSCALE.
WPOS42 =
        [* No ':' in SUBJECT *]
        IN SUBJECT:
        PRESENT-ELEMENT- DOES NOT SUBSUME ':'.
WPOS44 =
        [* Force VINGO in RN where VING=H-PTLOC ('irradiant dans le dos') ]
        [* to be RN of H-INDIC or H-DIAG ('douleurs, 'ade1nocarcinome ]
        [* infiltrant la meiso'). Adapted for English only for 'radiating'. ]
        [* Force VINGO in RN where VING=H-PTVERB ('presenting','undergoing')]
        [* to adjoin H-PT: 'female with beast cancer, presenting with ...'. ]
        IN LVINGR: BOTH IF BOTH CORE- X-VING IS 'RADIATING'
        AND IMMEDIATE-STRING IS VINGO
        WHERE IMMEDIATE RN EXISTS@
        THEN HOST IS H-INDIC OR H-DIAG
        AND IF BOTH X-VING IS H-PTVERB
        AND IMMEDIATE-STRING IS VINGO
        WHERE IMMEDIATE RN EXISTS@
        THEN HOST IS H-PT.
WPOS44A =
        [* Adjunct PN containing H-PTLOC adjoins H-INDIC or H-DIAG.]
        [* In particular for H-PTLOC = 'radiation'. In 'The patient]
        [* experienced substernal chest pressure after returning ]
        [* from the bathroom with radiation to her arms and left ]
        [* shoulder' we must force 'with radiation ...' up the tree]
        [* to adjoin 'chest pressure'. See weaker WPOS63. ]
        [* 1/14/02 Restrict host of PN if P='in that'. We are forced]
        [* to define idiom P='in that' because idiom 'in that' =CS1 ]
        [* is required for, eg 'pain was atypical in that it was not]
        [* relieved by nitroglycerine']
        IN PN:
        BOTH IF BOTH ELEMENT- P X1 IS 'WITH' OR 'WITHOUT'
        AND CORE- OF ELEMENT- NSTGO IS 'RADIATION'
        THEN HOST- IS H-DIAG OR H-INDIC
        AND IF X1 IS 'IN'_'THAT'
        THEN IN ELEMENT- NSTGO
        EITHER CORE IS H-PTPART [in that arm]
        OR H-PTAREA [in that region]
        OR NTIME1 [in that time]
        OR CORE- IS 'SETTING' [in that setting].
WPOS51 =
        [* disallows 'patient had' as N+ RN=VENPASS; ]
        [* disallows 'to jaw and left (arm)' as PN + VENPASS = 'arm...']
        IN VENPASS AFTER LVENR:
        BOTH CORE X1 OF LVENR IS NOT 'HAD'
        AND IF X1 IS 'LEFT'
        THEN CURRENT WORD IS NOT N:H-PTPART [left arm].
WPOS52 =
        [* disallows 'patient VEN' as N+ RN=ADJINRN; WN50 in mdpar6]
        IN RNOPTS AFTER ADJINRN:
        BOTH CORE X1 IS NOT VEN OR VING
        AND IF X1 IS ADJ
        THEN X1 IS AINRN.
WPOS52A =
        [* Disallows VEN=AVAR if no att POBJLIST: 'still HAD ronchi' ]
        [* But OK VEN='flushed': 'feeling flushed' OBJBE of 'feeling'. ]
        [* disallows VEN as AVAR after VHAVE: 'had stopped smoking' ]
        [* disallows VEN='left' as AVAR; also 'presented'; NOT 'stayed ]
        [* awake and presented...' with conjunct 'awake and presented' ]
        [* disallows VEN='desired' as AVAR: not 'was asymptomatic and ]
        [* disired to go home' with conjunct 'asymptomatic and desired']
        [* disallows VEN='seen' as AVAR: not APOS + NVAR = 'seen back']
        [* in 'Patient was seen back in followup visit after 6 months'.]
        [* Disallows VEN='given' as AVAR: APOS + NVAR /= 'given nitroglycerin']
        [* in 'was started on heparin , given nitroglycerin intravenously'. ]
        [* Disallows VEN='felt' as AVAR. In 'he was also felt to be in pain' ]
        [* the analysis is not 'felt'= VEN in AVAR in ASTG in OBJECTBE, with ]
        [* 'to be in pain' =TOVO in SA-LAST]
        IN AVAR AFTER VEN:
        BOTH EITHER ELEMENT- VEN X1 HAS ATTRIBUTE POBJLIST
        OR X1 IS 'FLUSHED'
        AND BOTH VEN IS NOT 'LEFT' [take 'LEFT' as ADJ] OR 'DESIRED' OR 'SEEN'
        OR 'GIVEN'
        ['was started on heparin , given nitroglycerin intravenously']
        OR 'FELT' [he was felt to be in pain]
        AND IF X1 IS 'PRESENTED'
        THEN BOTH CURRENT WORD IS N: H-TTGEN [e.g. 'HOPE_study']
        AND LEFT-ADJUNCT IS NOT EMPTY
        [* Given the recently presented HOPE study ,...]
        [AND IF WORD PRECEDING PRESENT NODE X1 EXISTS ]
        [ THEN X1 IS NOT V OR TV OR VEN OR VING: VHAVE ]
        [* This clause prevented AVAR='increased' in 'He has had ]
        [* increased pain'. ].
WPOS53 =
        [* Block VENPASS at LVENR if verb has no POBJLIST]
        [* Push VEN to AVAR in ASTG if VEN is VVERYVING (can follow 'very')]
        [* in OBJECTBE. VVERYVING is attrb of VEN that can be adjectival. ]
        [* 'Confused' VVERYVING: 'very confused'; 'accused' not VVERYVING: ]
        [* Not 'very accused'.]
        IN VENPASS AFTER LVENR:
        BOTH CORE X1 OF LVENR HAS ATTRIBUTE POBJLIST
        AND IF IMMEDIATE OBJECTBE EXISTS
        THEN X1 DOES NOT HAVE ATTRIBUTE VVERYVING.
WPOS54 =
        [* force Q + N to QN in ADJADJ (before N): '78 year old lady' ]
        [* '120 milligrams intravenous Lasix' *]
        IN NNN:
        NOT BOTH VALUE IS N: NUNIT
        [use VALUE to reach both options beginning with N]
        AND AT IMMEDIATE NPOS COELEMENT QPOS IS NOT EMPTY.
WPOS54A =
        [* For QN in NVAR: 'this 28 year old is ...': ]
        [* don't glue previous noun to QN in NVAR, NPOS=nil ]
        IN QN AFTER N:
        IF IMMEDIATE-NODE IS NVAR X1
        THEN AT X1
        IN COELEMENT LN
        NPOS IS EMPTY.
WPOS54B =
        [* If QN in RN contains 'old' then host of RN is H-PT OR ]
        [* H-FAMILY: 'patient/brother 30 years old has RA' ]
        IN SCALESTG:
        IF BOTH ADJ IS 'OLD'
        AND IMMEDIATE QN IS OCCURRING IN RNOPTS X1
        THEN HOST OF X1 IS H-PT OR H-FAMILY.
WPOS55 =
        [* For 'regular' in RQ or in QPERUNIT: 'pulse 96 regular' ]
        [* For 'C', centigrade, etc. when 'degrees' is absent:'36 C' ]
        [* For 'systolic' in RQ or in QPERUNIT: 'BP 120 systolic' ]
        [* but tagging requires 'systolic' as N in '120 systolic' ]
        [* so 7/1/2002 remove 'systolic' from REG-ADJ. ]
        IN REG-ADJ AFTER ADJ:
        ADJ IS 'REGULAR' OR 'IRREGULAR' OR 'C' OR 'F' [OR 'SYSTOLIC'].
WPOS56 =
        [* Reject NULL in REG-ADJ in RQ to avoid double NULL. ]
        IN REG-ADJ AFTER NULL:
        IMMEDIATE-NODE IS NOT RQ.
WPOS57 =
        [* a passive string as sentence adjunct subsumes more ]
        [* than one word; same applies to the passive string in RN ]
        [* unless subject of containing string is 'there': 'There ]
        [* are no masses palpated'. RNOPTS 1-word VENPASS OK 11/96 ]
        [* 7/98 Not OK: 'The surgeon felt...' Reinstate constraint ]
        [* and collect exceptions. ]
        [* Note that HOST must be N or VING in $EXCEPTIONS (not QN, ]
        [* for example, e.g. 'two days' in 'She felt much improved ]
        [* but for the past two days noted a marked deterioration').]
        [* HOST=QN would allow 'noted' to adjoin 'two days' leaving ]
        [* 'a marked deterioration' to be FRAGMENT. ]
        [* 12/1/01 The count of words in VENPASS should not include ]
        [* SA-LAST in VENPASS; the count should stop after PASSOBJ. ]
        [* IN 'The patient, fearing complications, wanted to leave' ]
        [* not OK is VENPASS = 'wanted' + SAOPTS=TOVO='to leave' in ]
        [* SA or SA-LAST of VINGO='fearing complications'. See $3. ]
        IN VENPASS:
        AT PRESENT-ELEMENT- X3
        EITHER [ was $EXCEPTIONS ]
        BOTH IMMEDIATE RNOPTS EXISTS
        WHERE HOST IS N OR VING
        AND EITHER $VSENT-OR-LIT
        OR [ was $THERE ]
        AT IMMEDIATE OBJECT
        VALUE OF COELEMENT- SUBJECT IS 'THERE'
        [There are no masses palpated]
        OR NOT ALL OF $1, $2, $3.
   $VSENT-OR-LIT =
        EITHER CORE X-VEN OF LVENR IS VSENT2 OR VSENT3
        [fever noted]
        WHERE X-VEN IS NOT 'REVEALED' OR 'SUGGESTED'
        [An examination at C-Firm revealed that ...]
        OR 'NOTICED'
        [when last PM noticed that ...]
        OR X-VEN IS 'GIVEN' OR 'TAKEN' [aspirin given had no effect]
        OR 'ELEVATED' [She sleeps with the head of the bed elevated]
        OR 'SPOKEN' [Primary language spoken is English]
        OR 'COMPLETED' [Educational level completed: vocational]
        OR 'OBTAINED' [the xray obtained was unsatisfactory]
        OR 'APPRECIATED' [no murmur appreciated]
        OR 'DEFINED' [no obstruction defined]
        OR 'DEFERRED' [GU: rectal deferred]
        OR 'REGISTERED' [no daily weights registered]
        OR 'RECORDED' [no daily weights recorded]
        OR 'PLACED' [had a catheter placed which shows...]
        OR 'PERFORMED' [Procedures performed: None]
        OR 'DONE' [the last BUN done showed..].
   $1 = EITHER IMMEDIATE SAOPTS EXISTS
        OR IMMEDIATE RNOPTS EXISTS.
   $2 = WORD STARTING PRESENT NODE X1 EXISTS.
   $3 = AT ELEMENT- PASSOBJ
        WORD ENDING PRESENT NODE IS X1.
WPOS57A =
        [* Force non-nil SA to SA-LAST when OBJECT or PASSOBJ is empty.]
        [* Works with WPOS57A to eliminate 1-word VENPASS, and allows ]
        [* RNSUBJ/RSUBJ to be taken in SA-LAST ('Visit was postponed, ]
        [* which was for today.]
        IN OBJECT, PASSOBJ AFTER NULLOBJ:
        GO LEFT; TEST FOR SA; PRESENT-ELEMENT- IS EMPTY.
WPOS58 =
        [* a VINGO string as SAOPTS or RNOPTS subsumes more than one word.]
        [* In '...and increasing his Tegretol', 'increasing' is not SA. ]
        [* Also not 1 word plus comma:'cardiac enzymes started declining,']
        [* Various exceptions, e.g. 'fasting' in 'The blood glucose ranged]
        [* from 130 to 165 fasting'. Try to generalize exceptions. ]
        IN VINGO:
        EITHER NOT ALL OF $1, $2, $3
        OR EITHER WORD STARTING PRESENT NODE X-WORD IS VING:H-PTFUNC
        [has trouble sleeping]
        OR X-WORD IS 'STARTING' OR 'FASTING'
        [prior to her symptoms starting].
   $1 = EITHER IMMEDIATE SAOPTS EXISTS OR IMMEDIATE RNOPTS EXISTS.
   $2 = WORD STARTING PRESENT NODE X1 EXISTS.
   $3 = EITHER WORD ENDING PRESENT NODE IS X1
        OR WORD ENDING PRESENT NODE IS ','.
WPOS59 =
        [* Restrict N in NQ to be NPREQ ('Class 2') or NTIME1 ('day 3'). ]
        [* Disallow NQ = 'TIMES' Q as value of NVAR. I.e. NVAR =/ 'times 3']
        [* in 'She was treated with CABG times 3' with NPOS = 'CABG'. ]
        IN NQ AFTER N:
        BOTH N X1 IS NPREQ OR NTIME1 [day 3]
        AND IF X1 IS 'TIMES' [times 3]
        THEN PRESENT-ELEMENT- IS NOT OCCURRING IN NVAR.
WPOS60 =
        [* Only T or Q in the subclass QROVING (both, all) or PRO in ]
        [* subclass PROSELF (she herself...) occur as RSUBJ (roving ]
        [* adjuncts of subject). If Q/T/PRO is followed by PN, then ]
        [* P = 'OF' (They all of them agreed.) ]
        IN RSUBJ AFTER OPTION 1:
        BOTH THE CORE OF THE FIRST ELEMENT IS QROVING OR PROSELF,
        AND IF THE SECOND ELEMENT IS PN @
        THEN P IS 'OF'.
WPOS61 =
        [* CORE_ATT of BPART is H-PTAREA/H-PTPART: 'pain left arm' ]
        [* 10/7/2003 must use CORE_ATT not CORE so BPART =/ COMPUTED-ATT. In]
        [* 'three-vessel coronary artery disease , patent LIMA to the LAD', ]
        [* the portion 'patent LIMA to the LAD' is not BPART right adjunct ]
        [* of 'three-vessel coronary artery disease. ]
        [* 12/1/97 Also both no BPART within BPART, and if BPART=H-PTPART, ]
        [* then host=/H-PTPART: OK 'pain in knee, rt; *'pain in knee, elbow']
        [* where 'elbow' is BPART of 'knee'. ]
        IN LNR AFTER NVAR:
        IF IMMEDIATE BPART EXISTS
        THEN BOTH CORE-ATT OF CORE X1 HAS MEMBER H-PTAREA OR H-PTPART
        AND BOTH X1 IS NOT 'AXIS'
        AND IF X1 IS 'BACK'
        THEN HOST IS NOT 'COUGH'
        [in 'She denies cough , back or bone pain' 'back' is not]
        [BPART in RN of 'cough'].
WPOS62 =
        [* Core of ADJADJ in BPART is H-PTAREA/H-PTPART/H-DESCR ]
        [* ...graft, left side/knee/unknown vessel]
        IN ADJADJ:
        IF AT IMMEDIATE LN IMMEDIATE BPART EXISTS
        THEN CORE [of LAR] IS H-PTAREA OR H-PTPART OR H-DESCR.
WPOS62A =
        [* Unless heavily restricted, BPART causes bad parses. THUS CORE of ]
        [* ADJ option in BPART is only 'left'/'right'/'ventricular'/'atrial' ]
        [* /'bilateral' : ]
        [* 'swollen ankle left'; 'many ectopic foci, ventricular and atrial';]
        [* 'Mammogram , Bilateral; left renal artery stenosis , ostial. ]
        IN BPART AFTER ADJ:
        BOTH ELEMENT- ADJ IS 'LEFT' OR 'RIGHT' OR 'VENTRICULAR' OR 'ATRIAL' OR
        'BILATERAL' [Mammogram , Bilateral] OR 'OSTIAL'
        [left renal artery stenosis , ostial]
        AND BOTH CURRENT WORD IS NOT N:H-PTPART
        AND CURRENT WORD IS NOT ADJ:H-PTPART.
WPOS63 =
        [* no PN='with radiation..' adjoining H-PTPART/H-PTAREA; must]
        [* move up tree: 'pain in chest with radiation to left arm' ]
        [* 12/21/00 add H-PTFUNC: 'chest pain on exercise radiating.']
        [* 12/26/00 Stronger WPOS44A covers cases of verbal host; if ]
        [* proves valid could replace this.]
        IN RNOPTS AFTER PN:
        IN PN
        IF BOTH P IS 'WITH' OR 'WITHOUT'
        AND CORE OF NSTGO IS 'RADIATION'
        THEN HOST IS NOT H-PTPART OR H-PTAREA OR H-PTFUNC.
WPOS64 =
        [* No adjectival VHAVE, VBE, VDO: *'having angina as LN+N. ]
        [* No adjectival VING = 'prompting'; in 'renal artery stenosis ]
        [* prompting PTCA of the bilateral renal arteries', we do not ]
        [* have LN+N = 'prompting PTCA' with AVAR = 'prompting'. ]
        [* Disallow 'following' as VING in AVAR when sentence-initial; ]
        [* force 'following' to be preposition in this position, as in ]
        [* 'Following stent placement in the left anterior descending, ]
        [* the patient had recurrent chest discomfort.' ]
        [* Disallow AVAR->H-INDIC in NSTGT. In 'quit smoking last year']
        [* 'smoking last year' is not NSTGT.]
        IN AVAR:
        BOTH VALUE X1 IS NOT VHAVE OR VBE OR VDO
        AND BOTH X1 IS NOT 'PROMPTING'
        AND BOTH IF X1 IS 'FOLLOWING'
        THEN IF ASCEND TO ASSERTION PASSING THROUGH LN @
        THEN IT IS NOT THE CASE THAT
        WORD STARTING PRESENT NODE IS 'FOLLOWING'
        AND IF X1 IS H-INDIC ['smoking' in 'quit smoking last year']
        THEN IF X1 IS OCCURRING IN LN@
        THEN IT IS NOT THE CASE THAT
        IMMEDIATE NSTGT EXISTS.
WPOS65 =
        [* For '6 units a day', etc. N in 'a N' is NTIME1 ]
        IN PERUNIT:
        IF $A-DAY IS TRUE
        THEN X1 IS NTIME1.
   $A-DAY = ELEMENT- N X1 EXISTS;
        PRECEDING WORD IS 'A'.
WPOS66 =
        [* Allow a numerical left adjunct Q of H-INDIC adjective:'4+ sick']
        IN LA AFTER Q:
        CURRENT WORD IS ADJ:H-INDIC.
WPOS66A =
        [* Allow a left adjunct QN of H-INDIC adjective:'100 % stenotic']
        IN LA AFTER QN:
        CURRENT WORD IS ADJ OR VEN:H-INDIC [100 % occluded].
WPOS67 =
        [* restricts NVAR: N is not NUNIT if after Q; force QN: '2 mm']
        [* restricts NVAR: N is not both NUNIT and NTIME1 ('day') if ]
        [* followed by Q:QNUMBER; force NQ: 'postop day 3']
        [* restricts NVAR: N in SUBJECT is not E-LEAD ]
        IN NVAR AFTER N:
        BOTH IF VALUE IS N:NUNIT
        THEN BOTH IF WORD PRECEDING PRESENT NODE EXISTS@
        [don't fail at first word of sentence]
        THEN PRESENT-ELEMENT- IS NOT Q
        AND IF VALUE IS [also] N:NTIME1 [e.g. 'day','hr']
        THEN EITHER VALUE IS [also] H-PTFUNC
        [HR = heart rate]
        OR CURRENT WORD IS NOT Q:QNUMBER ['day 3']
        AND NOT BOTH CORE-ATT OF VALUE HAS MEMBER E-LEAD ['I' should be PRO]
        AND PRESENT-ELEMENT- IS OCCURRING IN SUBJECT.
WPOS68 =
        [* N is not 'left' or 'right' if before H-PTPART or H-PTAREA;]
        [* force 'left' to ADJ: 'left frontal lobe'. ]
        [* N is not 'past' if before H-RECORD ('history'); ]
        [* force 'past' to ADJ: 'past history'. ]
        [* N is not 'normal' if before ADJ or N; ]
        [* OK 'returned to normal' but don't split 'normal left lobe']
        [* Avoid 'mild LAD' as first LNR object of 'revealed' in ]
        [* 'Catheterization lab revealed mild LAD and circumflex disease]
        [* N is not 'MAY' if before V; is 'may' H-MODAL in 'This may be ]
        [* degenerative'. OK in 'Returned visit in MAY' ]
        IN NVAR AFTER N:
        BOTH IF VALUE IS 'LEFT' OR 'RIGHT'
        THEN NEITHER CURRENT WORD X1 IS N: H-PTPART OR H-PTAREA
        NOR X1 IS ADJ: H-PTPART OR H-PTAREA
        AND BOTH IF VALUE X-NOUN IS 'PAST'
        THEN NEITHER CURRENT WORD X1 IS N: H-RECORD
        NOR AT X1 NEXT WORD IS N: H-RECORD
        AND BOTH IF X-NOUN IS 'NORMAL'
        THEN CURRENT WORD IS NOT N OR ADJ
        [OK 'returned to normal' ]
        [but don't split 'normal left lobe']
        AND BOTH IF VALUE IS H-PTPART
        [e.g.'LAD' left anterior descending]
        THEN IF WORD PRECEDING PRESENT NODE EXISTS@
        [could be first word in sentence]
        THEN IT- IS NOT 'MILD'
        AND IF VALUE IS 'MAY'
        THEN CURRENT WORD IS NOT V
        [This may be degenerative].
WPOS69 =
        [* restricts TENSE to not be VDO if next word is 'well':]
        [* in 'He did well until..', 'did' is not W. Force verb.]
        [* restricts TENSE to 'should' or null in C1SHOULD:]
        [* 'require that the case (should) be reviewed' ]
        IN TENSE:
        BOTH IF CORE- X1 IS W:VDO
        THEN AT X1 WORD FOLLOWING PRESENT NODE IS NOT 'WELL'
        AND IF IMMEDIATE-NODE IS C1SHOULD
        THEN EITHER VALUE IS NULL OR NULLC
        OR VALUE IS 'SHOULD'.
WPOS70 =
        [* Restricts occurrences of P='to'. ]
        [* Restricts PN in RA: Not all of P='to', current word=V,]
        [* and host=AASP. Analyze 'Unable to answer questions' ]
        [* as ADJ:AASP + TOVO, not ADJ:AASP + PN. ]
        [* Force 'to N/V' to become 'to V' (not RV:PN='to N'), if ]
        [* either V can take TOVO as object or V=VSENT3 in VENPASS]
        [* and ultimate subject is 'it'. ]
        [* In 'was told to return', 'to return' is not PN. ]
        [* In 'It was decided not to risk giving Erythromycin', ]
        [* 'not to risk' is not PN; should be TOVO because TOVO ]
        [* meets DSN4 conditions. ]
        IN PN AFTER P:
        IF P IS 'TO'
        THEN BOTH $NOT-RA-ASP AND $NOT-RV-PN.
   $NOT-RA-ASP =
        IF CURRENT WORD IS V
        THEN NOT BOTH PRESENT-ELEMENT- IS OCCURRING IN RA
        @AND HOST- IS AASP.
   $NOT-RV-PN =
        IF EITHER IMMEDIATE RV EXISTS
        OR IMMEDIATE SAOPTS EXISTS
        WHERE EITHER IMMEDIATE SA-LAST EXISTS
        OR AT IMMEDIATE SA COELEMENT- VERBAL EXISTS
        THEN IF $NEXT
        THEN NEITHER $VERB NOR $VSENT3.
   $NEXT = BOTH CURRENT WORD X-WORD IS V
        AND CURRENT WORD IS [also] N.
   $VERB = EITHER BOTH PRESENT-ELEMENT- IS OCCURRING IN VENPASS
        AND HOST- HAS ATTRIBUTE POBJLIST:TOVO [told to return]
        OR BOTH PRESENT-ELEMENT- IS NOT OCCURRING IN VENPASS
        AND HOST- HAS ATTRIBUTE OBJLIST:TOVO [wants to return].
   $VSENT3 = PRESENT-ELEMENT- IS OCCURRING IN VENPASS
        WHERE BOTH CORE- OF ELEMENT- LVENR IS VSENT3 [decided]
        AND CORE- OF ULTIMATE-SUBJECT IS 'IT'.
WPOS71 =
        [* restricts VEN in NNN: not VDO,VBE,VHAVE: had fever =/ NNN; ]
        [* also VEN is transitive, i.e. has OBJLIST:NSTGO; ]
        [* and if word is TV/VEN then the sequence N + VEN is not the ]
        [* subclass sequence H-TXPROC + H-SHOW: 'EEG demonstrated...' ]
        IN NNN:
        IF ELEMENT- VEN X1 EXISTS
        THEN BOTH X1 IS NOT VDO OR VBE OR VHAVE
        AND AT X1
        BOTH WORD STARTING PRESENT NODE X2 IS VEN:OBJLIST:NSTGO
        AND IF X2 [also] IS TV
        THEN IF ASCEND TO SUBJECT PASSING THROUGH LN
        THEN NOT BOTH X2 IS VEN:H-SHOW
        AND AT IMMEDIATE NNN
        WORD STARTING PRESENT NODE IS N:H-TXPROC.
WPOS72 =
        IN NNN:
        [* restricts N/ADJ in NNN: not N; prefer ADJ in APOS ]
        [* unless APOS is empty. This means the ADJ has been tried ]
        [* and for some reason the N is needed in NPOS after all: ]
        [* 'inpatient monitoring'. NVAR=VING transitive requires ]
        [* NPOS nonempty. WPOS74 ]
        IF BOTH VALUE IS N
        AND WORD STARTING PRESENT NODE IS [also] ADJ
        THEN AT IMMEDIATE NPOS COELEMENT- APOS IS EMPTY.
WPOS72A =
        [* restricts N/ADJ in NVAR: not N; prefer ADJ in APOS if ]
        [* current word is N: In 'continue with asthmatic therapy' ]
        [* analysis is not PN='with asthmatic' as adjunct within ]
        [* 'continue therapy'. 'Asthmatic'=N for 'Pt is an asthmatic']
        [* 2/10/00 make exception for N/ADJ H-TESTVIEW; want NVAR->]
        [* N:H-TESTVIEW for 'AP' in 'AP pelvis'. See WPOS97. ]
        [* 1/8/03 make exception for case where ADJ/N in NVAR is ]
        [* followed by NTIME2, e.g. 'level' in 'check Digoxin level]
        [* today'. OK for 'level' to be N in NVAR because 'today' ]
        [* is not NVAR with left adjunct 'level'=ADJ/N. ]
        [* 3/31/04 add case where ADJ/N in NVAR ('lateral') is followed ]
        [* by a word that is N/ADJ/TV ('left') where the ADJ is H-PTAREA]
        [* as in 'Breasts : Well healing lateral left biopsy scar'. ]
        [* Less probable here that 'left' is a verb with SUBJ='lateral'.]
        [* Actually, 'lateral' is N:H-TESTVIEW for imaging context. ]
        IN NVAR AFTER N:
        IF WORD STARTING PRESENT NODE IS [also] ADJ
        [e.g. 'AP' in 'AP pelvis' or 'level' in 'Digoxin level today']
        [or 'lateral' in 'Well healing lateral left biopsy scar' ]
        THEN BOTH IT IS NOT THE CASE THAT
        BOTH CURRENT WORD IS [also] TV
        AND CURRENT WORD IS ADJ:H-PTAREA ['left']
        AND IF CURRENT WORD IS N [next word after ADJ/N]
        [e.g. 'pelvis', 'today']
        THEN EITHER WORD STARTING PRESENT NODE IS N:H-TESTVIEW
        [e.g. 'AP']
        OR CURRENT WORD IS N:NTIME2
        [e.g. 'today' in 'Digoxin level today'].
WPOS73 =
        [* restricts TQ in TQVINGO; T/Q=QROVING: 'each/all lasting 2 min' ]
        IN TQ:
        VALUE IS QROVING.
WPOS74 =
        [* VING as NVAR =/ 'being','doing','having','ranging','following',]
        [* 'going', 'doing_well', 'decreasing', 'containing' or ]
        [* 'demonstrating'. ]
        [* VING as NVAR has non-null NPOS or is potentially intransitive: ]
        [* 'We will proceed with obtaining' is not a good reparse CENTER; ]
        [* OK: 'We will proceed with the sample obtaining. ]
        IN NVAR AFTER VING:
        BOTH VING IS NOT 'BEING' OR 'DOING' OR 'HAVING' OR 'RANGING'
        OR 'FOLLOWING' OR 'GOING' OR 'DOING'_'WELL'
        OR 'DECREASING' OR 'CONTAINING' OR 'DEMONSTRATING'
        AND IF ELEMENT- NPOS OF COELEMENT- LN IS EMPTY
        THEN EITHER VING X-VING HAS ATTRIBUTE OBJLIST:NULLOBJ
        OR [ was $EXCEPTIONS ]
        X-VING IS 'TESTING' OR 'QUESTIONING'
        [upon further questioning]
        OR 'MONITORING' OR 'COUNSELING'.
WPOS75 =
        [* restricts Q10S as value of NVAR to Q:QTENS: 'patient in her 70s']
        [* Q10S will be assigned a PHRASE-ATT=AGE-PHRASE or TIME-PHRASE or ]
        [* QUANT-PHRASE if context decides. Ambiguous: 'patient in the 70s']
        [* This is a strange restriction. Q10S should be revisited.]
        IN Q10S: BOTH BOTH VALUE IS Q
        AND VALUE HAS ATTRIBUTE QTENS
        AND IF Q HAS ATTRIBUTE QDATE OR QAGE OR QTESTVAL
        THEN TRUE.
WPOS77 =
        [* restricts QTENS in LQR in QN, NQ, QPOS, adjectival QPERUNIT: ]
        [* *10s mg, *ward 20s, *the 30s values, *the 40s per mg values.]
        [* OK: 'beats in the 40s per minute.]
        [* But mandating no QTENS in QPOS causes a rejection of 'BP in ]
        [* the 70's systolic range'; thus 'OR QPOS' is commented out. ]
        IN LQR:
        IF EITHER IMMEDIATE-NODE- X10 IS QN OR NQ [OR QPOS]
        OR IMMEDIATE QPERUNIT IS OCCURRING IN ADJADJ
        THEN CORE- IS NOT QTENS.
WPOS78 =
        [* restricts Q:QTENS in T-DATE in DATEVAR in LDATER: 'in the 70s']
        IN T-DATE: BOTH Q X10 IS QTENS
        AND BOTH X10 IS QDATE
        AND CURRENT WORD IS NOT 'PER'
        [beats in the 40s per minute]
        OR '%' OR 'A'
        [40s beats a minute; see <PERUNIT>].
[WPOS79 = ]
        [* restricts Q:QTENS in T-QPERUNIT in QUANT: ]
        [* 'beats in the 40s per minute' ]
[ IN T-QPERUNIT: BOTH $1 AND $2. ]
[ $1 = ELEMENT- Q X10 IS QTENS. ]
[ $2 = TRUE. ]
WPOS80 =
        [* Restricts VENPASS in RNOPTS in SUBJECT. 'Xray revealed ...'is ]
        [* not SUBJECT='xray'(H-TXPROC) with passive adjunct `revealed..']
        [* 5/18/00 Also the host of such a VENPASS is not H-INST: In 'An ]
        [* examination performed while the patient was being transferred ]
        [* from the coronary care unit to C-Firm revealed that ...' the ]
        [* string starting 'revealed that ...' is not a VENPASS on ]
        [* 'C-firm' or on 'coronary care unit', both H-INST.]
        IN LVENR AFTER VEN:
        IF BOTH AT VEN X-VEN
        WORD STARTING PRESENT NODE IS [also] TV:H-SHOW
        [xray revealed peural thickening]
        OR H-OBSERVE [echocardiogram found hypokinesis ]
        OR H-MODAL [chest xray suggested possible rib fracture]
        AND IMMEDIATE-NODE- [of LVENR] IS VENPASS
        WHERE IMMEDIATE RNOPTS X-RN EXISTS
        THEN BOTH IF EITHER X-RN IS OCCURRING IN SUBJECT X1
        OR $SA-POST-SUBJ
        THEN CORE-ATT OF CORE- OF X1 DOES NOT HAVE MEMBER H-TXCLIN
        OR H-TXPROC OR H-TXVAR OR H-TXSPEC
        OR H-PTAREA [the diagonal revealed 80 % lesion]
        OR H-PT [patient stated that ..]
        OR H-DEVMED [the device recognized arrhythmia]
        AND AT X-RN CORE-ATT OF HOST- DOES NOT HAVE MEMBER H-INST
        OR H-FAMILY [His wife found him unconscious].
   $SA-POST-SUBJ = IMMEDIATE SA EXISTS;
        EITHER $1 OR $2.
   $1 = GO LEFT; TEST FOR SUBJECT; STORE IN X1.
   $2 = GO LEFT; TEST FOR TENSE; STORE IN X2; X2 IS EMPTY;
        GO LEFT; TEST FOR SA; STORE IN X2; X2 IS EMPTY;
        GO LEFT; TEST FOR SUBJECT; STORE IN X1.
WPOS80A =
        [* restricts VINGO in RNOPTS if VING is H-SHOW. If there is ]
        [* a possible host of the test variety in SUBJECT, then the ]
        [* host of VINGO in RNOPTS is not the immediate H-INST. E.g. ]
        [* In 'coronary angiography was performed by Dr yyy, revealing ]
        [* normal LV function', the string 'revealing normal LV function']
        [* is not an adjunct of H-INST 'Dr yyy', but of 'angiography'. ]
        [* Also host not QN in NSTGT (e.g. 'two years later' in 'She had ]
        [* catheterization two years later showing complete blockage'. ]
        [* It is 'catheterization' not 'two years later' that is 'showing]
        [* complete blockage'.]
        IN LVINGR AFTER VING:
        IF BOTH ELEMENT- VING X-VING IS H-SHOW [revealing pleural thickening]
        OR H-MODAL [suggesting possible rib fracture]
        AND IMMEDIATE-NODE- [of LVINGR] IS VINGO
        WHERE IMMEDIATE RNOPTS X-RN EXISTS
        THEN BOTH $HOST-NOT-INST AND $HOST-NOT-QN-TIME.
   $HOST-NOT-INST =
        IF BOTH EITHER EITHER X-RN IS OCCURRING IN SUBJECT X1
        OR AT X-RN EITHER ULTIMATE-SUBJECT X1 EXISTS
        OR AT IMMEDIATE PN ULTIMATE-SUBJECT X1
        EXISTS [performed by Dr yyy, revealing]
        OR $SA-POST-SUBJ
        AND CORE-ATT OF CORE- OF X1 HAS MEMBER H-TXCLIN OR H-TXPROC
        THEN AT X-RN CORE-ATT OF HOST- DOES NOT HAVE MEMBER H-INST.
   $SA-POST-SUBJ = IMMEDIATE SA EXISTS;
        EITHER $1 OR $2.
   $1 = GO LEFT; TEST FOR SUBJECT; STORE IN X1.
   $2 = GO LEFT; TEST FOR TENSE; STORE IN X2; X2 IS EMPTY;
        GO LEFT; TEST FOR SA; STORE IN X2; X2 IS EMPTY;
        GO LEFT; TEST FOR SUBJECT; STORE IN X1.
   $HOST-NOT-QN-TIME = IF HOST- IS QN@
        THEN IT IS NOT THE CASE THAT IMMEDIATE NSTGT EXISTS.
WPOS81 =
        [* restricts VENPASS in RNOPTS in SUBJECT. Analysis of 'Pt received..']
        [* is not SUBJECT ='pt'(H-PT) with passive adjunct `received..'. ]
        [* In 'pt described pain' 'described' =/ passive adjunct of 'pt'. ]
        IN LVENR AFTER VEN:
        IF BOTH AT VEN X-VEN WORD STARTING PRESENT NODE IS
        'RECEIVED' OR 'REQUIRED' OR 'REFUSED' OR 'DENIED' OR 'PRESENTED'
        AND IMMEDIATE-NODE- [of LVENR] IS VENPASS
        WHERE EITHER IMMEDIATE RNOPTS IS OCCURRING IN SUBJECT X1
        OR $SA-POST-SUBJ
        THEN CORE- OF X1 IS NOT H-PT [patient presented..]
        ELSE IF BOTH BOTH AT X-VEN WORD STARTING PRESENT NODE IS 'DESCRIBED'
        AND AT VEN WORD FOLLOWING PRESENT NODE IS NOT 'AS'
        OR 'BY'
        AND IMMEDIATE-NODE- [of LVENR] IS VENPASS
        WHERE EITHER IMMEDIATE RNOPTS IS OCCURRING IN SUBJECT X1
        OR $SA-POST-SUBJ
        THEN CORE- OF X1 IS NOT H-PT.
   $SA-POST-SUBJ = IMMEDIATE SA EXISTS;
        EITHER $1 OR $2.
   $1 = GO LEFT; TEST FOR SUBJECT; STORE IN X1.
   $2 = GO LEFT; TEST FOR TENSE; STORE IN X2; X2 IS EMPTY;
        GO LEFT; TEST FOR SA; STORE IN X2; X2 IS EMPTY;
        GO LEFT; TEST FOR SUBJECT; STORE IN X1.
WPOS81A =
        [* restricts VENPASS in SAOPTS in pre-SUBJECT SA: In 'Initially]
        [* started on Floxtat' we want 'started' to be TV, not VEN in ]
        [* passive adjunct `started on']
        IN LVENR AFTER VEN:
        IF BOTH AT VEN X-VEN WORD STARTING PRESENT NODE IS
        'RECEIVED' OR 'REQUIRED' OR 'REFUSED' OR 'DENIED' OR 'STARTED'
        OR 'DEVELOPED' OR 'OBTAINED'
        AND IMMEDIATE-NODE- [of LVENR] IS VENPASS
        WHERE ITERATE IMMEDIATE SA X1 EXISTS
        THEN AT X1 GO LEFT [OK passive if not string-initial SA].
WPOS81B =
        [* Restricts VENPASS in RNOPTS in SUBJECT when current word is]
        [* 'failed':'Pt failed to keep appointment', 'Bone scan failed]
        [* to show any abnormality'; 'failed' is not passive modifier ]
        [* of 'Pt' or 'Bone scan'. Similarly for 'led to' as in 'Gold ]
        [* led to rash on face'. ]
        IN LVENR AFTER VEN:
        IF BOTH AT VEN X-VEN WORD STARTING PRESENT NODE IS 'FAILED' OR 'LED'
        AND CURRENT WORD IS 'TO'
        THEN IT IS NOT THE CASE THAT
        IMMEDIATE-NODE- [of LVENR] IS VENPASS
        WHERE EITHER IMMEDIATE RNOPTS IS OCCURRING IN SUBJECT X1
        OR $SA-POST-SUBJ.
   $SA-POST-SUBJ = IMMEDIATE SA EXISTS;
        EITHER $1 OR $2.
   $1 = GO LEFT; TEST FOR SUBJECT; STORE IN X1.
   $2 = GO LEFT; TEST FOR TENSE; STORE IN X2; X2 IS EMPTY;
        GO LEFT; TEST FOR SA; STORE IN X2; X2 IS EMPTY;
        GO LEFT; TEST FOR SUBJECT; STORE IN X1.
WPOS81C =
        [* Restricts VENPASS in RNOPTS when the VENPASS should adjoin a ]
        [* host further up the tree. E.g. 'stopped secondary to fatigue']
        [* in 'The patient underwent modified Bruce exercise treadmill ]
        [* with a maximum heart rate 64 % , rate pressure product 18000 ]
        [* stopped secondary to fatigue' should adjoin 'Bruce exercise ]
        [* treadmill' and not 'rate pressure product 18000' and not 'a ]
        [* maximum heart rate 64 %'. This could be a DISQUALIFY on the ]
        [* VENPASS option of RNOPTS, but VEN in VENPASS may later have ]
        [* to be qualified. ]
        [* Also push up to SA a VENPASS starting with 'given' unless it ]
        [* modifies H-TTMED: OK as RN: 'the drug given'; better as SA: ]
        [* 'Bypass grafting would be high risk given patient's previous ]
        [* thoracic surgery'. ]
        IN LVENR AFTER VEN:
        IF IMMEDIATE VENPASS EXISTS
        WHERE IMMEDIATE RN X1 EXISTS
        THEN BOTH NOT $1 AND $2.
   $1 = GO LEFT;
        TEST FOR RNOPTS [VENPASS is second RN on host];
        VALUE IS QUANT [first RN is QUANT].
   $2 = IF ELEMENT- VEN IS 'GIVEN'
        THEN CORE-ATT OF HOST- OF X1 HAS MEMBER H-TTMED [the drug given].
WPOS81D =
        [* restricts VENPASS in RNOPTS in SUBJECT where VEN in VENPASS is ]
        [* H-CHANGE-MORE or H-CHANGE-LESS and subject is H-INDIC/H-DIAG. ]
        [* Analysis of 'Episodes of spotting increased in frequency to the ]
        [* point where she began to have daily spotting' is not SUBJECT = ]
        [* 'Episodes of spotting' with passive RN = 'increased in frequency'.]
        [* This becomes important in a long sentence where the rest of the ]
        [* sentence requires backing up to get a verb like 'increased' out ]
        [* of VENPASS and into the TV spot. We run out of grammar list space.]
        [* 8/27/01 Tested OK with 'Spotting increased in frequency' but not ]
        [* 'Episodes of spotting increased in frequency'; test for COMPUTED- ]
        [* ATTRIBUTE fails. To be debugged.]
        IN LVENR AFTER VEN:
        IF BOTH VEN X-VEN IS H-CHANGE-MORE OR H-CHANGE-LESS
        AND IMMEDIATE-NODE- [of LVENR] IS VENPASS
        WHERE EITHER $RNOPTS OR $SA-POST-SUBJ
        THEN IF CORE-ATT OF CORE- OF X1 HAS MEMBER H-INDIC OR H-DIAG
        THEN CURRENT WORD IS 'WITH' OR 'BY'
        [VENPASS OK in INFLUENCE-PHRASE where VEN = H-CHANGE-MORE/LESS ]
        [and upcoming preposition is 'with' or 'by': 'spotting increased]
        [with exercise is...'].
   $RNOPTS = ASCEND TO SUBJECT PASSING THROUGH PN OR PVINGO OR VINGO;
        STORE IN X1.
   $SA-POST-SUBJ = IMMEDIATE SA EXISTS;
        EITHER $1 OR $2.
   $1 = GO LEFT; TEST FOR SUBJECT; STORE IN X1.
   $2 = GO LEFT; TEST FOR TENSE; STORE IN X2; X2 IS EMPTY;
        GO LEFT; TEST FOR SA; STORE IN X2; X2 IS EMPTY;
        GO LEFT; TEST FOR SUBJECT; STORE IN X1.
WPOS82 =
        [* TV in TVO is not 'LEFT' pre PTPART/Q:'left breast'/left 2+']
        IN TVO AFTER VERB:
        AT VERB NOT BOTH CORE- IS 'LEFT'
        AND EITHER CURRENT WORD IS N: H-PTPART [left breast]
        OR CURRENT WORD IS Q [carotids - left 2+].
WPOS83 =
        [* restricts QN-TIME in LP to before P=TMPREP: 2 days after adm. ]
        IN QN-TIME:
        BOTH ELEMENT- N IS NTIME1
        AND CURRENT WORD IS P: H-TMPREP.
WPOS83A =
        [* restricts NQ-TIME in LP to before P=TMPREP: day 2 post MI. ]
        IN NQ-TIME:
        BOTH ELEMENT- N IS NTIME1
        AND CURRENT WORD IS P: H-TMPREP.
WPOS84 =
        [* restricts QN in NVAR in SUBJECT. No PHRASE-ATT=TIME-PHRASE: ]
        [* '2 days after adm was feverish' /= SUBJECT VBE SYMPT. ]
        [* But OK:'The next five days were spent managing the patient.']
        [* So QN OK if next word is VBE PLURAL. Zeroed patient subject ]
        [* (was feverish) requires singular verb in TVO. Kind of ad hoc]
        [* Note: can't say in RL: HAS NODE ATTRIBUTE PHRASE-ATT WITH ]
        [* VALUE TIME-PHRASE because VALUE must be node. ]
        IN NVAR AFTER QN:
        IF ELEMENT- QN X3 IS OCCURRING IN SUBJECT
        THEN EITHER AT ELEMENT- N OF X3
        [EITHER COELEMENT- SCALESTG SUBSUMES 'OLD' OR 'AGE' ]
        [2 years old, 2 yrs of age - these are not SUBJECT]
        [OR] N IS H-AGE
        [This 22 year old; note dict: YEAR_OLD N H-AGE]
        OR EITHER BOTH CURRENT WORD X5 IS TV:VBE
        [VHAVE? 'Two days have passed']
        AND CURRENT WORD IS TV:PLURAL
        OR X5 IS 'OF'
        [20 cc of Xylocaine were used for local anesthesia].
WPOS85 =
        [* TV/VEN:H-RESP in VENPASS in RN in SUBJECT is more likely the ]
        [* main verb: 'Her condition improved slowly'. ]
        IN VENPASS AFTER LVENR: NOT ALL OF $1, $2, $3.
   $1 = AT PRESENT-ELEMENT- X3 CORE- [=VEN] X1 OF LVENR IS H-RESP.
   $2 = AT X1 WORD STARTING PRESENT NODE IS [also] TV.
   $3 = AT X3 IMMEDIATE RN EXISTS
        WHERE PRESENT-ELEMENT- IS OCCURRING IN SUBJECT.
WPOS86 =
        [* TV in VVAR is not 'left' pre PTPART (e.g. 'arm') in 'Pt had ]
        [* pain in jaw and left arm accompanied by...' ]
        [* Also TV in VVAR is not 'left' if PTPART is preceding word: ]
        [* Medcin: 'swelling in the cheek left'; 'left' is BPART in RNOPTS]
        [* 4/12/01 'elevated' following E-INTVL is not TV: 'ST elevated'. ]
        IN VVAR AFTER TV: BOTH $LEFT AND $EKG.
   $LEFT = IF TV IS 'LEFT'
        THEN BOTH CURRENT WORD IS NOT N: H-PTPART
        [had pain in jaw and left arm...]
        AND WORD PRECEDING PRESENT NODE X-TEST IS NOT N: H-PTPART
        [Medcin: 'swelling in the cheek left'].
   $EKG = IF TV IS 'ELEVATED'
        THEN AT IMMEDIATE VERB
        CORE- OF COELEMENT- SUBJECT IS NOT N:E-INTVL ['ST elevated'].
WPOS87 =
        [* reject SUB1 if conditions OK for SUB3: 'while eating..' ]
        [* 'while' = CS1/CS3. ]
        IN SUB1 AFTER CS1:
        NOT BOTH $1 AND $2.
   $1 = WORD STARTING PRESENT NODE IS [also] CS3.
   $2 = CURRENT WORD IS VING.
WPOS88 =
        [* NTIME is a substitute for NSTGT for NTIME2 words. Avoids the lengthy]
        [* LNR computation of NSTGT in RNOPTS and SAOPTS. WPOS88 restricts the ]
        [* Noun in NTIME to NTIME2 (today, tomorrow, yesterday). Examples: ]
        [* 'will have blood test TODAY', TOMORROW he will have blood work done']
        IN NTIME AFTER N:
        N IS NTIME2.
WPOS89 =
        [* disallow PN (N=H-INDIC) in RNOPTS on host=QN carrying attribute ]
        [* PHRASE-ATT= TIME-PHRASE: In 'complains for 2 years of leg pain' ]
        [* 'of leg pain' is not part of QN (QN should be just '2 years') ]
        [* because 'of leg pain' is needed as object of 'complains'. ]
        [* See related DPOS23 re placement of 'of ...' after 'complain' ]
        [* 10/14/01 disallow PN (N=H-INST) in RNOPTS on host=QN. In 'He has]
        [* follow-up in two weeks by Dr yyy' the PN 'by Dr yyy' should ]
        [* adjoin 'follow-up' not QN='two weeks'; avoid being in TIME phrase.]
        [* 11/4/01 disallow PN (P=with,N=H-INDIC) in RNOPTS on host=H-INDIC.]
        [* In 'Patient presented to my office with dyspnea' the PN='with ]
        [* dyspnea' should not adjoin 'office'. Selection should solve this,]
        [* but faster to do it here]
        [* 7/29/03 disallow PN (N=H-INDIC) in RNOPTS on host=QN. In 'ECG ]
        [* revealed normal sinus rhythm at 67 beats per minute with left axis]
        [* deviation' the PN 'with left axis deviation' should adjoin 'normal]
        [* sinus rhythm' not QN='67 beats per minute'. ]
        IN RNOPTS AFTER PN:
        IN PN
        BOTH IF HOST IS QN X1
        WHERE BOTH X1 HAS NODE ATTRIBUTE PHRASE-ATT X-PH-ATT
        AND X-PH-ATT HAS MEMBER TIME-PHRASE
        THEN IF AT CORE OF NSTGO
        CORE-ATT HAS MEMBER H-INDIC
        THEN IF X1 IS OCCURRING IN PN @
        THEN P IS NOT 'FOR'
        [Not OK QN+PN: 'complains for 2 years of leg pain' ]
        [need verb + object = 'complains of leg pain']
        [OK QN+PN: Patient comes in with one month of fatigue]
        [OK QN+PN: Patient experienced one hour of abdominal pain]
        AND IF X1 EXISTS [HOST of PN is QN]
        THEN NEITHER BOTH ELEMENT- P X-P [P of starting PN in RNOPTS] IS 'BY'
        AND CORE-ATT OF CORE- OF ELEMENT- NSTGO HAS MEMBER H-INST
        [He has follow-up in two weeks by Dr yyy]
        NOR BOTH X-P IS 'WITH'
        AND CORE-ATT OF CORE- OF ELEMENT- NSTGO HAS MEMBER H-INDIC
        [normal sinus rhythm at 67 beats per minute with left axis deviation].
WPOS89A =
        [* 11/4/01 disallow PN (P=with,N=H-INDIC) in RNOPTS on host=H-INST.]
        [* In 'Patient presented to my office with dyspnea' the PN='with ]
        [* dyspnea' should not adjoin 'office'. Selection should solve this]
        [* but faster to do it here]
        [* Example with H-TXVAR 'enzymes' not adjunct of 'office' in 'The ]
        [* patient ruled out for MI while on the floor with serial CK-MB ]
        [* enzymes.']
        IN RNOPTS AFTER PN:
        IN PN
        IF BOTH ELEMENT- P IS 'WITH'
        AND CORE OF ELEMENT- NSTGO IS H-INDIC OR H-DIAG OR H-TXVAR
        THEN HOST- IS NOT H-INST.
WPOS89B =
        [* 5/20/03 disallow PN (P=in,N=H-INST) in RNOPTS on host=NTIME1. ]
        [* In 'Patient spent some time in the CCU' the PN='in the CCU' ]
        [* should not adjoin 'time'. Selection should solve this but does]
        [* not operate in OBJECT. Similar to WPOS89 where HOST is QN. ]
        IN RNOPTS AFTER PN:
        IN PN
        IF BOTH ELEMENT- P IS 'IN'
        AND CORE OF ELEMENT- NSTGO IS H-INST
        THEN HOST- IS NOT NTIME1.
WPOS90 =
        [* Disallow N/TV in NVAR in SUBJECT if TV is H-OBSERVE and SINGULAR]
        [* and NPOS=patient/family: In 'The patient states/finds that ...',]
        [* the string 'that ...' is not WHS-N adjunct of N = states/finds. ]
        IN NVAR AFTER N:
        NOT ALL OF $1, $2, $3, $4.
   $1 = WORD STARTING PRESENT NODE IS [ALSO] TV:SINGULAR.
   $2 = WORD STARTING PRESENT NODE IS [ALSO] TV:H-OBSERVE [e.g. 'states'].
   $3 = IN COELEMENT- LN [OF NVAR] CORE- OF NPOS IS 'PATIENT' OR 'FAMILY'.
   $4 = IMMEDIATE SUBJECT EXISTS [Patient states that../The family notes..].
WPOS91 =
        [* Restrict ADJ='status post' to occur in ADJINRN, and it must be ]
        [* followed by a punctuation mark. Thus, allow 'MI status post;' ]
        [* with 'status post' = ADJ occurring in ADJINRN, but not 'Angina ]
        [* status post MI' with 'status post' in ADJINRN on 'angina'. ]
        [* It is important for 'status post' to be a P in PN in order for ]
        [* it to be treated as H-CONN and TIME-PHRASE in both HIUs in e.g.]
        [* 'Status post PTCA of LAD and PTCA of RCA 01/26/1998'. ]
        IN AVAR AFTER ADJ:
        IF VALUE IS 'STATUS-POST' OR 'STATUS'_'POST' OR 'S'_'/'_'P'
        THEN BOTH PRESENT-ELEMENT- IS OCCURRING IN ADJINRN
        AND CURRENT WORD IS ',' OR ';' OR '.'.
WPOS92 =
        [* disallow TOVO as RN of various N if OBJECT in TOVO is OBJBE where]
        [* CORE-ATT of CORE has member H-INDIC/H-DIAG: In 'He was found ]
        [* during rounds to be unresponsive', 'rounds' is not host of 'to ]
        [* be responsive'. ]
        IN RNOPTS AFTER TOVO:
        IF HOST- IS H-INST OR H-TMLOC
        THEN IN TOVO
        AT ELEMENT- OBJBE OF ELEMENT- OBJECTBE OF ELEMENT- OBJECT
        CORE-ATT OF CORE- DOES NOT HAVE MEMBER H-INDIC OR H-DIAG.
WPOS93 =
        [* Restrict QUANT in NSTGO of PN object: should not be pre ADJ; ]
        [* get PN=P+Q+A+N: 'complained of five out of ten anginal pain'.]
        IN OBJECT AFTER PN:
        IN ELEMENT NSTGO OF PN
        IF VALUE IS QUANT
        THEN CURRENT WORD IS NOT ADJ.
WPOS94 =
        [* Restricts P in PVINGO in OBJBE to H-RESP. Treats the many "false"]
        [* prepostions created for INFLUENC-PHRASE, e.g.'relieved_by' in ]
        [* 'Pain is relieved by lying down'. ]
        IN PVINGO AFTER P:
        IF IMMEDIATE-NODE- IS OBJBE
        THEN ELEMENT- P IS H-RESP.
WPOS95 =
        [* $NOT-HOST-HISTORY ]
        [* Restricts PN (P='status post') not to be RN of 'history'. In ]
        [* 'A 72 year old male with a history of coronary artery disease , ]
        [* status post multiple PTCA procedures' the PN = 'status post ]
        [* multiple PTCA procedures' should be a 2nd RN of 'male' not of ]
        [* 'history', so it will constitute a new HIU. ]
        [* ]
        [* $NOT-COMMA-SACONJ ]
        [* Restricts PN (P='status post') not to be in SACONJ after a comma. ]
        [* In 'He has severe coronary artery disease , status post multiple ]
        [* percutaneous interventions , and redo coronary bypass grafting' ]
        [* 'status post multiple percutaneous interventions , and redo' is ]
        [* not SACONJ, leaving 'coronary bypass grafting' to be another HIU. ]
        [* ]
        [* $NOT-SENT-INIT-SA ]
        [* Restricts sentence-initial PN (P='status post'); must be FRAGMENT.]
        [* In 'Status post PTCA of LAD and PTCA and 3 Multi Link stents of ]
        [* RCA 01/26/1998 , complicated by slight creatinine increase to 1.6 ]
        [* and enzyme bump peak MB of 12', without WPOS95, the SUBJECT ]
        [* becomes 'MB of 12' because sentence-initial PN='Status post ...' ]
        [* eats all preceding words. ]
        [* ]
        [* $NOT-SP-UNDER-SP ]
        [* 12/18/2003 Limit occurrence of PN in RN in NSTGO of PN where upper]
        [* PN has P = 'status post', to force such PN to independent HIU. ]
        [* Also such P =/ 'of'. Restriction applies in: 'This patient is a 70]
        [* year old white female with a history of intermittent atrial ]
        [* fibrillation , history of coronary artery disease status post CABG]
        [* in 00/00/1988 , status post ventricular tachycardia requiring ]
        [* cardioversion in 00/00/1991 , who has had intermittent atrial ]
        [* fibrillation associated with chest pain in the past'. ]
        [* ]
        [* $NOT-SA-LAST. ]
        [* Also in 'Patient has a history of hypertension and tobacco abuse, ]
        [* as well as CAD, status post PTCA in 00/00/1991', the final PN = ]
        [* 'status post PTCA in 00/00/1991', should be a separate HIU, not SA]
        IN PN AFTER P:
        IF ELEMENT- P IS 'STATUS-POST' OR 'STATUS'_'POST' OR 'S'_'/'_'P'
        THEN ALL OF $NOT-HOST-HISTORY, $NOT-COMMA-SACONJ, $NOT-SENT-INIT-SA,
   $NOT-SP-UNDER-SP, $NOT-SA-LAST.
   $NOT-HOST-HISTORY =
        IF HOST EXISTS@
        THEN PRESENT-ELEMENT- IS NOT 'HISTORY'.
   $NOT-COMMA-SACONJ =
        IF IMMEDIATE SACONJ OF IMMEDIATE SA EXISTS@
        THEN IT IS NOT THE CASE THAT
        IMMEDIATE COMMASTG X-COMMASTG EXISTS.
   $NOT-SENT-INIT-SA =
        IF IMMEDIATE SA EXISTS
        WHERE IMMEDIATE-NODE IS ASSERTION OR FRAGMENT@
        THEN GO LEFT [OK SA because not at beginning of sentence ]
        [and not at beginning of Q-CONJ conjoined to ]
        [ASSERTION or FRAGMENT (use of IMMEDIATE-NODE)]
        [where PN with P='status post' should not be ]
        [adjunct but the start of a new HIU].
   $NOT-SP-UNDER-SP =
        IF IMMEDIATE RNOPTS EXISTS
        WHERE IMMEDIATE PN EXISTS@ [PN above PN carrying this restriction]
        THEN ELEMENT- P [of this above PN]
        IS NOT 'STATUS-POST' OR 'STATUS'_'POST' OR 'S'_'/'_'P' OR 'OF'.
   $NOT-SA-LAST =
        IF BOTH IMMEDIATE SA-LAST EXISTS@
        AND COELEMENT OBJECT EXISTS@
        THEN CORE-ATT OF CORE- [of OBJECT] DOES NOT HAVE MEMBER H-DIAG
        OR H-INDIC [OR 7/7/04 H-TTSURG not tested].
WPOS96 =
        [* Reject WHS-N starting with THAT when deep in PN in RV if verb ]
        [* (e.g. 'suspect') has potential objects THATS and NSTGO else the ]
        [* WHS-N captures all of THATS except last N, which then becomes ]
        [* the object of the verb, e.g. 'suspect hypocalcaemia' in ]
        [* 'We suspect as a consequence of her previous thyroidectomy that ]
        [* hypoparathyroidism accounts for her hypocalcaemia'. The N + WHS-N]
        [* to avoid here is 'thyroidectomy that hypoparathyroidism accounts ]
        [* for'. ]
        IN RNOPTS AFTER WHS-N:
        NOT ALL OF $THAT, $PN-RV, $OBJLIST.
   $THAT = WORD STARTING PRESENT NODE IS 'THAT'.
   $PN-RV = PRESENT-ELEMENT- IS OCCURRING IN PN
        WHERE HOST X1 IS TV OR V OR VING [forget VEN to avoid passive].
   $OBJLIST = BOTH X1 HAS ATTRIBUTE OBJLIST:THATS
        AND X1 HAS ATTRIBUTE OBJLIST:NSTGO.
WPOS97 =
        [* Not PN='at the Tuesday' in 'at the Tuesday clinic'. ]
        [* Not LN NVAR='following nebulised salbutamol'='following'+H-TTMED,]
        [* but OK LN NVAR='the following medications'(H-TTMED,GENERIC). ]
        [* Not LN NVAR='AP pelvis'; want NVAR=N='AP' H-TESTVIEW, +RN=BPART. ]
        [* Disallow LN CONJ LN if Core of NPOS and its conjelem both are ]
        [* H-PTPART but first PTPART belongs with a previous INDIC and ]
        [* second belongs with the host INDIC in NVAR. Reject this LNR. ]
        [* See WCONJ20. ]
        [* Don't conjoin 'ears' and 'sinus' in LN on NVAR = 'problems' in ]
        [* 'Unremarkable for ringing in the ears or sinus problems'. ]
        IN NVAR AFTER N: ALL OF $TIME-MED, $TESTVIEW, $NNN-CONJ.
   $TIME-MED = BOTH IF ELEMENT- N X1 IS NTIME2 [Tuesday]
        THEN IN COELEMENT- LN CORE OF TPOS IS NOT 'THE'
        AND IF X1 IS H-TTMED
        THEN IF IN COELEMENT- LN CORE OF APOS IS 'FOLLOWING'
        THEN X1 IS GENERIC [the following medications].
   $TESTVIEW = IF X1 IS H-PTPART
        THEN IN COELEMENT- LN
        BOTH CORE OF NPOS IS NOT N:H-TESTVIEW [AP pelvis]
        AND CORE OF APOS IS NOT H-TESTVIEW [AP pelvis].
   $NNN-CONJ = IF BOTH X1 IS H-INDIC
        AND X1 IS GENERIC [e.g. problems, symptoms]
        THEN IF IN COELEMENT- LN
        BOTH ELEMENT- CONJ-NODE EXISTS
        WHERE IN Q-CONJ CORE- X2 OF ELEMENT- NPOS
        IS H-PTPART
        AND CONJELEM OF X2 IS H-PTPART [ears and sinus]
        THEN NOT $PNINRN.
   $PNINRN =
        ASCEND TO PN; ASCEND TO RNOPTS;
        HOST- HAS ATTRIBUTE H-INDIC
        [* 'ringing' in 'ringing in the ears or sinus problems'].
— WPOS98 not in use
WPOS99 =
        [* Restricts APOS: not 'suggested' except before 'plan' or 'dose'.]
        [* Restricts 'developed' as first LAR in APOS: Must have preceding]
        [* article, otherwise 'developed' is most likely a verb. ]
        [* Same for 'received':'The patient was enrolled in TIMI-IV and ]
        [* received study drug'. Not one nounphrase:'TIMI-IV and received ]
        [* study drug'. Same for 'obtained'. ]
        [* Also not 'felt patient'=APOS+NVAR in 'Felt patient hostile'. ]
        [* Also not TPOS+ APOS= 'This demonstrated...' in SUBJECT. ]
        [* In 'This demonstrated normal left ventricular contractility' ]
        [* the SUBJECT = 'this' is followed by VERB = 'demonstrated'. ]
        [* Assume this is true for all TV/VEN:H-SHOW. ]
        [* Restricts APOS beginning with VEN=H-TTCOMP ('administered') if ]
        [* previous word is VBE. In 'Patient was administered antibiotics']
        [* the object of 'was' is not LNR = 'administered antibiotics'. ]
        [* Similar constraint for VEN=H-TTGEN, but exceptions may arise. ]
        [* Carried out in $COMP-GEN; hold for now, may not be needed. ]
        IN APOS: ALL OF [$COMP-GEN,] $SUGGESTED, $DEVELOPED, $DEMONSTRATED.
   $COMP-GEN = IF WORD STARTING PRESENT NODE IS VEN:H-TTCOMP OR H-TTGEN
        THEN WORD PRECEDING PRESENT NODE IS NOT V OR TV OR VING: VBE.
   $SUGGESTED = IF CORE- IS 'SUGGESTED'
        THEN CURRENT WORD IS 'PLAN' OR 'DOSE'.
   $DEVELOPED = IF $DEV
        THEN EITHER LEFT-ADJUNCT OF CORE- IS NOT EMPTY
        [overly developed]
        OR EITHER COELEMENT TPOS IS NOT EMPTY
        [a developed sense of ...]
        OR COELEMENT QPOS IS NOT EMPTY
        [3 developed images].
   $DEV = VALUE IS ADJADJ;
        EITHER VALUE IS ADJADJ OR TRUE;
        CORE- IS 'DEVELOPED' OR 'RECEIVED' OR 'OBTAINED' OR 'FELT'.
   $DEMONSTRATED = IF BOTH WORD STARTING PRESENT NODE X-VEN IS VEN: H-SHOW
        AND WORD STARTING PRESENT NODE X-TV IS TV: H-SHOW
        THEN IN IMMEDIATE LN
        IF PRESENT-ELEMENT- IS OCCURRING IN SUBJECT
        THEN CORE- OF ELEMENT- TPOS IS NOT 'THIS'.
WPOS100 =
        [* In the following sentence 'patient' did not 'suggest Xanax': ]
        [* 'The patient received a geriatric consult on 09/25/92 and they]
        [* did not feel that the patient required any anti-depressant ]
        [* therapy at this time and suggested xanax in small doses.' ]
        IN ASSERTION AFTER OBJECT:
        IN OBJECT X3
        IF BOTH CORE-ATT OF CORE- HAS MEMBER H-TTMED [Xanax]
        AND AT X3 CORE- OF COELEMENT VERB IS 'SUGGESTED'
        THEN IF $SUBJ
        THEN EXTENDED-CORE- OF X-SUBJ IS NOT H-PT.
   $SUBJ = AT X3 COELEMENT SUBJECT X-SUBJ EXISTS;
        [* get to a non-null subject above using LINKC jumps ]
        [* when value of SUBJECT is NULLC, assigned in WZERO6]
        ITERATET STORE IN X-SUBJ UNTIL $LINKC FAILS.
   $LINKC = VALUE OF PRESENT-ELEMENT- HAS NODE ATTRIBUTE LINKC.
WPOS101 =
        [* Restricts double RN=PN where both Ps=of, with words between. ]
        [* In 'Hypokinesis of the entire anterior wall and a small ]
        [* localized area of apical dyskinesis' the analysis is not: ]
        [* 'Hypokinesis of the entire anterior wall..of apical dyskinesis'. ]
        [* Possibly this is true for double 'of' even with no words between.]
        [* Try this also for P1=WITH, P2=OF as in 'Mitral regurgitation ]
        [* with hypokinesis of wall and area of dyskinesis'. ]
        IN RNOPTS AFTER PN:
        IF $DOUBLE-PN
        THEN NEITHER $P-OF-OF NOR $P-WITH-OF.
   $DOUBLE-PN = AT IMMEDIATE RN OF PN X2PN
        COELEMENT- RNOPTS EXISTS WHERE VALUE IS PN X1PN.
   $P-OF-OF = BOTH AT X1PN P IS 'OF'
        AND AT X2PN P IS 'OF'.
   $P-WITH-OF = BOTH AT X1PN P IS 'WITH'
        AND AT X2PN P IS 'OF'.
WPOS102 =
        [* The host of apposition APPOS is of the same class as the ]
        [* apposition noun. We allow only H-INST: 'Dr. YYY002 , her ]
        [* family practioner ,...' or H-DEVMED: 'Pacemaker , VVI' or]
        [* H-PT: 'The patient , Mrs XXX'. ]
        [* APPOS may be occurring in RNOPTS IN PAREN-RN, after '('. ]
        [* 4/28/04 remove H-DEVMED. In 'PCI 10/05/98 : laser , balloon ]
        [* , stent of the proximal RCA' neither 'ballon' nor 'stent' ]
        [* should be taken as APPOS on 'laser'. ]
        IN APPOS:
        ALL OF $AFTER-COMMA, $CORE-HOST, $RN.
   $AFTER-COMMA = THE WORD PRECEDING THE PRESENT NODE IS ',' OR '('.
   $CORE-HOST = EITHER BOTH CORE IS N:H-INST
        AND HOST IS N:H-INST
        [OR EITHER BOTH CORE IS N:H-DEVMED ]
        [ AND HOST IS N:H-DEVMED ]
        OR BOTH CORE IS N:H-PT
        AND HOST IS N:H-PT.
   $RN = IN ELEMENT- LNR
        ELEMENT- RN IS EMPTY.
WPOS103 =
        [* The pronouns 'she'/'he' -> H-PT (not H-FAMILY) in certain ]
        [* sections, i.e. in SECT-NAME = 'LAB'. ]
        IN LNR AFTER NVAR:
        IF ALL OF $PRO-PT, $IN-SECTION, $CHECK-PT
        THEN DO $ASSIGN-PATIENT.
   $PRO-PT =
        BOTH VALUE OF ELEMENT- NVAR IS PRO
        AND BOTH CORE-ATT OF CORE- X-CORE HAS MEMBER H-PT
        AND CORE-ATT X-NEWLIST OF X-CORE HAS MEMBER H-FAMILY.
   $IN-SECTION =
        ASCEND TO ONESENT PASSING THROUGH STRING;
        ELEMENT- SECTION EXISTS;
        SECOND ELEMENT OF ELEMENT- SECT-NAME IS 'LAB'.
   $CHECK-PT =
        X-PT := LIST PATIENT-LIST;
        X-SEL := INTERSECT OF X-PT [with X-NEWLIST].
   $ASSIGN-PATIENT =
        AT X-CORE, ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-SEL.
WPOS104 =
        [* The possessive pronouns 'her'/'his' -> H-PT (not H-FAMILY) ]
        [* in certain sections, i.e. in SECT-NAME = LAB]
        IN LN AFTER TPOS:
        IF ALL OF $PRO-PT, $IN-LAB, $CHECK-PT
        THEN DO $ASSIGN-PATIENT.
   $PRO-PT =
        BOTH CORE- X-CORE OF ELEMENT- TPOS IS 'HER' OR 'HIS'
        AND BOTH CORE-ATT OF X-CORE HAS MEMBER H-PT
        AND CORE-ATT X-NEWLIST OF X-CORE HAS MEMBER H-FAMILY.
   $IN-LAB =
        ASCEND TO ONESENT PASSING THROUGH STRING;
        ELEMENT- SECTION EXISTS;
        SECOND ELEMENT OF ELEMENT- SECT-NAME IS 'LAB'.
   $CHECK-PT =
        X-PT := LIST PATIENT-LIST;
        X-SEL := INTERSECT OF X-PT [with X-NEWLIST].
   $ASSIGN-PATIENT =
        AT X-CORE, ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-SEL.
WPOS105 =
        [* WHS-N where SUBJECT = NULLWH and VERB is H-SHOW (e.g. 'revealed')]
        [* should not adjoin the noun in a time PN, (P=H-TMPREP). In ]
        [* 'A bladder catheterization had been performed prior to transfer ]
        [* here which revealed the presence of 140 cc of urine' the host of ]
        [* 'which revealed the presence of 140 cc of urine' should not be ]
        [* 'transfer' but 'catheterization'. Similarly for WHS-N where ]
        [* SUBJECT = NULLWH and VERB is VBE with pred = H-TMLOC. Thus, in ]
        [* 'He asked me to obtain an esophagogram in the hospital which is ]
        [* pending at this time', 'which is pending' should adjoin ]
        [* 'esophagogram' not 'hospital'. ]
        [* Also WHS-N where HOST = N:H-PTPART in PN whose HOST is N:TXPROC ]
        [* in SUBJECT. In 'The patient was sent for MRI scan of his lumbar ]
        [* spine, which reveals severe stenosis at L3-4', the subject of ]
        [* 'reveals' is 'MRI scan', not 'spine'. ]
        IN WHS-N:
        IN ASSERTION
        ALL OF $1, $2, $3.
   $1 = IF BOTH VALUE OF ELEMENT- SUBJECT X-SUBJ IS NULLWH X-WH
        AND CORE- OF COELEMENT- VERB OF X-SUBJ IS H-SHOW [e.g. 'revealed']
        THEN IF EXTENDED-CORE- OF X-SUBJ [e.g. 'transfer']
        IS OCCURRING IN PN@
        THEN P IS NOT H-TMPREP [e.g. 'prior to'].
   $2 = IF BOTH X-WH EXISTS
        AND CORE- OF COELEMENT- VERB X-VERB OF X-SUBJ IS VBE
        WHERE CORE- OF COELEMENT- OBJECT OF X-VERB IS H-TMLOC
        [e.g. 'pending']
        THEN EXTENDED-CORE- OF X-SUBJ [e.g. 'hospital'] IS NOT H-INST.
   $3 = IF BOTH VALUE OF ELEMENT- SUBJECT X-SUBJ IS NULLWH X-WH
        AND CORE- OF COELEMENT- VERB OF X-SUBJ IS H-SHOW [e.g. 'reveals']
        THEN IF BOTH EXTENDED-CORE- OF X-SUBJ [e.g. 'spine'] IS H-PTPART
        AND X-SUBJ IS OCCURRING IN PN@
        THEN HOST- IS NOT H-TXPROC [e.g. 'MRI scan]
        [must reject parse here so that WHS-N will move up the tree]
        [to become adjunct of 'MRI scan'; for correct expansion. ].
WPOS106 =
        [* Restricts LQR in QPOS before N:NUNIT; must get QN-OF or QN.]
        [* 'Drinks 2-3 ounces of alcohol per day'. ]
        IN QPOS AFTER LQR:
        IT IS NOT THE CASE THAT THE CURRENT WORD IS N:NUNIT.
WPOS107 =
        [* Restricts N in N-PRE-S in WHS-N:'cultures, which results were ]
        [* as noted.' ]
        IN N-PRE-S:
        IF ELEMENT- N EXISTS@
        THEN IT- IS 'RESULTS' [to be expanded as needed].
WPOS108 =
        [* Restricts PN in STRING-INITIAL SA: not P=H-NEG if OR ahead; should ]
        [* become FRAGMENT. In 'Without clubbing , cyanosis or edema', prevent]
        [* 'Without clubbing' from being a STRING-INITIAL SA, leaving ]
        [* 'cyanosis or edema' without their negation.` ]
        [* Also not STRING_INITIAL SA=PN with P=H-SHOW, e.g. 'remarkable for' ]
        [* as in 'Remarkable for depression, for which he is on Zoloft'. ]
        [* Also not STRING_INITIAL SA=PN with P = 'associated_with' as in ]
        [* 'Associated with some fever and adenopathy', where if SA=PN= ]
        [* 'associated with some (PRO)' then 'fever and adenopathy'->FRAGMENT.]
        IN SAOPTS AFTER PN:
        IF BOTH $FIRST-SA AND $P
        THEN ALL OF $P-SHOW, $P-NEG, $P-OTHER.
   $FIRST-SA =
        IMMEDIATE SA EXISTS;
        PRESENT-ELEMENT- IS STRING INITIAL.
   $P = IN ELEMENT- PN
        ELEMENT- P X1 EXISTS.
   $P-SHOW = X1 IS NOT H-SHOW [notable for].
   $P-NEG = IF X1 IS H-NEG [without]
        THEN NOT $OR-AHEAD.
   $OR-AHEAD = THERE IS AN 'OR' AHEAD.
   $P-OTHER = X1 IS NOT 'ASSOCIATED'_'WITH'.
WPOS108A =
        [* Restricts VINGO in STRING-INITIAL SA: not VINGO where ]
        [* VING=H-PTVERB. VINGO should become FRAGMENT. In 'Also ]
        [* complaining of photosensitivity rash using Tetracycline' ]
        [* we want the stretch 'ALSO complaining of photosensitivity ]
        [* rash using Tetracycline' to be FRAGMENT (COMPLAIN H-PTVERB).]
        [* We do not want 'complaining of photosensitivity' to be in ]
        [* a STRING-INITIAL SA, leaving 'rash using Tetracycline' to ]
        [* be another FRAGMENT, although in this case the meanings ]
        [* are similar.]
        IN SAOPTS AFTER VINGO:
        IF $UP-TO-FIRST-SA
        THEN IN ELEMENT- VINGO
        CORE- OF LVINGR IS NOT H-PTVERB.
   $UP-TO-FIRST-SA =
        ASCEND TO SA;
        STORE IN X-SA;
        AT X-SA EITHER $UP-TO-FIRST-SA OR TRUE;
        [Assume 2 levels of embedding in SA is limit]
        PRESENT-ELEMENT- IS STRING INITIAL.
WPOS109 =
        [* Special for ]
        [* 'Notable for severe COPD on continuous oxygen since 00/00/1997,' ]
        [* and most recently stopped smoking 01/01/2001'. ]
        IN RNOPTS AFTER VENPASS:
        IF CORE- OF LVENR IS 'STOPPED'
        THEN HOST IS NOT H-TXVAR.
WPOS110 =
        [* Restricts option THIS-THAT of LA to be in OBJBE and preceding ]
        [* VEN = H-CHANGE-MORE/H-CHANGE-LESS: 'had not been this elevated', ]
        [* 'had not been that depressed'. ?Extend to ADJ: 'wasn't this achy']
        IN LA AFTER THIS-THAT:
        BOTH PRESENT-ELEMENT- IS OCCURRING IN OBJBE
        AND CURRENT WORD IS VEN: H-CHANGE-MORE OR H-CHANGE-LESS.
WPOS111 =
        [* Restricts NSTGO object of 'last' to a time noun. In 'The patient ]
        [* stated that these episodes lasted three to four minutes, requiring]
        [* one sublingual nitroglycerin', the object of 'lasted' is not ]
        [* 'nitroglycerin' with 'three to four minutes, requiring' as left ]
        [* adjuncts of it'.]
        IN OBJECT AFTER NSTGO:
        IF CORE- OF COELEMENT VERBAL IS 'LASTED' OR 'LASTING' OR 'LAST' OR
        'LASTS'
        THEN EITHER CORE- X1 IS NTIME1 OR H-TMLOC
        OR X1 IS QN [CORE- is problematic here 5/9/02].
WPOS112 =
        [* Special for 'She reports a feeling in her epigastric area which ]
        [* radiates through to her back and sometimes around to the right ]
        [* upper quadrant'. The HOST of 'radiates' cannot be H-PTPART OR ]
        [* H-PTAREA, e.g. 'area' of 'epigastric area' in the example. ]
        IN ASSERTION AFTER VERB:
        IF CORE- OF VERB X1 IS 'RADIATE' OR 'RADIATES' OR 'RADIATED'
        THEN EXTENDED-CORE- OF COELEMENT- SUBJECT OF X1 IS NOT H-PTPART
        OR H-PTAREA.
WPOS113 =
        [* Restricts 'diastolic' and 'systolic' as N, not preceding an N. ]
        [* 'Diastolic' is ADJ in 'diastolic murmur'; is N in 'diastolic 60']
        [* Also, reject 'radiating' in these positions. In 'Systolic ]
        [* ejection murmur at the left sternal border radiating to the ]
        [* axilla', 'left sternal border radiating' is not OK noun phrase. ]
        IN NNN, NVAR:
        BOTH IF VALUE IS 'DIASTOLIC' OR 'SYSTOLIC'
        THEN CURRENT WORD IS NOT N
        AND VALUE IS NOT 'RADIATING'.
WPOS114 =
        [* Restricts PVINGO in RV or RN or RA if OBJECT is NULLOBJ in VINGO ]
        [* (e.g. 'wheezing') and both the current word is 'and' and the ]
        [* following word is N or T (e.g. 'due to wheezing and a rash'). We ]
        [* need the conjunction of 2 symptoms under 'due to'in the example, ]
        [* not 'a rash' as a separate HIU. May need to restrict the P or the]
        IN PVINGO:
        IF BOTH IMMEDIATE-NODE IS RV OR RNOPTS OR RA
        AND IN VINGO
        VALUE OF OBJECT IS NULLOBJ
        THEN NOT BOTH CURRENT WORD IS 'AND'
        AND NEXT WORD IS T OR N.
WPOS115 =
        [* To cover the occurrence of certain RV strings that occur after ]
        [* the verb object, we allow them in SA-LAST if OBJECT is not empty.]
        [* 8/1/2003 Allow QN where QN carries PHRASE-ATT = TIME-PHRASE, ]
        [* for e.g. QN = '10 times per week in 'The patient eats some form ]
        [* of flesh food approximately 10 times per week'. ]
        IN SAOPTS AFTER QN:
        BOTH PRESENT-ELEMENT- IS OCCURRING IN SA-LAST
        WHERE COELEMENT OBJECT IS NOT EMPTY
        AND AT QN X1
        BOTH X1 HAS NODE ATTRIBUTE PHRASE-ATT X-PH-ATT
        AND X-PH-ATT HAS MEMBER TIME-PHRASE.
WPOS116 =
        [* Conditions for accepting the option P in PDATE]
        [* 9/4/97 PDATE should not adjoin H-INST:'admitted to ZZZ on..']
        IN () PDATE AFTER P:
        BOTH IF HOST- X1 EXISTS@
        [could be in OBJBE: last visit was in 12/00/89]
        THEN X1 IS NOT H-INST
        AND EITHER P X2 IS H-TMPREP
        OR $P.
   $P = [* same list in DOPT29]
        X-PREP := LIST DOPT29-PREP;
        X-NEWLIST := ATTRIBUTE-LIST OF X2;
        INTERSECT OF X-PREP IS NOT EMPTY.
WPOS-117 =
        [* 12/11/03 Allow ASSERTION after ':' or '-' in BESHOW. ]
        [* If parser has reached BESHOW in the grammar then whatever ]
        [* follows the colon has to be parsed. We now add ASSERTION ]
        [* as option in predicate position along with OBJBE and others.]
        [* E.g., 'PLANNED MEDS : We will continue 10 mg IV Lasix drip'.]
        IN ASSERTION AFTER FIRST ELEMENT:
        IF BOTH PRESENT-ELEMENT- IS OCCURRING IN BESHOW
        AND CURRENT WORD IS ':' OR '-'
        THEN TRUE.
WPOS118 =
        [* Q in QPERUNIT as RN of 'N' is not 'V' (Roman 5) ]
        [* In 'No N,V or edema', 'N' is 'nausea, 'V' is 'vomiting'.]
        IN QPERUNIT:
        IF HOST- IS 'N' [nausea]
        THEN CORE- OF LQR IS NOT 'V' [Roman 5]
        ['V' here is abbrev of 'vomiting'].
WPOS119 =
        [* 'Try' as N is never in NPOS. Also, from checking environments, ]
        [* NVAR='try' only if TPOS /= 0, or APOS->'another' as in 'We must ]
        [* give it an adequate try' and 'give them another try'. Without ]
        [* the NPOS constraint on 'try', we get a bad parse for 'Upper neck ]
        [* pain related to DJD , try Robaxin 500 mg qid prn , local heat , ]
        [* stretching and range of motion exercises', where 'try Robaxin' is]
        [* NPOS NVAR. ]
        [* 4/28/2004 also reject NPOS NVAR = H-DEVMED H-PTPART, e.g. 'stent ]
        [* distal RCA' with 'stent distal' in NPOS. Similarly 'PTCA RPAV' ]
        [* should not be NPOS NVAR. The correct parse for both has H-DEVMED ]
        [* or H-TTSURG (stent, PTCA) in NVAR and H-PTPART (RCA, RPVA) in ]
        [* BPART in RN. ]
        [* This restriction prevents a bad parse of 'PCI 10/05/98 : laser , ]
        [* balloon , stent of the proximal RCA , stent distal RCA , PTCA RPAV]
        [* , dist RCA'. ]
        IN NVAR AFTER N:
        PRESENT-ELEMENT- X-NVAR EXISTS;
        BOTH IN COELEMENT- LN X-LN
        BOTH CORE- X-CORE OF ELEMENT- NPOS IS NOT 'TRY'
        AND IF X-CORE IS H-DEVMED ['stent'] OR H-TTSURG ['PTCA']
        THEN VALUE OF X-NVAR IS NOT H-PTPART [RCA]
        AND IF VALUE OF X-NVAR IS 'TRY'
        THEN IN X-LN
        EITHER ELEMENT- TPOS IS NOT EMPTY
        OR CORE- OF ELEMENT- APOS IS 'ANOTHER'.
— SELECTION RESTRICTIONS

WSEL1 =
        [* Simplified WSEL1 tests if object N is OK for governing verb]
        IN NVAR AFTER N:
        IF BOTH $OBJECT-NOUN AND $GOVERNING-VERB ARE TRUE,
        THEN $NO-COMMON IS TRUE.
   $OBJECT-NOUN = AT N X3
        IMMEDIATE OBJECT X10 OF IMMEDIATE NSTGO EXISTS.
   $GOVERNING-VERB = AT X10 THE CORE OF THE VERB-COELEMENT
        HAS ATTRIBUTE NOTNOBJ X5.
   $NO-COMMON = LISTS X3 AND X5 HAVE NO COMMON ATTRIBUTE.
WSEL1A =
        [* WSEL1 adapted for passive adjunct of N]
        IN LVENR AFTER VEN:
        IF BOTH $GOVERNING-VERB AND $HOST-NOUN ARE TRUE
        THEN $NO-COMMON IS TRUE.
   $GOVERNING-VERB = CORE OF LVENR X11 HAS ATTRIBUTE NOTNOBJ X5.
   $HOST-NOUN = PRESENT-ELEMENT- IS OCCURRING IN VENPASS
        WHERE HOST IS N X3.
   $NO-COMMON = LISTS X3 AND X5 HAVE NO COMMON ATTRIBUTE.
WSEL2 =
        [* Suitable subject N for given verb]
        IN ASSERTION, SVINGO, OBES:
        IF BOTH $SUBJECT-NOUN AND $FORBIDDEN-SUBJN
        THEN $NOCOMMON.
   $SUBJECT-NOUN = THE EXTENDED-CORE- X3 OF THE SUBJECT X10 IS N OR PRO.
   $FORBIDDEN-SUBJN =
        AT X10, CORE OF VERB-COELEMENT X2 HAS ATTRIBUTE NOTNSUBJ X5.
   $NOCOMMON = LISTS X3 AND X5 HAVE NO COMMON ATTRIBUTE.
WSEL3 =
        [* Suitable object N in PN if P is H-TMPREP: *prior to him]
        IN PN:
        IF P IS H-TMPREP
        THEN CORE OF NSTGO IS NOT NHUMAN.
WSEL4 =
        [* Suitable pred adjective for subject or host of WHS-N ]
        [* 'Normal' is not a suitable pred of 'disorder' or 'hospital']
        [* NOT 'disorder ...be normal/disorder which was normal']
        [* NOT 'hospital ...be normal/hospital which was normal']
        [* 10/8/99 But 'We are able to...' We=H-INST, able=H-NORMAL]
        [* 10/8/99 Therefore remove H-INST from restriction.]
        IN ASTG, NSTG:
        IF BOTH CORE-ATT X1 OF CORE- X10 HAS MEMBER H-NORMAL
        AND EITHER IMMEDIATE OBJECT EXISTS
        WHERE EXTENDED-CORE- OF COELEMENT- SUBJECT HAS CORE-ATT X2
        OR IMMEDIATE OBJBE EXISTS
        WHERE CORE- OF COELEMENT- SUBJECT HAS CORE-ATT X2
        THEN IT IS NOT THE CASE THAT X2 HAS MEMBER H-DIAG OR H-INDIC
        [OR H-INST].
WSEL5 =
        [* Suitable subject noun, or host of WHS-N, for given type of verb ]
        [* In particular, for verb=H-OBSERVE we don't expect the SUBJECT ]
        [* to be an H-PTPART, i.e. NOT 'brain reported normal' in 'scan of ]
        [* brain reported normal', 'reported'= H-OBSERVE, 'brain'=H-PTPART; ]
        [* here 'scan' is SUBJECT, not 'brain'. Similarly for 'brain which ]
        [* reported normal'. Also in 'scan in hospital which revealed..' the]
        [* host of 'which revealed...' is not 'hospital'= H-INST. ]
        [* 4/26/04 Cannot exclude H-INDIC as SUBJECT of H-OBSERVE verb. Ex: ]
        [* 'Has night sweats that sound more consistent with hot flashes'. ]
        [* Here, 'sound' is H-OBSERVE with H-INDIC subject ('night sweats').]
        IN VERB:
        BOTH IF BOTH CORE-ATT X1 OF CORE- HAS MEMBER H-OBSERVE
        AND EXTENDED-CORE- X-CORE OF COELEMENT- SUBJECT HAS
        CORE-ATT X2
        THEN EITHER IT IS NOT THE CASE THAT X2 HAS MEMBER H-DIAG
        [OR H-INDIC] OR H-PTPART OR H-PTAREA OR H-TXRES
        OR AT X-CORE
        BOTH WORD STARTING PRESENT NODE IS N:H-DIAG OR H-INDIC
        AND WORD STARTING PRESENT NODE IS N:H-INST
        [Diabetes said that his glycosylated hemoglobin was high]
        [Left breast mass to pathology which reported...]
        AND IF BOTH X1 HAS MEMBER H-SHOW [revealed]
        AND EXTENDED-CORE- OF COELEMENT- SUBJECT HAS CORE-ATT X2
        THEN IF X2 HAS MEMBER H-INST
        THEN X2 HAS MEMBER H-TXSPEC [lab,labs,laboratory, etc.]
        OR H-TXPROC [telemetry] OR H-TXCLIN.
WSEL6 =
        [* No VING ='lasting' in NVAR: fail 'each lasting...' as LNR ]
        [* No VING ='lasting' in AVAR unless current word = ADJ or N:]
        [* No 'lasting 2 minutes' as APOS, but OK 'a lasting impression']
        IN NVAR, AVAR AFTER VING:
        EITHER VALUE X1 IS NOT 'LASTING'
        OR BOTH IMMEDIATE-NODE- IS AVAR
        AND CURRENT WORD IS N OR ADJ.
WSEL7 =
        [* Disallow VING ='lasting' in VINGO and PVINGO and TQVINGO if ]
        [* host=H-PTPART/H-PTAREA: '...regions (each) lasting 10 seconds';]
        [* push it up to a better host]
        IN LVINGR AFTER VING:
        IF VING IS 'LASTING'
        THEN ASCEND TO VINGO;
        EITHER ASCEND TO PVINGO OR TQVINGO
        OR TRUE;
        IT IS NOT THE CASE THAT CORE-ATT OF HOST- HAS MEMBER H-PTPART
        OR H-PTAREA.
WSEL8 =
        [* OBJECT=NSTGO=NVAR=QN WHere QN is time-phrase is not OK for ]
        [* H-RESP verb: IN 'fever resolved (H-RESP) 6 months ago', the]
        [* object of 'response' is not '6 months ago' ]
        IN OBJECT AFTER NSTGO:
        AT PRESENT-ELEMENT- X1
        NOT BOTH $QN-TIME AND $VERB-RESP.
   $QN-TIME = CORE IS QN X3;
        X3 HAS NODE ATTRIBUTE PHRASE-ATT X;
        X HAS MEMBER TIME-PHRASE.
   $VERB-RESP = CORE-ATT OF CORE- OF COELEMENT- VERB HAS MEMBER H-RESP.
— SENTENCE NOMINALIZATION (SN) RESTRICTIONS

DSN2 =
        [* A sentence nominalization string THATS/ASSERTION/FORTOVO ]
        [* /WHETHS ]
        [* occurs as right adjunct of an adjective only for certain ]
        [* subclasses of adjectives: OK 'It is true that he came', ]
        [* Not OK: 'It is round that he came'; 'true'= ASENT1:ATHAT. ]
        [* A sentence nominalization string FORTOVO (DSN7 for TOVO) ]
        [* occurs as right adjunct of an adjective only for certain ]
        [* subclasses of adjectives: OK 'It is advisable for her to ]
        [* be admitted'; 'advisable' ASENT1:AFORTO. Not OK: 'It is ]
        [* round for her to be admitted'. Also OK is FORTOVO after ]
        [* an ADJ= ASENT3:AFORTO:'She is anxious for you to know; ]
        [* 'anxious'= ASENT3:AFORTO. The subject in this case is not ]
        [* 'it', but human. Also OK is THATS/ASSERTION after VSENT1. ]
        [* If the form is VING:VSENT1 then the subject is 'it': ]
        [* 'It is not surprising that she wants to postpone this'. ]
        [* If the form is VEN:VSENT1 then the subject is human: ]
        [* 'She was surprised that the test was negative'. ]
        [* 12/20/2001 Exception for ADJ='predictive' as host of THATS:]
        [* 'Though a negative EP study is not sufficiently predictive ]
        [* that arrhythmia events will not occur, this patient's...'. ]
        IN RA RE THATS, ASSERTION, FORTOVO, WHETHS:
        ALL OF $HOST, $NOCOMMA, $NOT-ADJINRN, $IT, $HUMAN.
   $HOST = EITHER HOST X1 IS 'PREDICTIVE'
        OR X1 IS ASENT1 OR ASENT3 OR VSENT1.
   $NOCOMMA = THE PRECEDING WORD IS NOT ','.
   $NOT-ADJINRN = IMMEDIATE-NODE OF IMMEDIATE-NODE IS NOT ADJINRN.
   $IT = IF EITHER BOTH X1 IS ASENT1:ATHAT OR AFORTO
        AND X1 IS NOT ASENT3
        OR X1 IS VING:VSENT1 [surprising, distressing]
        THEN $SUBJIT.
   $SUBJIT = CORE- X-CORE OF ULTIMATE-SUBJECT IS 'IT';
        AT X-CORE
        ASSIGN NODE ATTRIBUTE PLACE-HOLDER.
   $HUMAN = IF EITHER BOTH X1 IS ASENT3 [happy]
        AND X1 IS NOT ASENT1
        OR X1 IS VEN:VSENT1
        THEN $SUBJ-HUMAN.
   $SUBJ-HUMAN = AT X1 EITHER CORE- X-CORE OF ULTIMATE-SUBJECT
        IS NHUMAN OR H-INST
        OR X-CORE IS 'THEY'.
DSN2A =
        [* Conditions for accepting sentential RA after a short preceding RA]
        IN MORE-RA RE THATS, WHETHS:
        ALL OF $HOST, $NOCOMMA, $IT, $HUMAN.
   $HOST = HOST X1 IS ASENT1 OR ASENT3 OR VSENT1.
   $NOCOMMA = THE PRECEDING WORD IS NOT ','.
   $IT = IF EITHER BOTH X1 IS ASENT1:ATHAT OR AFORTO
        AND X1 IS NOT ASENT3
        OR X1 IS VING:VSENT1 [surprising, distressing]
        THEN $SUBJIT.
   $SUBJIT = CORE- X-CORE OF ULTIMATE-SUBJECT IS 'IT';
        AT X-CORE
        ASSIGN NODE ATTRIBUTE PLACE-HOLDER.
   $HUMAN = IF EITHER BOTH X1 IS ASENT3 [happy]
        AND X1 IS NOT ASENT1
        OR X1 IS VEN:VSENT1
        THEN $SUBJ-HUMAN.
   $SUBJ-HUMAN = AT X1 ASCEND TO OBJECTBE;
        ASCEND TO OBJECT;
        AT CORE- OF COELEMENT- SUBJECT
        EITHER PRESENT-ELEMENT- IS NHUMAN OR H-INST
        OR PRESENT-ELEMENT- IS 'THEY'.
DSN3 =
        [* A sentence nominalization string WHETHS adjoins ASENT3 or ASENT1]
        [* only if ASENT3/ASENT1 has subattribute AWH: 'She is uncertain ]
        [* whether she should have surgery' - 'uncertain' is ASENT3:(AWH);]
        [* Not OK 'She is aware whether she should have surgery'- 'aware' ]
        [* is ASENT3 but not AWH.]
        IN RA RE WHETHS:
        EITHER HOST X1 IS ASENT1: AWH
        OR X1 IS ASENT3: AWH.
DSN4 =
        [* Conditions to accept SN in RV for passive VEN=VSENT3/VSENT1. ]
        [* 'IT' form for passive sentential verbs VSENT3: 'It is known ]
        [* that he is a heavy drinker'; the subject must be 'it'.If the ]
        [* passive verb is VSENT1 (disturbed, distressed, surprised) ]
        [* then the subject should be human: 'We were surprised that the ]
        [* values were so low'. Note that TOVO following adjectival ]
        [* VEN:VSENT1 (e.g. 'He was very determined to go' vs. 'It was ]
        [* determined to operate') will parse as TOVO in RA on VEN in ]
        [* AVAR, if forced because of 'very' or other adverb in LA not LV]
        [* and is treated by DSN7. For all types of TOVO following ADJ ]
        [* or adjectival VEN see DSN7. ]
        IN RV RE THATS, C1SHOULD, ASSERTION, FORTOVO, TOVO:
        ALL OF $HOST, $NOCOMMA, $IT, $HUMAN.
   $HOST = BOTH THE HOST X1 IS VSENT3 OR VSENT1
        AND X1 IS OCCURRING IN VENPASS X2.
   $NOCOMMA = THE PRECEDING WORD IS NOT ','.
   $IT = IF X1 IS VSENT3
        THEN $SUBJIT.
   $SUBJIT = CORE- X-CORE OF ULTIMATE-SUBJECT IS 'IT';
        AT X-CORE
        ASSIGN NODE ATTRIBUTE PLACE-HOLDER.
   $HUMAN = IF X1 IS VEN:VSENT1 [concerned, worried]
        THEN $UP-TO-HUMAN.
   $UP-TO-HUMAN=
        AT CORE- OF ULTIMATE-SUBJECT
        EITHER PRESENT-ELEMENT- IS NHUMAN OR H-INST
        OR PRESENT-ELEMENT- IS 'THEY'.
DSN4A =
        [* Conditions for accepting sentential RV after a short preceding RV: ]
        [* 'It is noted there that the family's goal is for the patient to be ]
        [* independent'. LDR 'there' is the first RV; THATS 'the family's goal]
        [* is for the patient to be independent' is the second RV. ]
        IN MORE-RV RE THATS, WHETHS, C1SHOULD:
        ALL OF $HOST, $NOCOMMA, $IT, $HUMAN.
   $HOST = BOTH THE HOST X1 IS VSENT3 OR VSENT1
        AND X1 IS OCCURRING IN VENPASS X2.
   $NOCOMMA = THE PRECEDING WORD IS NOT ','.
   $IT = IF X1 IS VSENT3
        THEN $SUBJIT.
   $SUBJIT = CORE- X-CORE OF ULTIMATE-SUBJECT IS 'IT';
        AT X-CORE
        ASSIGN NODE ATTRIBUTE PLACE-HOLDER.
   $HUMAN = IF X1 IS VEN:VSENT1 [concerned, worried]
        THEN $UP-TO-HUMAN.
   $UP-TO-HUMAN=
        AT CORE- OF ULTIMATE-SUBJECT
        EITHER PRESENT-ELEMENT- IS NHUMAN OR H-INST
        OR PRESENT-ELEMENT- IS 'THEY'.
DSN4B =
        [* 'it was recommended that she be admitted' *]
        IN RV, MORE-RV RE C1SHOULD:
        HOST HAS ATTRIBUTE OBJLIST:C1SHOULD.
DSN5 =
        [* Provide for e.g. 'the fact that he ...'; THATS in RNOPTS *]
        IN RNOPTS RE THATS:
        HOST IS NSENT1 OR NSENT2.
DSN5A =
        [* Provide for e.g. 'the question whether or not to catheterize' *]
        IN RNOPTS RE WHETHS:
        HOST IS NSENT1 OR NSENT2: AWH.
DSN6 =
        [* If the TOVO-N option of RA is taken then the host adjective *]
        [* must be either ADJ of subclass ASENT1:AFORTO or VING:VSENT1 *]
        [* 'steps advisable (for him) to postpone'. *]
        IN RA RE TOVO-N:
        EITHER HOST X1 IS VSENT1
        OR X1 IS ASENT1: AFORTO.
DSN7 =
        [* TOVO as sentential RA can adjoin ADJ:ASENT1:AFORTO (It is ]
        [* essential to give clear instructions). The ULTIMATE-SUBJECT ]
        [* is 'it' in this case. TOVO in this case is shortened FORTOVO ]
        [* (It is essential for one to give clear instructions) The ADJ ]
        [* 'essential' is ASENT1:AFORTO. Also OK is ASENT3:AFORTO which ]
        [* is not the ADJ class requiring ULTIMATE-SUBJECT='it' as in ]
        [* 'He is anxious to know; 'anxious' = ASENT3:AFORTO. ]
        [* Of the same type, but of verbal origin, is VSENT1 (disturbed)]
        [* occurring adjectively: 'He is very disturbed to learn this.' ]
        [* TOVO as non-sentential RA adjoins only ADJ:AASP (He is apt to]
        [* do it, This is apt to cause trouble) or ASENT3:AFORTO (He is ]
        [* eager to do it), and in the latter case has a human subject. ]
        IN RA RE TOVO:
        ALL OF $HOST, $NOCOMMA, $NOT-ADJINRN, $IT, $HUMAN.
   $HOST = EITHER HOST X1 IS ASENT1 OR ASENT3:AFORTO
        [it will be difficult to operate (ASENT1)]
        [patient is determined to leave, (ASENT3)]
        OR X1 IS VSENT1 OR AASP
        [she will be distressed to to learn this VSENT1]
        [he is apt to disagree AASP].
   $NOCOMMA = THE PRECEDING WORD IS NOT ','.
   $NOT-ADJINRN = IMMEDIATE-NODE OF IMMEDIATE-NODE IS NOT ADJINRN.
   $IT = IF EITHER BOTH X1 IS ASENT1:ATHAT OR AFORTO
        AND X1 IS NOT ASENT3
        OR X1 IS VING:VSENT1 [It is surprising to hear this]
        THEN $SUBJIT.
   $SUBJIT = CORE- X-CORE OF ULTIMATE-SUBJECT IS 'IT';
        AT X-CORE
        ASSIGN NODE ATTRIBUTE PLACE-HOLDER.
   $HUMAN = IF EITHER BOTH X1 IS ASENT3 [happy]
        AND X1 IS NOT ASENT1
        OR X1 IS VEN:VSENT1 [concerned, worried]
        THEN $UP-TO-HUMAN.
   $UP-TO-HUMAN=
        AT CORE- OF ULTIMATE-SUBJECT
        EITHER PRESENT-ELEMENT- IS NHUMAN OR H-INST
        OR PRESENT-ELEMENT- IS 'THEY'.
— DVC1 -> DAVC1 - TO BE FIRST RESTRICTION ON NODE BECAUSE OF 'EDIT'
— DVC2 -> DAVC2 - TO BE FIRST RESTRICTION ON NODE BECAUSE OF 'EDIT'

DVC3 =
        [* Restricts object VENO from occurring after 'did have',TENSE=VDO]
        [* Not OK: 'did have gone'; OK 'seems to have adjusted well', and ]
        [* as falsely in 'did have left arm radiation' (did have left ). ]
        IN VENO RE LVENR:
        IF COELEMENT- TENSE X1 OF IMMEDIATE OBJECT EXISTS
        THEN CORE- OF X1 IS NOT VDO.
WVC1 =
        [* Restricts TENSE + VVAR combinations]
IN VVAR: BOTH $TV AND $V.
   $TV = IF CORE- X1 IS TV
        THEN EITHER IMMEDIATE TVO EXISTS [complains of fatigue]
        WHERE X1 IS NOT PLURAL
        ['check digoxin level'; 'check'\=TV]
        OR BOTH $NOT-TENSLESS-STG
        AND IN IMMEDIATE-NODE- X2
        [VERB or Q-CONJ of VERB as an LXR node]
        [Note: VERB is type LXR]
        EITHER $NORMAL-TV
        [X2 is VERB, element of ASSERTION ]
        [or X2 is Q-CONJ; standing in for VERB as LXR conjunct]
        [in which case the non-minus COELEMENT should jump to ASSN]
        OR $NULLC-TV.
   $NOT-TENSLESS-STG = NONSEG-IMMSTG [routine does Q-CONJ jump]
        IS NOT SVO OR C1SHOULD.
   $NORMAL-TV = COELEMENT TENSE X20 OF X2 HAS VALUE NULL.
   $NULLC-TV = AT X2
        BOTH IF VALUE OF COELEMENT SUBJECT IS NULLC
        THEN COELEMENT TENSE [OF X2] HAS VALUE NULLC
        [Subj=NULLC needs TENSE=NULLC,not TENSE=NULL]
        AND IF COELEMENT TENSE [OF X2] HAS VALUE NULLC
        THEN EITHER VALUE OF COELEMENT SUBJECT IS NULLC
        OR EITHER CORE- OF CONJELEM- X12 OF X2 IS TV
        OR AT X12
        BOTH CORE- IS V
        AND CORE- OF COELEMENT- TENSE IS W
        OR NULLC.
   $V = IF X1 IS V
        THEN EITHER $TENSELESS-STG
        OR IN IMMEDIATE-NODE- [VERB] X2
        IF IMMEDIATE-NODE- X3 IS NOT Q-CONJ
        THEN $NORMAL-V
        ELSE [X3 is Q-CONJ; X2 is VERB in Q-CONJ]
        EITHER $NORMAL-V OR $NULLC-V.
   $TENSELESS-STG = NONSEG-IMMSTG [routine does Q-CONJ jump]
        IS SVO OR C1SHOULD.
   $NONSEG-V = NONSEG-IMMSTG [routine does Q-CONJ jump]
        IS SVO OR C1SHOULD.
   $NORMAL-V = CORE- OF COELEMENT- TENSE OF X2 IS W.
   $NULLC-V = IF CORE- OF COELEMENT- TENSE X5 IS NOT W
        THEN BOTH X5 HAS VALUE NULLC
        AND CORE- OF CONJELEM- OF X5 IS W OR NULLC.
WVC4 =
        [* Restricts object VENO from occurring as value of OBJECT in VENO. ]
        [* Not OK: 'He has had gone'; VENO is exclusively the object of HAVE.]
        [* VENO is a past participle + active object of that verb. Thus, 'has]
        [* eaten dinner' is OK, so is 'has had money', but not 'has had eaten]
        [* dinner' = 'has'+object VENO (='had'+object VENO (='eaten dinner'))]
        IN OBJECT AFTER VENO:
        PRESENT-ELEMENT- IS NOT OCCURRING IN VENO.
WVC6 =
        [* The verb in the inverted 'BE' string is BE]
        IN OBES AFTER VERB: CORE OF VERB IS VBE.
WVC9 =
        [* If the subject is 'there', then the verb is VBE ]
        [* and the object is a noun phrase (*there is mild) ]
        IN ASSERTION AFTER OBJECT:
        IF CORE- OF SUBJECT X10 IS 'THERE'
        THEN BOTH AT X10 CORE- OF DEEPEST-COVERB- X11 IS VBE
        AND AT COELEMENT- OBJECT OF X11
        EITHER THE VALUE OF THE VALUE OF THE VALUE IS NSTG
        [OBJECT->OBJECTBE->OBJBE->NSTG]
        OR THE VALUE OF THE VALUE IS EKGSTG
        [OBJECT->OBJECTBE->EKGSTG].
— WH-STRING RESTRICTIONS

DWH1 =
        [* Restricts relative clause: not adjunct of object pronoun. ]
        [* Restricts post-OBJECT relative clause ]
        [* Restricts relative clause with regard to sublanguage host: ]
        [* In 'He also had been told in the past that he had decreased]
        [* kidney function' the stretch 'that he had decreased' is not]
        [* a modifier of 'past' (H-TMLOC), i.e. is not WHS-N here, ]
        [* leaving 'kidney function' to be analyzed with the rest of ]
        [* the sentence. Extend this to dates and other time phrases. ]
        [* Must allow for cases where H-TMLOC is OK host, as in ]
        [* 'Patient is an engineer with past medical history as noted ]
        [* above, which includes CAD'. Here 'which includes CAD' is ]
        [* adjunct of 'past medical history'. ]
        [* Must allow WHS-N in RNSUBJ to adjoin PRO = 'this' as in ]
        [* 'This was performed on 11/18/1998 which revealed a right ]
        [* renal artery with a 95 % ostial stenosis. ]
        IN RNOPTS, RNSUBJ RE WHS-N:
        BOTH BOTH HOST- X1 IS NOT PRO:ACCUSATIVE
        AND IF X1 IS H-TMLOC
        THEN $AT-WHICH
        AND IF BOTH PRESENT-ELEMENT- IS OCCURRING IN SA-LAST
        AND X1 IS PRO@
        THEN EITHER PRESENT-ELEMENT- [subject PRO] IS 'THIS'
        OR PRESENT-ELEMENT- IS INDEFINITE
        [Everything was done that was possible]
        [None of the xrays were seen that were taken last visit]
        [Not: She is pale who was admitted last night]
        [This was performed on 11/18/1998 which revealed a stenosis].
   $AT-WHICH = GO TO CURRENT WORD; STORE IN X-WHICH;
        GO TO NEXT WORD; STORE IN X-VERB;
        X-WHICH IS 'WHICH';
        X-VERB IS 'INCLUDES' [with PMH which includes CAD].
WWH1 =
        [* Conditions for accepting NULLWH as SUBJECT]
        [* Note on $WHO-HUMAN: We check explicitly for H-INST or H-PT ]
        [* because H-INST includes names of institutions and references to]
        [* caregivers, and H-PT refers to the patient, e.g. Mrs. XXX. ]
        IN SUBJECT AFTER NULLWH: EITHER $WHATSTG OR $OTHER.
   $WHATSTG =
        AT PRESENT-ELEMENT- X1 ALL OF $PATH0, $NO-PREV-OM, $ACCEPT.
   $PATH0 = NONSEG-IMMSTG X5 IS WHATS-N.
   $NO-PREV-OM = IT IS NOT THE CASE THAT X5 HAS NODE ATTRIBUTE
        DIDOMIT.
   $OTHER = AT X1 ALL OF $PATH1, $NO-PREV-OM, $IFRN, $ACCEPT.
   $PATH1 = EITHER NONSEG-IMMSTG X5 IS WHS-N OR $NESTED. (GLOBAL)
   $NESTED = NONSEG-IMMSTG IS THATS OR TOVO OR ASSERTION
        OR VENO OR VENPASS; DO $PATH1.
   $IFRN =
        IF EITHER X5 IS OCCURRING AS RN X50
        OR X5 IS OCCURRING AS RNSUBJ X50
        THEN IF HOST X9 OF X50 IS NOT EMPTY
        THEN IF THE FIRST ELEMENT OF X5 IS 'WHICH' OR 'WHO'
        OR 'WHOM' X30
        THEN EITHER $WHICH-NONHUMAN OR $WHO-HUMAN IS TRUE.
   $WHICH-NONHUMAN = BOTH X30 IS 'WHICH'
        AND X9 IS NOT NHUMAN.
   $WHO-HUMAN = BOTH X30 IS 'WHO' OR 'WHOM'
        AND EITHER X9 IS NHUMAN OR H-INST OR H-PT
        OR X9 IS QN
        WHERE ELEMENT- N IS H-AGE [a 90 year-old].
   $ACCEPT = BOTH X1 HAS VALUE NULLWH X2
        AND IN X5 ASSIGN PRESENT ELEMENT THE NODE ATTRIBUTE DIDOMIT
        WITH VALUE X2.
WWH2 =
        [* Conditions for accepting NULLWH in NSTGO where NSTGO ]
        [* is a possibly embedded OBJECT or an N in PN in RN of ]
        [* a possibly embedded object N. Note that $S-N treats a ]
        [* special case of WWH2 for S-N: no $NESTED. Unlikely and]
        [* troublesome to have deeply embedded omission in S-N = ]
        [* headless WH string. OK: 'the pain he was feeling ()'; ]
        [* Less likely: 'the pain he thought he was feeling ()'; ]
        [* Only change from $OTHER is $PATH4 instead of $PATH2. ]
        IN NSTGO AFTER NULLWH: EITHER $S-N OR $OTHER.
   $S-N = AT PRESENT-ELEMENT- X1 ALL OF $PATH4, $NO-PREV-OM, $ACCEPT.
   $PATH4 = ASCEND TO OBJECT PASSING THROUGH NPN OR PN OR VINGO;
        NONSEG-IMMSTG X5 IS S-N.
   $NO-PREV-OM = IT IS NOT THE CASE THAT X5 HAS NODE ATTRIBUTE DIDOMIT.
   $ACCEPT = BOTH X1 HAS VALUE NULLWH X2
        AND IN X5 ASSIGN PRESENT ELEMENT THE NODE ATTRIBUTE DIDOMIT
        WITH VALUE X2.
   $OTHER = AT X1 EITHER $OBJECT OR $ADJUNCT.
   $OBJECT = ALL OF $PATH2, $NO-PREV-OM, $ACCEPT.
   $PATH2 = ASCEND TO OBJECT PASSING THROUGH NPN OR PN OR NN
        [Ex of omission in NN: which he came to call () angina];
        EITHER NONSEG-IMMSTG X5 IS WHS-N OR TOVO-N OR WHATS-N
        OR $NESTED.
   $NESTED = X5 IS THATS OR TOVO OR ASSERTION OR VENO OR VINGO OR
        VENPASS;
        DO $PATH2.
   $ADJUNCT = IMMEDIATE-NODE IS PN
        WHERE IMMEDIATE-NODE OF IMMEDIATE-NODE IS RN
        WHERE AT HOST $OBJECT IS TRUE. [for rnopts]
WWH3 =
        [* WHS-N must contain a NULLWH.]
        IN WHS-N, S-N, WHATS-N, TOVO-N:
        PRESENT-ELEMENT- HAS NODE ATTRIBUTE DIDOMIT.
— ZEROING RESTRICTIONS

WZERO6 =
        [* Handles zeroed SUBJECT: ]
        [* She has fever and {} complains of ... ]
        [* Modeled on MDPAR6 zeroing restrictions]
IN SUBJECT AFTER NULLC:
        ALL OF $SAVE-IN-X3, $CONJELEM-NOT-EMPTY, $VERB-NOT-EMPTY,
   $SET-LINK.
   $SAVE-IN-X3 = NULLC X3 EXISTS.
   $CONJELEM-NOT-EMPTY =
        ITERATE CONJELEM X0 EXISTS
        UNTIL EITHER X0 IS NOT EMPTY
        OR X0 HAS VALUE NULLWH SUCCEEDS.
   $VERB-NOT-EMPTY = AT X0 COELEMENT- VERB IS NOT EMPTY.
   $SET-LINK = AT X3, ASSIGN THE PRESENT ELEMENT NODE
        ATTRIBUTE LINKC.
— PHRASE-MARKING RESTRICTIONS WPHRASE-XXX

WPHRASE-ASSERTION-SOURCE =
        IN OBJECT:
        PRESENT-ELEMENT- X1 EXISTS;
        IF BOTH EITHER VALUE XVAL IS THATS OR NTOVO OR ASSERTION
        OR C1SHOULD OR WHETHS X-OBJ
        [Family has found that patient is withdrawn]
        [Family has found patient to be lethargic]
        [Family says patient is withdrawn]
        [I reccommend patient be hospitalized]
        [He wondered whether the condition had recurred]
        OR XVAL IS OBJECTBE
        WHERE BOTH CORE- X-ADJ IS ADJ: ASENT3
        [Patient is concerned he is getting worse]
        AND RIGHT-ADJUNCT OF X-ADJ IS THATS OR ASSERTION
        OR WHETHS X-OBJ
        AND $SUBJECT IS TRUE
        THEN BOTH $MARK
        AND $DOUBLE-ASSIGN
        ELSE IF BOTH $INDIC-OBJ AND $SUBJECT
        THEN DO $DOUBLE-ASSIGN.
   $SUBJECT =
        ITERATET $UP-THRU-VERBS UNTIL $SUBJ-LEVEL SUCCEEDS;
        EITHER BOTH EXTENDED-CORE- OF X-SUBJ IS 'THEY'
        [They did not feel that the patient required anti-depressant]
        [Dr YYY863 was consulted who felt that bypass was necessary]
        AND BOTH AT X1
        CORE- OF COELEMENT- VERB IS H-OBSERVE OR VSENT3
        AND DO $ASSIGN-INST
        OR EXTENDED-CORE- OF X-SUBJ IS H-PT
        [Patient says /that/she is doing better]
        [Patient is concerned he is getting worse]
        [Patient who is concerned he is getting worse]
        OR H-INST [I don't think that these symptoms warrant..]
        OR H-FAMILY [Her family notes that...]
        [His father reports that ...].
   $ASSIGN-INST =
        X-INST := NIL;
        X-THEY := SYMBOL H-INST;
        PREFIX X-THEY TO X-INST;
        AT CORE- OF X-SUBJ
        ASSIGN NODE ATTRIBUTE SELECT-ATT WITH VALUE X-INST.
   $UP-THRU-VERBS = X1 IS OCCURRING IN VENO OR VINGO
        WHERE IMMEDIATE OBJECT X1 EXISTS.
   $SUBJ-LEVEL =
        AT X1 COELEMENT- SUBJECT X-SUBJ EXISTS;
        AT X-SUBJ STORE IN X-SOURCE-SUBJ;
        IF X-SUBJ HAS VALUE NULLC@
        [LINKC attrb will point to conjoined SUBJ above]
        THEN PRESENT-ELEMENT- HAS NODE ATTRIBUTE LINKC X-SUBJ
        [She had a tendon injury 25 years ago and {NULLC}]
        [wondered if it has recurred].
   $MARK = ONE OF $ASSERT, $THATS, $NTOVO, $C1SHOULD, $WHETHS.
   $ASSERT = X-OBJ IS ASSERTION X-MARK.
   $THATS = X-OBJ IS THATS;
        ELEMENT- ASSERTION X-MARK EXISTS.
   $NTOVO = X-OBJ IS NTOVO X-MARK.
   $C1SHOULD = X-OBJ IS C1SHOULD WHERE ELEMENT- ASSERTION X-MARK EXISTS.
   $WHETHS = X-OBJ IS WHETHS WHERE
        EITHER ELEMENT- ASSERTION X-MARK EXISTS
        OR ELEMENT- TOVO X-MARK EXISTS.
   $DOUBLE-ASSIGN =
        X-PHRASE-LIST := NIL;
        X-NOW := SYMBOL SOURCE-PHRASE;
        PREFIX X-NOW TO X-PHRASE-LIST;
        BOTH DO $ASSIGN AND DO $ASSIGN-POINTER.
   $ASSIGN = AT X-SOURCE-SUBJ
        ASSIGN NODE ATTRIBUTE PHRASE-ATT WITH VALUE X-PHRASE-LIST.
   $ASSIGN-POINTER = AT X-MARK
        ASSIGN NODE ATTRIBUTE SOURCE-ATT WITH VALUE X-SOURCE-SUBJ.
   $INDIC-OBJ = AT X1 EITHER $N-OBJ OR $PN-OBJ.
   $N-OBJ = VALUE IS NSTGO X-MARK;
        CORE-ATT OF CORE- OF X-MARK HAS MEMBER H-INDIC;
        AT X1 CORE- OF COELEMENT- VERB IS H-OBSERVE OR VSENT3
        [Patient noticed some swelling].
   $PN-OBJ = VALUE IS PN WHERE ELEMENT- NSTGO X-MARK EXISTS;
        CORE-ATT OF CORE- OF X-MARK HAS MEMBER H-INDIC;
        AT X1 CORE- OF COELEMENT- VERB IS H-OBSERVE OR VSENT3
        [Patient has pain but knows of no recent trauma to ankle].
WPHRASE-LAR-AGE =
        [* Mark age-indicating adjectival phrase LAR with the node attribute]
        [* AGE-PHRASE, e.g. 'elderly' in 'Patient is white elderly male'. ]
        IN LAR: PRESENT-ELEMENT- X3 EXISTS;
        IF CORE- IS H-AGE
        THEN DO $AGE-LAR.
   $AGE-LAR =
        X-PHRASE-LIST := NIL;
        X-NOW := SYMBOL AGE-PHRASE;
        PREFIX X-NOW TO X-PHRASE-LIST;
        AT X3 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE PHRASE-ATT WITH VALUE X-PHRASE-LIST.
WPHRASE-LAR-ETIME =
        IN LAR: PRESENT-ELEMENT- X3 EXISTS;
        IF CORE-ATT OF CORE- HAS MEMBER H-TMLOC
        THEN DO $TIME-LAR.
   $TIME-LAR =
        X-PHRASE-LIST := NIL;
        X-NOW := SYMBOL TIME-PHRASE;
        PREFIX X-NOW TO X-PHRASE-LIST;
        AT X3 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE PHRASE-ATT WITH VALUE X-PHRASE-LIST.
WPHRASE-LDR-ETIME =
        IN LDR: PRESENT-ELEMENT- X3 EXISTS;
        IF CORE- IS H-TMLOC
        THEN DO $TIME-LDR.
   $TIME-LDR =
        X-PHRASE-LIST := NIL;
        X-NOW := SYMBOL TIME-PHRASE;
        PREFIX X-NOW TO X-PHRASE-LIST;
        AT X3 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE PHRASE-ATT WITH VALUE X-PHRASE-LIST.
WPHRASE-NVAR-POST =
        IN NVAR: IF BOTH VALUE X3 IS N:H-POST
        AND CORE-ATT OF X3 HAS MEMBER H-TTSURG
        [post-checystectomy]
        OR H-INDIC [post_accident]
        OR H-DIAG [postmeasles]
        THEN DO $TIME-POST.
   $TIME-POST = X-PHRASE-LIST := NIL;
        X-NOW := SYMBOL TIME-POST-PHRASE;
        PREFIX X-NOW TO X-PHRASE-LIST;
        AT X3 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE PHRASE-ATT WITH VALUE X-PHRASE-LIST.
WPHRASE-NTIME =
        IN NTIME: PRESENT-ELEMENT- X3 EXISTS;
        X-PHRASE-LIST := NIL;
        X-NOW := SYMBOL TIME-PHRASE;
        PREFIX X-NOW TO X-PHRASE-LIST;
        AT X3 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE PHRASE-ATT WITH VALUE X-PHRASE-LIST.
WPHRASE-NSTGT =
        IN NSTGT: PRESENT-ELEMENT- X3 EXISTS;
        X-PHRASE-LIST := NIL;
        X-NOW := SYMBOL TIME-PHRASE;
        PREFIX X-NOW TO X-PHRASE-LIST;
        AT X3 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE PHRASE-ATT WITH VALUE X-PHRASE-LIST.
WPHRASE-NQ =
        IN NQ: ONE OF $AGE, $TIME, $INST, $QUANT.
   $AGE = ELEMENT- N X1 OF PRESENT-ELEMENT- X3 IS 'AGE';
        X-PHRASE-LIST := NIL;
        X-NOW := SYMBOL AGE-PHRASE;
        PREFIX X-NOW TO X-PHRASE-LIST;
        AT X3 DO $ASSIGN;
        IF EITHER $PQUANT OR $PN
        THEN DO $RE-ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE PHRASE-ATT WITH VALUE X-PHRASE-LIST.
   $PQUANT = ASCEND TO PQUANT;
        STORE IN X4;
        P IS 'AT' OR 'SINCE' OR 'FROM' OR 'UNTIL' [asthma since age 9].
   $PN = ASCEND TO PN;
        STORE IN X4;
        P IS 'AT' OR 'SINCE' [since/at age 9; in SA].
   $RE-ASSIGN =
        X-PHRASE-LIST := NIL;
        X-NOW := SYMBOL TIME-PHRASE;
        PREFIX X-NOW TO X-PHRASE-LIST;
        AT X4 DO $ASSIGN.
   $TIME = AT ELEMENT- N X1 OF PRESENT-ELEMENT- X3
        X1 IS H-TMLOC OR NTIME1 ['day' in 'day 3'];
        X-PHRASE-LIST := NIL;
        X-NOW := SYMBOL TIME-PHRASE;
        PREFIX X-NOW TO X-PHRASE-LIST;
        AT X3 DO $ASSIGN;
        IF BOTH ASCEND TO PN@
        AND STORE IN X4 ['on post-op day 3']
        THEN AT X4 DO $ASSIGN.
   $INST = AT ELEMENT- N X1 OF PRESENT-ELEMENT- X3
        X1 IS H-INST ['room' in 'room 3', 'ward' in 'ward 10'];
        X-PHRASE-LIST := NIL;
        X-NOW := SYMBOL INST-PHRASE;
        PREFIX X-NOW TO X-PHRASE-LIST;
        AT X3 DO $ASSIGN;
        IF BOTH ASCEND TO PN@
        AND STORE IN X4 ['on ward 10']
        THEN AT X4 DO $ASSIGN.
   $QUANT = X-PHRASE-LIST := NIL;
        X-NOW := SYMBOL QUANT-PHRASE;
        PREFIX X-NOW TO X-PHRASE-LIST;
        AT X3 DO $ASSIGN.
WPHRASE-PDATE =
        IN PDATE: PRESENT-ELEMENT- X3 EXISTS;
        X-PHRASE-LIST := NIL;
        X-NOW := SYMBOL TIME-PHRASE;
        PREFIX X-NOW TO X-PHRASE-LIST;
        AT X3 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE PHRASE-ATT WITH VALUE X-PHRASE-LIST.
WPHRASE-PDOSE =
        IN PDOSE: PRESENT-ELEMENT- X3 EXISTS;
        X-PHRASE-LIST := NIL;
        X-NOW := SYMBOL DOSE-PHRASE;
        PREFIX X-NOW TO X-PHRASE-LIST;
        AT X3 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE PHRASE-ATT WITH VALUE X-PHRASE-LIST.
WPHRASE-PN-DOSE =
        IN PN: PRESENT-ELEMENT- X3 EXISTS;
        IF CORE- OF ELEMENT- NSTGO IS DS
        THEN DO $DOSE-PN.
   $DOSE-PN =
        X-PHRASE-LIST := NIL;
        X-NOW := SYMBOL DOSE-PHRASE;
        PREFIX X-NOW TO X-PHRASE-LIST;
        AT X3 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE PHRASE-ATT WITH VALUE X-PHRASE-LIST.
WPHRASE-PN-ETIME =
        [* WPHRASE-PN-TIME renamed WPHRASE-PN-ETIME so execution is earlier]
        [* since execution is in alphabetic order.]
        IN PN:
        PRESENT-ELEMENT- X3 EXISTS;
        IF BOTH P X1 IS NOT 'WITHOUT' OR 'WITH'
        OR 'WITHOUT'_'EVIDENCE'_'OF'
        [OR 'FOR' yes 'observe her for a while longer']
        AND EITHER X1 IS H-TMPREP
        OR EITHER CORE-ATT OF CORE- OF ELEMENT- NSTGO HAS MEMBER
        H-TMLOC OR NTIME1 OR H-TMDUR OR H-TMREP OR H-TMBEG
        OR H-TMEND OR H-AGE [during adolescence, as a child]
        OR BOTH X1 IS 'ON' OR 'UPON' OR 'AT' OR 'AFTER' OR
        'FOLLOWING'
        AND CORE- OF ELEMENT- NSTGO IS H-TTGEN OR H-TTSURG
        [upon arrival, on admission, at the last visit]
        [following this intervention]
        OR NTIME1 [on the 34th day]
        OR H-PTVERB [on presentation to this institution]
        THEN DO $TIME-PN
        [* Attrb assigned in WPHRASE-QN if CORE is QN with ]
        [* PHRASE-ATT=TIME-PHRASE ]
        ELSE BOTH IF BOTH P IS 'OF' [second day of hospital admission]
        AND CORE- OF ELEMENT- NSTGO IS 'ADMISSION' OR
        'HOSPITALIZATION' OR 'TRANSFER' OR
        'STUDY' [discharged on the afternoon of the study]
        THEN IF HOST- IS NTIME1 [day, afternoon]
        THEN DO $TIME-PN
        AND IF EITHER BOTH P IS 'ON'
        AND CORE- OF ELEMENT- NSTGO IS NTH [on the 17th]
        OR BOTH P IS 'FOLLOWING'
        AND CORE- OF ELEMENT- NSTGO IS 'THIS' [following this]
        THEN DO $TIME-PN.
   $TIME-PN =
        X-PHRASE-LIST := NIL;
        X-NOW := SYMBOL TIME-PHRASE;
        PREFIX X-NOW TO X-PHRASE-LIST;
        AT X3 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE PHRASE-ATT WITH VALUE X-PHRASE-LIST.
WPHRASE-PN-GRAFT =
        [* Important to mark phrases describing grafts so they become HIUs. ]
        [* If unmarked they will be seen simply as PTPART phrases and will ]
        [* string out in the PTPART field of the preceding HIU. For example,]
        [* 'Status post CABG x 3 11/00/1990 with LIMA to LAD , SVG to RCA , ]
        [* SVG to OM1'. See WCONJ21 for constraints on conjoining. ]
        IN PN: PRESENT-ELEMENT- X3 EXISTS;
        IF BOTH ELEMENT- P IS 'WITH' [with LIMA to LAD]
        AND CORE- X1 OF ELEMENT- NSTGO IS H-CARD-GRAFT [LIMA]
        THEN IF RIGHT-ADJUNCT OF X1 IS PN [to LAD]
        WHERE BOTH ELEMENT- P IS 'TO'
        AND CORE- X1 OF ELEMENT- NSTGO IS H-CARD-ARTERY [LAD]
        THEN DO $GRAFT-PN.
   $GRAFT-PN =
        X-PHRASE-LIST := NIL;
        X-NOW := SYMBOL GRAFT-PHRASE;
        PREFIX X-NOW TO X-PHRASE-LIST;
        AT X3 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE PHRASE-ATT WITH VALUE X-PHRASE-LIST.
WPHRASE-PN-INFLUENCE =
        IN PN: PRESENT-ELEMENT- X3 EXISTS;
        IF BOTH ELEMENT- P X-P IS H-RESP [made_worse_by = P; relieved_by = P]
        AND EITHER CORE-ATT X2 OF CORE- X1 OF ELEMENT- NSTGO HAS MEMBER
        H-DIET [precipitated by food]
        OR H-CHEM [precipitated by alcohol]
        OR H-PTFUNC [made worse by exercise]
        OR H-INDIC [made worse by stress, made worse by fatigue]
        OR H-TTMED [relieved by medication]
        OR H-TTCOMP [relieved by a bath]
        OR H-DESCR [made worse by noise]
        OR H-PTPART [made worse by head position]
        OR BOTH X1 HAS ATTRIBUTE H-PTPART
        AND RIGHT-ADJUNCT OF X1 IS VENPASS
        WHERE CORE- OF ELEMENT- LVENR IS H-PTFUNC
        [relieved by head tilted to the left]
        THEN DO $INFLUENCE-PN
        ELSE IF BOTH X-P IS 'ON' OR 'UPON' OR 'AFTER' OR 'WITH' OR 'AT'
        [after/on exercise]
        [difficulty oxygenating with minimal exercise]
        [difficulty breathing after eating]
        [pain at rest]
        [worse on swallowing]
        AND EITHER CORE- X1 OF ELEMENT- NSTGO IS 'EXERCISE'
        [Note use of CORE- here enables INFLUENCE-PHRASE = ]
        ['with minimal exercise' because CORE- accesses ]
        [H-PTFUNC inside the COMPUTED-ATT 'minimal exercise']
        OR CORE-ATT OF X1 HAS MEMBER H-PTFUNC
        [But 'heart rate' is also H-PTFUNC in a COMPUTED-ATT]
        [in 'with 61 % maximal heart rate'. Here we do not ]
        [want to form an INFLUENCE-PHRASE, so we use CORE-ATT ]
        [to ensure that the value of the COMPUTED-ATT is seen.]
        THEN DO $INFLUENCE-PN.
   $INFLUENCE-PN =
        X-PHRASE-LIST := NIL;
        X-NOW := SYMBOL INFLUENCE-PHRASE;
        PREFIX X-NOW TO X-PHRASE-LIST;
        AT X3 DO $ASSIGN.
   $ASSIGN = ASSIGN NODE ATTRIBUTE PHRASE-ATT WITH VALUE X-PHRASE-LIST.
        WPHRASE-PN-RADIATE =
        IN PN: PRESENT-ELEMENT- X3 EXISTS;
        IF BOTH X3 IS OCCURRING IN RN WHERE CORE-ATT OF HOST
        HAS MEMBER H-INDIC [e.g. pain, pr