text
stringlengths
22
301k
# Match if the element is in a match list. Match is used only with _xWILD, and succeeds only if one of the list names matches a node @RULES _james <- _xWILD [match=(jim jimmy james) singlet min=1 max=1] @@
@NODES _ROOT @RULES _columnHeaders <- Class ### (1) _xWILD [plus fails=(\n \r)] _xWILD [one matches=(\n \r)] @@
@DECL ############################################### # General functions ############################################### AddUniqueCon(L("concept"),L("name")) { L("con") = findconcept(L("concept"),L("name")); if (!L("con")) L("con") = makeconcept(L("concept"),L("name")); return L("con"); } AddUniqueStr(L("concep...
@PATH _ROOT _LINE _example @RULES _ignore <- father ### (1) or ### (2) mother ### (3) @@
@PATH _ROOT _LINE _example @POST X("female",2) = 1; @RULES _xNIL <- _xWILD [one matches=(woman girl female mother sister aunt)] ### (1) @@
@NODES _ROOT @RULES _xNIL <- _xNIL ### (1) @@
@MULTI _section _sentence @POST singler(2,2); @@POST @RULES _endSent <- _xWILD [one match=(_xALPHA _xNUM _patientID _xWHITE) except=(\n \r)] ### (1) _xWILD [one trig match=(\. \?)] ### (2) _xWILD [one match=(_xWHITE _xEND _xCTRL)] ### (3) @@
@DECL addCategory(L("category"),L("categoryid")) { L("con") = findconcept(G("categories"),L("category")); if (!L("con")) { L("con") = makeconcept(G("categories"),L("category")); addnumval(L("con"),"count",1); } else { L("count") = getnumval(findvals(L("con"), "count")); "dupes.txt" << L("categoryid") << "-...
@PATH _ROOT _FOOTER _bibBlock _bibBody _bibItem @POST S("text") = N("$text",3); S("type") = "text"; singler(3,3); @RULES _text <- _xWILD [matches=(_section _figure _ref _cite)] ### (1) _NEWLINE [s] ### (2) _xWILD [s plus fails=(_text _abstract _ref _cite _BLANKLINE _stopper _HEADER _FOOTER)...
@CODE G("dictfile") = G("$kbpath") + "states.dictt"; G("abbrevdict") = G("$kbpath") + "abbrev.dictt"; G("kbbfile") = G("$kbpath") + "states.kbbb"; G("citiesdict") = G("$kbpath") + "cities.dictt"; G("debugfile") = G("$kbpath") + "debug.txt"; G("debug") = openfile(G("debugfile"),"app"); G("state name") = strsubst(G("...
# Find "per capita" and reduce to _adj, searching descendents @RULES _adj <- per [s] capita @@
@CODE L("hello") = 0; @@CODE @NODES _TEXTZONE # New tokenization handlers. @CHECK if (!N("dissolve")) fail(); @POST splice(1,1); @RULES _xNIL <- _tok @@ ########## IDIOMS @POST S("sem detail") = "usa"; S("sem") = "country"; S("ne") = 1; S("ne type") = "location"; S("ne type conf") = 95; S("countr...
@CODE prlit("output.txt","\n") prlit("output.txt","EDUCATION:\n\n") @@CODE #@MULTI _educationZone # @MULTI _educationInstance # 11/16/99 AM. @POST prlit("output.txt","School Name: ") prtree("output.txt",1,"_CompleteSchoolName") prlit("output.txt","\n") @RULES _xNIL <- _CompleteSchoolName @@ @POST prli...
@CODE DisplayKB(G("headers"),0); @@CODE
# Remove value named str2 from attribute named str1 under concept con. Also removes the attribute. rmattrval(L("con"), L("str1"), L("str2"));
# NOTE: String and comment collection must be done together. # # NOTE: Strings must be collected in a pass following collection of \". # @POST excise(1, 3) @RULES _xNIL <- \# _xWILD \n @@ @POST excise(1, 2) @RULES _xNIL <- \# _xWILD _xEOF @@ @POST rfastr(2) single() @RULES _STR [base] <- \" _xWILD _xWILD [on...
@PATH _ROOT _LINE _conjugation @POST X("up",3) = 1; excise(1,1); noop(); @RULES _xNIL <- _xWHITE [s] ### (1) @@
@PATH _ROOT _contactZone _LINE # If human names, track highest confidence. @CHECK if (!X("name found",2) && !N("name found") && G("humannames") > 1) succeed(); fail(); @POST if (!N("humanname conf")) { # Must have come from Gram hierarchy or other strong source. # Assign an initial confidence. N("humanna...
@NODES _ROOT @POST S("section_title") = N("$text", 1); # excise(4,4); excise(1,2); single(); @RULES _section <- _xWILD [min=1 max=10 fails=(\: \n \r _break)] ### (1) \: [trig] ### (2) _xWILD [fails=(_break _xEND)] ### (3) # _xWILD [one matches=(_break _xEND)] ### (4) @@ # @POST # excise(1,1); # @...
@PATH _ROOT _posZone _defZone _definition _headerZone _LINE @POST L("con") = MakeCountCon(X("con",3),"variation"); addstrval(L("con"),"text",N("$text",2)); singler(2,2); @RULES _xNIL <- _item ### (1) @@
@PATH _ROOT _DECL _NLPPP @POST rfbdecls(1) single() @RULES _DECL [base] <- _FUNCDEF [plus] @@ # Ignore ok things within a mangled function body. @RULES _ERROR <- _FNCALL \{ _STMTS [star] @@ _ERROR <- _STMTS [plus] @@ # Will find only first error in a function. # Better than nothing. @POST rfberror(1) sin...
@CODE # If not outputting tags, exit. if (!G("verbose")) # Todo: another flag here. exitpass(); if (!G("pretagged")) exitpass(); # Initialize traversal data. G("parseRoot") = pnroot(); G("node") = G("parseRoot"); G("depth") = 0; G("path") = 0; # Store the current path in the pa...
@PATH _ROOT _nepali _headerZone @POST G("word") = makeconcept(G("words"),N("$text",2)); @RULES _xNIL <- _LINE ### (1) _LINE ### (2) @@
@CODE L("hello") = 0; @@CODE @NODES _sent @CHECK if (!N("needs-np",1)) fail(); @POST L("tmp") = N(2); group(2,2,"_noun"); pncopyvars(L("tmp"),N(2)); @RULES _xNIL <- _det _xALPHA _prep [lookahead] @@ # vg det alpha alpha . @CHECK if (!N("noun",4) && !N("adv",4)) fail(); @POST L("tmp4") = N(4)...
@NODES _ROOT _IGNORE @POST S("type") = "figure"; single(); @RULES _figure <- _beginFigure ### (1) _xWILD ### (2) _endFigure ### (3) @@
@PATH _ROOT _contactZone _LINE # If name has been selected, use it. Else... # If a single high confidence name was found in contact zone(s) # of the resume, use it without further reasoning. @CHECK if (X("name found",2)) fail(); if (G("humannames") == 1 || N("name found") || N("ctcname conf") == X("hi ctcn...
@CODE G("nodesToTraverse") = G("root"); G("count") = 0; G("count2") = 0; @@CODE @NODES _ROOT @POST "test.txt" << "count: " << G("count") << " passnum: " << G("$passnum") << " rulenum: " << G("$rulenum") << "\n"; G("count") = G("count") + 1; L("parentNode") = G("nodesToTraverse")[0]; if (N("$text", 3) == conceptna...
@NODES _ROOT @POST excise(1,3); noop(); @RULES _xNIL <- RID ### (1) _xNUM ### (2) \n [opt] ### (3) @@
@PATH _ROOT _story ### Including generic business words in the "stop list". # ### And other general words. ### In this way, they don't count against the current industry. @POST ++G("total alphas"); @RULES _xNIL <- _xWILD [s one match=( finger fingers order orders ordering ordered wait waits waiting waited compl...
@PATH _ROOT _headerZone _liGroup @POST "hiGroup.txt" << N("$text",2) << "\n"; single(); @RULES _hiGroup <- _iOpen ### (1) _xWILD [match=(_iGroup)] ### (2) _iClose ### (3) @@
# Remove concept con from Knowledge Base. Removes entire subhierarchy. rmconcept(L("con"));
@NODES _LINE @PRE <3,3> cap(); <5,5> length(1); <7,7> cap(); <9,9> cap(); @POST group(3, 7, "_streetName"); single(); @RULES _addressLine <- _xNUM [s layer=("_streetNumber")] _xWHITE [star s] _xALPHA [s] \' [s] s [trig s] _xWHITE [star s] _xALPHA [s] _xWHITE [star s] _PostalRoad [s layer=("_road")] @@ @PRE <3,3> c...
@PATH _ROOT _textZone _LINE _conjugation @POST X("up",3) = 1; excise(1,1); noop(); @RULES _xNIL <- _xWHITE [s] ### (1) @@
# Tracking in the line and globally. # Should count tabs also. @PATH _ROOT _LINE @POST # S("bullet") = X("bullet") = "*"; # Commented out. # if (X("nindent") == 3) ++X("Netscape * bullet"); # Track max and min bullet indent. if (!G("* bullets")) # No * bullets seen yet. G("* bullet max") = G("* bullet min")...
# note: The funny looking stuff here matches all the zones but # only reduces the FIRST zone found to a contactZone. Just a trick # for singling out the first item in a list. # (may be working just because a single REZZONE is found in the list ;-) # @NODES _ROOT @PATH _ROOT @POST singler(2,2); @RULES # note: I ...
@NODES _ROOT @POST excise(1,1) @RULES _xNIL <- _BLANKLINE [s] ### (1) @@
@CODE L("hello") = 0; if (G("studyout")) closefile(G("studyout")); @@CODE @NODES _sent @CHECK # Agreement... L("arr") = vgagree(N(1),N(3),N(5),N(7),N(9)); if (!L("arr")[0]) fail(); @POST L("m") = N(1); L("h") = N(3); L("b") = N(5); L("being") = N(7); L("v") = N(9); L("neg") = mhbvadv(2,4,6,8); if...
@PATH _ROOT _RULES @POST rfarules(1) single() @RULES _RULES [base] <- _RULE [plus trig] @@
@NODES _ROOT @RULES _patientID <- \[ ### (1) \* ### (2) \* ### (3) _xWILD [fails=(\*)] ### (4) \* ### (5) \* ### (6) \] ### (7) @@ @RULES _time <- _xNUM \: _xNUM \: [opt] _xNUM [opt] \_ [opt] _xWILD [opt match=(am pm AM PM)] @@ @POST excise(6,6); excise(4,4); excise(2,2); ...
@PATH _ROOT _RULES @RECURSE listarg @POST rfaarg(1) single() @RULES _ARG [base] <- _NONLIT @@ _ARG [base] <- _LIT @@ _ARG [base] <- _STR @@ _ARG [base] <- _NUM @@ @@RECURSE listarg @POST rfalist(2) single() @RULES _LIST [base] <- \( _xWILD [match=(_LIT _NONLIT _STR _NUM) recurse=(listarg)] \) @@
@MULTI _ROOT _section @POST excise(1,1); @RULES _xNIL <- _break @@
@CODE L("node") = pndown(pnroot()); L("filename") = G("$apppath") + "\\input\\X\\" + G("$inputhead") + "." + G("$inputtail"); L("file") = openfile(L("filename")); # L("debugname") = G("$inputpath") + "debug.txt"; # L("debug") = openfile(L("debugname"),"app"); # L("debug") << L("filename") << "\n"; # closefile(L("de...
@DECL ############# # PRINTRULE ############# printrule(L("clause")) { if (!L("clause")) return; L("n") = pndown(L("clause")); if (!L("n")) return; # Assume we have a good clause. G("rout") << "\n_clause <-"; # Traverse. L("a flag") = 0; # Flag if working on adverbial. while (L("n")) { L("a flag") = printrul...
@NODES _ROOT @POST if (N("$text",2)) S("text") = strsubst(N("$text",2),"'"," \\\' "); single(); @RULES _string <- \" ### (1) _xWILD [fail=(\")] ### (2) \" ### (3) @@
@NODES _LINE @POST X("country",2) = strtolower(strtrim(N("$text",1))); @RULES _xNIL <- _xWILD [fail=(_codes)] _codes ### (1) @@
@PATH _ROOT _LINE _Caps _Caps # Job title root word (eg, "programmer") at the end of phrase # gets a bonus. @POST ++X("jobtitleroots"); # Bump in _Caps context node. if (N("$end")) # If last node in caps phrase. ++X("end jobtitleroot"); # Bonus. Last word in cap phrase. # noop() # Implicit. @RULES _xNIL...
@NODES _ROOT @RULES _DeclSep <- _PEReference [one] ### (1) @@ _DeclSep <- _whiteSpace [one] ### (1) @@ @@RULES
@NODES _LINE @RULES # College and Univertity, Institute & Seminary _SchoolRoot [] <- _SchoolRoot _xWHITE _xWILD [s one match = (and And \&)] _xWHITE _SchoolRoot @@ # A&M _SchoolName [] <- A [s] \& M [s] @@ # A&T _SchoolName [] <- A [s] \& [s] T [s]@@ # Agricultural and {Mechanical | Technical) _SchoolName [] <- A...
# Fetch concept-value of attribute (must be first). L("return_con") = conval(L("con"), L("name"));
@DECL DisplayCode(L("code")) { L("codename") = conceptname(L("code")); L("con") = FindCodeHier(L("codename"),G("icd11")); if (L("con")) { L("count") = 0; while (up(L("con")) && conceptname(L("con")) != "ICD11") { L("path")[L("i")++] = L("con"); L("count")++; ...
@PATH _ROOT _textZone _LINE @POST S("header") = N("$text",2); X("header") = N("$text",2); X("up") = 1; X("level") = strlength(N("$text",1)); "header.txt" << N("$text",2) << "\n"; single(); @RULES _header <- _xWILD [min=2 match=(\=)] ### (1) _xWILD [plus fail=(\=)] ### (2) _xWILD [min=2 match=(\=)] ### (3) @@
# Remove the two _adjs nodes from the parse tree, merging their children under a new _adjs node @POST merger(1,2); @RULES _adjs <- _adjs _adjs _xyz @@
@CODE G("trend file") << "TRENDS: RAW ALPHABETIC FREQUENCY" << "\n"; G("trend file") << "================================" << "\n"; # TRAVERSE DICTIONARY HIERARCHY. (Has 2 levels of dictionary indices.) G("dict level 1") = down(G("dict alpha")); # Get level 1. while (G("dict level 1")) # Traverse level 1....
@NODES _LINE # Some phrases. # #@PRE #<1,1> cap() #<3,3> cap() @CHECK if (X("nblobs") >= 5) fail(); # Xlt("nblobs", 5) @RULES # Should have a confidence bonus if the header covers the entire line. #_contactHeader <- Personal [s] _xWHITE [s star] Information [s] @@ _contactHeader <- _xWILD [s one match=(_Co...
@PATH _ROOT _headerZone _liGroup _hiGroup @POST X("text") = X("text") + N("text"); "hitext.txt" << X("text") << "\n"; @RULES _xNIL <- _iGroup @@
@NODES _ROOT @RULES _Comment <- _CommentStart [one] ### (1) _xWILD [min=0 max=0 fail=("_CommentEnd" "_CommentEnd" "_DoubleHyphen")] ### (2) _CommentEnd [one] ### (3) @@ @POST S("textValue") = N("$text",2) ; single() ; @@POST @RULES _PubidLiteral <- \" [one] ### (1) _xWILD [min=0 max=0 matc...
# Add num as numeric value to concept con's attribute called name. addnumval(L("con"), L("name"), L("num"));
@PATH _ROOT _POSTS _NLPPP @POST rfaactions(1) single() @RULES #_POSTS [base] <- _ACTION [star] @@ _POSTS [base] <- _STMTS [plus] @@
@DECL LookUpPhrases(L("node")) { L("this") = 1; } @@DECL
@NODES _LINE @PRE <1,1> cap() @RULES _major <- _xALPHA [s min=1 max=1 matches=( EE CS EECS ACCOUNTANCY ACCOUNTING ACOUSTICS ADVERTISING AERONAUTICS AESTHETICS AFRICOLOGY AGRIBUSINESS AGRONOMY ANATOMY ANTHROPOLOGY ARCHAEOLOGY ARCHITECTURE ART ASTRONAUTICS ASTRONOMY ASTROPHYSICS AUDIOLOGY AVIATION BANKING BIOCHEMIST...
@PATH _ROOT _TEXTZONE _sent _clause @POST L("child") = pndown(N(1)); if (pnname(L("child")) == "_np") { "bodyAttr.txt" << "\nCOMPOUND\n"; } "bodyAttr.txt" << N("$text", 1) << "\n" << N("$text", 2) << "\n" << N("$text", 3) << "\n---------------\n"; single(); @RULES _xNIL <- _np ### (1) _vg _adjc @@
@PATH _ROOT _paragraph _sentence @POST S("conj count") = 0; S("conj")[S("conj count")++] = N("normal",1); S("conj")[S("conj count")++] = N("normal",3); S("conj")[S("conj count")++] = N("normal",5); single(); @RULES _company <- _company [s] ### (1) _conj [s plus] ### (2) _company [s] ### (3) _c...
@NODES _ROOT @RULES _columnHeaders <- Class ### (1) _xWILD [plus fails=(\n \r)] ### (2) _xWILD [one matches=(\n \r)] ### (3) @@