text
stringlengths
22
301k
@NODES _ROOT @POST L("text") = N("$text", 1); "test.txt" << L("text") << "\n"; if (L("text") == "PROCEDURES" || L("text") == "DISEASES AND INJURIES") { L("range") = split(N("code", 1), "-"); L("class_start") = L("range")[0]; L("class_end") = L("range")[1]; L("class_end") = split(L("class_end"), "."); L("class_en...
@NODES _ROOT @CHECK "brackets.txt" << N("$text",2) << ": " << N("curly level",3) << " <=> " << N("curly level",5) << "\n"; if (N("curly level",3) != N("curly level",5)) fail(); @POST group(5,5,"_bold"); singler(1,3); @RULES _bold <- \\ [s] ### (1) _xWILD [matches=(textbf emph)] ### (2) \{ [s] ...
@PATH _ROOT _LINE # Need some confidence that the caps is a good one. # (Could put a weak variant in edu zone, stronger one here.) @CHECK if (!N("fields",3)) fail(); # Has field-of-endeavor words. @POST S("degree") = N("$text",1); S("major") = N("$text",3); single(); # Default reduction. @RULES _degreeInMajo...
@PATH _ROOT _LINE # Glomming good school stuff. @CHECK if ( (N("hi class", 1) == "school") # Highest class is a school && (N("hi conf", 1) >= 80) # with >= 80% confidence. ) succeed(); fail(); @POST S("hi class") = "school"; S("hi conf") = N("hi conf",1); S("school conf") = N("school conf",1); ...
@NODES _ROOT @POST SaveName(N("$text",5)); single(); @RULES _word <- a ### (1) name ### (2) \= ### (3) \" ### (4) _xALPHA ### (5) \" ### (6) @@ @POST SaveName(N("$text",5)); single(); @RULES _word <- 9393 ### (1) ff ### (2) \" ### (3) \> ### (4) _xALPHA ### (5) \< ### (6) @@
@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...
@NODES _ROOT @POST excise(1,3) @RULES _xNIL <- _xNUM , _xWILD [opt matches=(\")] @@
#@CODE # A global threshold for confidence in a category. #var("threshold", 70) # Minimum is 70% #@@CODE @PATH _ROOT _LINE @POST # if (!N("len")) # print out no length. # Treating confidences independently, but keep track of # ambiguity in the phrase. N("hi conf") = 0; # Track highest conf so far. N("hi class")...
@DECL # Concatenate # Concatenates two non-empty arrays # # Args: Two non-empty arrayd # Returns: concatenated array Concatenate(L("arr_1"), L("arr_2")) { L("new_arr") = L("arr_1"); L("idx") = 0; while (L("idx") < arraylength(L("arr_2"))) { L("new_arr")[arraylength(L("new_arr"))] = L("arr_2")[L(...
# Fetch the next attribute in a list of attributes L("return_attr") = nextattr(L("attr"));
@NODES _LINE @PRE <1,1> cap(); @RULES # Ex: Professional _headerMod <- _xWILD [min=1 max=1 s match=("Professional" "Additional" "Detail")] @@
@NODES _ROOT @POST L("capital") = getconcept(G("state"),"capital"); addstrval(L("capital"),"city",N("text",1)); single(); @RULES _xNIL <- _capital @@
@PATH _ROOT _experienceZone _experienceInstance _LINE # name regardless of position, etc. Should raise confidence here. # May want to collect confidence in the instance. @CHECK if ( !X("company name",3) && (N("tmp") = (X("lineno") - X("anchor lineno",3))) && (N("tmp") == -2 || N("tmp") == 2) # Within 2 lines of...
@CODE SaveKB("format.kbb",G("format"),2); @@CODE
@PATH _ROOT _contactZone # 10/19/99 AM. #@NODES _contactZone # @CHECK if (N("wcap",3) < 2) fail(); if (N("wcap",3) > 4) fail(); if (N("nblobs",3) > 4) fail(); if (N("humanNameCandidate",3)) fail(); if (N("addressParts",3)) fail(); #Nge(3, "wcap", 2) # >= 2 cap words on line #Nle(3, "wcap", 4) # <= 4 cap words...
@PATH _ROOT _experienceZone _experienceInstance _LINE @CHECK if ( !X("job title",3) && (N("job conf tot",1) == X("job conf hi",3) && N("job conf tot",1) >= G("threshold") ) ) succeed(); fail(); @POST X("job title",3) = N("$text",1); @RULES _xNIL <- _Caps [rename=(_jobTitle)] @@ @CHECK if ( !X("co...
@PATH _ROOT _labels @POST S("RID") = makeconcept(G("RadLex"), N("$text", 5)); single(); @RULES _labelEntry <- http ### (1) _xWILD [plus fails=(\#)] ### (2) \# ### (3) RID ### (4) _xNUM ### (5) _xWILD [plus fails=(\n \r)] ### (6) _xWILD [one matches=(\n \r)] ### (7) @@
@NODES _LINE @POST X("words") = X("words") + 1; if (strlength(N("$text")) > 1) { if (striscaps(N("$text")) && strlength(N("$text")) > 1) { X("caps") = X("caps") + 1; } else if (strisupper(N("$text")) && strlength(N("$text")) > 1) { X("upper") = X("upper") + 1; } } @RULES _xNIL <- _xALPHA ### (1) ...
@PATH _ROOT _paragraph _sentence @POST S("compare") = ">"; "tester.txt" << "testing!\n"; single(); @RULES _compare <- more [s] ### (1) than [s] ### (2) @@ @RULES _pro <- _xWILD [s one matches=(it he she its all they them those)] ### (1) @@ _prep <- _xWILD [s one matches=(as at in of wi...
## CODE REGION #@CODE #prlit("output.txt", "Assigned Phones=") #fprintvar("output.txt", "Assigned Phones") #prlit("output.txt", "\n") #prlit("output.txt", "Total Phones=") #fprintvar("output.txt", "Total Phones") #prlit("output.txt", "\n") #prlit("output.txt", "\n") #prlit("output.txt", "Total Names=") #fpri...
@NODES _ROOT @RULES _state <- California @@ _prep <- _xWILD [one matches=(as at in of with into)] @@ _det <- _xWILD [one matches=(a an the this that)] @@ _adj <- _xWILD [one matches=(blue red green happy funny)] @@ _noun <- _xWILD [one matches=(moose frog lizard)] @@ _month <- _xWILD [one matches=(january february ma...
@PATH _ROOT _LINE @POST excise(1,1); noop(); @RULES _xNIL <- _xWHITE [s] ### (1) @@
# Fetch a substring of the input text, as specified by start and end offsets, and print it to an output stream G("out") = openfile("c:\\tmp.txt"); inputrangetofile(0,9,G("out"));   # Print the first 10 characters of the input text. closefile(G("out"));
@NODES _ROOT @POST excise(1,3); noop(); @RULES _xNIL <- \( ### (1) _xWILD [fails=( \) \n \r)] ### (2) \) ### (3) @@
@NODES _ROOT @POST S("ref") = N("$text",4); "bib.txt" << "Bib ref: " << S("ref") << "\n"; single(); @RULES _bibRef <- \\ [s] ### (1) bibitem [s] ### (2) \{ [s] ### (3) _xWILD [s fails=(\})] ### (4) \} [s] ### (5) @@
# Rebind the output stream cout to a given file @CODE # In VisualText, output to a file.  Outside VisualText, output to user-supplied stream. if (interactive())    coutreset("out.txt"); cout() << "Hello output stream!" << "\n"; @@CODE
# The action lowercase specifies that the first rule element (_xALPHA) must be a word in all lowercase letters in order to be reduced to the suggested node _noun @PRE <1,1>lowercase(); @RULES _noun <- _xALPHA@@
@NODES _ROOT @POST G("count") = G("count") + 1; single(); @RULES _item <- \< ### (1) \/ ### (2) item ### (3) \> ### (4) @@
@NODES _ROOT @RULES _wordClass <- hword @@ _pos <- parts \- of \- speech @@ _sense <- sense \- content @@ _h <- \< ### (1) \/ ### (2) h ### (3) _xWILD [one match=(1 2)] ### (4) \> ### (5) @@
# Create an attribute named 'myAttr' under 'aConcept' and give it the value 'myVal' Then remove the value from 'myAttr' if(findconcept(findroot(),"myConcept")) rmconcept(findconcept(findroot(),"myConcept")); G("aConcept") = makeconcept(findroot(), "myConcept"); # remove values of existing attribute. G("result") = rmva...
# See if given string is a suffix of given word @CHECK if (!suffix(N("$text",1),"s")) fail(); @RULES _snoun [layer=(_sverb)] <- _xALPHA @@
@NODES _figure @POST S("image") = N("$text",7); X("image") = N("$text",7); "images.txt" << S("image") << "\n"; single(); @RULES _image <- \\ ### (1) includegraphics ### (2) \[ ### (3) _xWILD ### (4) \] ### (5) \{ ### (6) _xWILD ### (7) \} ### (8) @@ @POST S("im...
@CODE L("hello") = 0; @@CODE #@PATH _ROOT _TEXTZONE _sent _clause @NODES _clause # Zap clause start temporary nodes. @POST # Copy any attrs from the node to the clause. pncopyvars(N(1),X()); splice(1,1); @RULES _xNIL <- _clausestart @@
@NODES _ROOT @PRE <2,2> varz("NL"); @RULES _paragraph <- _xSTART ### (1) _xWILD [plus] ### (2) @@ @PRE <1,1> var("NL"); <2,2> varz("NL"); @RULES _paragraph <- _xWILD [one] ### (1) _xWILD [star] ### (2) @@
@NODES _ROOT @POST G("CurrentElementName") = str(N("ElementName",1)) ; noop() ; @@POST @RULES _xNIL <- _ElementDeclStart ### (1) @@ @@RULES @POST G("CurrentElementName") = 0 ; noop() ; @@POST @RULES _xNIL <- _EndTag ### (1) @@ @@RULES @RULES _Mixed <- _PCDataStart _xWILD [min=1 max=0 fail...
@CODE if (!G("semantic processing")) exitpass(); if (G("verbose")) "dump.txt" << "\n" << "[PASS sentsem: Register sentences in KB.]" << "\n\n"; @@CODE @NODES _TEXTZONE @POST sentregister(N(1)); @RULES _xNIL <- _sent @@
@CODE if (G("pretagged")) exitpass(); if (!G("hilite")) # 10/25/10 AM. exitpass(); # 10/25/10 AM. G("hello") = 0; @@CODE # This isn't catching all the temporals. #@PATH _ROOT _TEXTZONE _sent _clause # Comment. # #@MULTI _ROOT @NODES _clause _advl # 07/13/12 AM. @CHECK if (N("sem") != "date" && !N("sem date...
@PATH _ROOT _textZone _LINE @POST X("tempo",3) = N("$text",2); single(); @RULES _tempo <- _tempo mais \- do \- que _tempo @@ @POST X("root",3) = N("$text",3); X("numero",3) = N("$text",1); single(); @RULES _numero <- _numero de _xALPHA @@ @POST group(3,3,"_pessoa"); group(1,1,"_pessoa"); @RULES _xNIL <- _pessoa e _...
@CODE SaveKB("all.kbb",findroot(),2); @@CODE
@PATH _ROOT _LINE _item _indent @POST X("indent",3)++; @RULES _xNIL <- _space ### (1) @@
@NODES _ROOT @PRE <1,1> var("header"); <2,2> varz("header"); @POST S("header") = N("header",1); single(); @RULES _headerZone <- _LINE ### (1) _xWILD [plus] ### (2) @@
@NODES _ROOT @POST getconcept(G("words"),N("$text",4)); @RULES _xNIL <- _wordClass ### (1) \" ### (2) \> ### (3) _xALPHA ### (4) \< ### (5) @@
@NODES _LINE @PRE <1,1> length(4); <3,3> length(3); @POST group(1, 3, "_HomeFax"); single(); @RULES # Ex: home/fax:\_( _phoneHomeFaxPhrase <- _xWILD [min=1 max=1 s match=("home" "Home")] _xWILD [min=1 max=1 s match=("\/")] _xWILD [min=1 max=1 s match=("fax" "Fax")] \: [s] _xWHITE [star s] _phoneNumber [s] @@ # Ex:...
###################################################################### # FILE: TEXT_TAGGING.pat # # SUBJ: Handle any HTML tagging inserted in the text file. # # This pass assembles the pieces of an HTML tag into a unit # # AUTH: Paul Deane ...
# Match everything up to _endofpar or _par and reduce matches to _par @RULES _par <- _xWILD [plus fails=(_endofpar _par)] @@
# Create a dump file file_str of knowledge base concept root_con @CODE G("root") = findroot(); G("conc") = makeconcept(G("root"), "companies"); makeconcept(G("conc"), "ford"); makeconcept(G("conc"), "gm"); kbdumptree(G("conc"), "c:\\companies.kb"); @@CODE
@NODES _section @POST S("subsection") = N("subsection", 1); single(); @RULES _subsection <- _subsection [one] _xWILD [plus fails=(_xEND _subsection)] @@
# Fetch the attribute named nameString belonging to the concept concept G("myConcept") = makeconcept(findroot(),"a concept"); G("myAttr") = addattr(G("myConcept"),"an attribute"); "output.txt" << attrname(findattr(G("myConcept"),"an attribute")) << "\n"; G("junk") = findattr(G("myConcept"),"duh"); "output.txt" << "...
@PATH _ROOT _attrBlock _value @POST X("value",2) = PartOfSpeech(N("$text",1)); @RULES _xNIL <- _xALPHA \" _xEND @@
@PATH _ROOT _labels @POST splice(1,3); noop(); @RULES _xNIL <- http ### (1) _xWILD [plus fails=(\#)] ### (2) _xWILD [one matches=(\#)] ### (3) @@
# Exit from a region or rule in a pass file @CHECK fail(); # Reject the current rule match. @@CHECK
@CODE L("hello") = 0; @@CODE @NODES _sent # so # while # "so" hasn't been grabbed up within a clause. # Assume it's a conjunction. #@CHECK # if (N("mypos")) # fail(); #@POST # chpos(N(1),"IN"); #@RULES #_xNIL <- _xWILD [s one match=( # so # while # )] @@ # before # coordinating conjunction. @CHECK if (N("myp...
@NODES _ROOT @RULES _FIELDS <- _xSTART ### (1) _xWILD [plus fails=(_lineTerminator)] ### (2) _lineTerminator ### (3) @@
@PATH _ROOT _educationZone _educationInstance _LINE @POST X("school",3) = N("$text"); # Fill instance with school name. @RULES _xNIL <- _xWILD [s one matches=(_school _schoolPhrase _SchoolName)] @@ @POST X("date",3) = N("$text"); # Fill instance with date. @RULES _xNIL <- _DateRange [s] @@ _xNIL <- _SingleDate...
@CODE sortchilds(G("categories")); L("cat") = down(G("categories")); while (L("cat")) { L("count") = getnumval(findvals(L("cat"), "count")); if (L("count") > 1) { L("vals") = findvals(L("cat"), "catid"); while (L("vals")) { L("num") = getstrval(L("vals")); "output.txt" << L("num") << "-"; L("vals") = ...
# Example shows a way to "layer" semantics in parse tree @POST  G("last") = lasteltnode(4);               # Get last noun node.  G("noun sem") = pnsingletdown(G("last")); # Get semantic node under _noun.  if (G("noun sem")                         # If got a semantic guy, eg "_house",      && (G("name") = pnname(G("nou...
@MULTI _ROOT _section _looseText _sentence _subsection _item @PRE <1,1> var("bases"); @CHECK if (pnname(X()) == "_patientID") { fail(); } @@CHECK # Replace pnvar bases with list of euis by splitting on pipe char. @POST if (strcontains("|", N("bases", 1))) { L("base_list") = split(N("bases", 1), "|"); "filter...
@PATH _ROOT _headerZone _catGroup _liGroup @POST G("file") << G("verb") << " \"" << X("header",2) << "\" " << N("text",3) << "\n"; @RULES _xNIL <- _xSTART ### (1) _liOpen ### (2) _hiGroup ### (3) @@ @POST G("file") << G("verb") << " \"" << X("header",2) << "\" " << N("text",1) << " " << N("text",2) << "\n"; ...
@NODES _ROOT ############################################### # # CONTENT INDEX # # 1. Internet domain names formed with alphanumerics # separated by dots, ending in the common domains # .com, .edu etc. # 2. email address: alphanumeric @ domain name # 3. Time ranges: from # 4. Time abbrevs: a.m., p.m. # 5...
@NODES _section @POST S("subsection") = N("$text", 2); excise(5,5); singler(2,4); @RULES _subsection <- _xWILD [one matches=(_xPUNCT _xSTART _xWHITE)] ### (1) _xWILD [one matches=(_xCAP)] ### (2) _xWHITE [opt] ### (3) _xWILD [min=0 max=3 match=(_xALPHA _xNUM)] ### (4) _xWILD [one matches=(\:)] ...
@NODES _ROOT @CHECK if (N("level",1) == G("max header")) succeed(); fail(); @POST "nesting.txt" << "header: " << N("level",1) << " " << N("header",1) << "\n"; S("level") = N("level",1); S("header") = N("header",1); S("pos") = N("pos",1); single(); @RULES _headerZone <- _header ### (1) _xWILD [fail=(_header...
@NODES _ROOT @RULES _xNIL <- _xNIL ### (1) @@
@PATH _ROOT _headerZone @POST "debug.txt" << "Verbtxt: " << N("value",1) << "\n"; if (strstartswith(N("value",1),"verbtxt")) { N("verbtxt",1) = 1; } @RULES _xNIL <- _iOpen ### (1) @@
# Create the concept of apples, and give them the attribute have with value color. This is sort of like saying 'Apples have color.' Then we give apples the attribute color who's value is red, then the values of color green and yellow G("root") = findroot(); # look for apples in the concept hierarchy G("apple") = find...
################################################ # FILE: Numeric Sequences.pat # # SUBJ: Recognize numeric sequence expressions # # like 5-15, or between 5 and 15 # # AUTH: Paul Deane # # CREATED: 01/Mar/01 # DATE OF THIS VERSION: 31/Aug/01 ...
@NODES _ROOT # Phrases @RULES _xNIL <- _x @@
@NODES _LINE @PRE <1,1> cap(); @RULES # Ex: Micronesia _PostalState <- _xWILD [min=1 max=1 s match=("Micronesia" "AE" "AK" "AL" "Alabama" "Alaska" "AP" "AR" "Arizona" "Arkansas" "AS" "AZ" "CA" "California" "CO" "Colorado" "Columbia" "Connecticut" "CT" "Dakota" "DC" "DE" "Delaware" "FL" "Florida" "FM" "GA" "Georgia"...
@PATH _ROOT _tdOpen @POST X("rowspan",2) = N("$text",4); single(); @RULES _rowspan <- rowspan ### (1) \= ### (2) \" ### (3) _xNUM ### (4) \" ### (5) @@
# Fetch float value of attribute (must be first). L("return_flt") = fltval(L("con"), L("name"));
@PATH _ROOT _experienceZone _experienceInstance @POST splice(1,1); # Zap the _expStart node @RULES _xNIL <- _expStart @@
@NODES _LINE # Merge caps. @POST # Not a "glommed" caps, since first is dominant. S("capofcap") = 1; # Flag what this is. # 12/30/99 AM. # Should transfer from 1st caps (dominant) to new list. S("hi class") = N("hi class",1); S("hi conf") = N("hi conf",1); S("ambigs") = N("ambigs"); # etc. S("huma...
@CODE L("hello") = 0; @@CODE @NODES _ROOT @POST if (!G("title")) G("title") = N("$treetext",2); N("header",2) = 1; # Flag header zone. @RULES _xNIL <- _title _xWILD [plus gp=_TEXTZONE] _Etitle @@ _xNIL <- _ha _xWILD [plus gp=_TEXTZONE] _Eha @@ _xNIL <- _hb _xWILD [plus gp=_TEXTZONE] _Ehb @@ _xNIL...
@DECL DispKB() { DisplayKB(G("person"),1); DisplayKB(G("sentences"),1); } AddPerson(L("sent con"),L("name"),L("gender"),L("pos")) { L("sent") = makeconcept(L("sent con"),L("name")); addstrval(L("sent"),"pos",L("pos")); addstrval(L("sent"),"gender",L("gender")); if (L("pos") == "noun") { L("person") = AddUni...
@MULTI _ROOT _section _sentence _subsection @POST excise(1,1); noop(); @RULES _xNIL <- _xWHITE [s] ### (1) @@
@CODE L("suffix") = down(G("suffix")); while (L("suffix")) { L("suf") = down(L("suffix")); while (L("suf")) { "street-suffix.dict" << conceptname(L("suf")) << " usps=" << strval(L("suffix"),"standard") << "\n"; L("suf") = next(L("suf")); } L("suffix") = next(L("suffix")); } SaveKB("st...
@DECL ItemValue(L("value")) { "value.txt" << L("value") << "\n"; if (L("value") == ",") { return 0; } return L("value"); } NthHeader(L("num")) { L("header") = down(G("headers")); while (L("header")) { if (L("c")++ == L("num")) { return conceptname(L("header")); ...
@PATH _ROOT _paragraph _sentence @POST S("value") = num(N("value",1)) * num(N("numeric",2)); single(); @RULES _money <- _money ### (1) _number ### (2) _currency [opt] ### (3) @@ @RULES _asset <- in [s] ### (1) cash ### (2) @@ @RULES _asset <- in [s] ### (1) assumed ### (2) debt ### (3) @@
# Fetch concept from value. L("return_con") = getconval(L("val"));
# Add an attribute with no value to given concept. L("return_attr") = addattr(L("con"), L("attr_s"));
# CHANGED _SchoolName => _SchoolType # @NODES _LINE @POST S("len") = 2; single(); @RULES _SchoolType [layer=(_Caps)] <- _xWILD [one s match=(High Graduate Postgraduate Music Law Regional)] _xWHITE [s star] School [s t] @@ _SchoolType [layer=(_Caps)] <- _xWILD [one s match=(Christian State ...
@NODES _LINE @PRE <1,1> cap(); @RULES # Ex: Stewart _surName [layer=(_humanNamepart )] <- _xWILD [min=1 max=1 s match=("Stewart" "Johnson" "Williams" "Jones" "Brown" "Davis" "Miller" "Wilson" "Moore" "Taylor" "Anderson" "Thomas" "Jackson" "White" "Harris" "Martin" "Thompson" "Garcia" "Martinez" "Robinson" "Clark" "...
@NODES _ROOT @POST G("curly") = G("curly") + 1; N("curly level") = G("curly"); @RULES _xNIL <- \{ ### (1) @@ @POST N("curly level") = G("curly"); G("curly") = G("curly") - 1; @RULES _xNIL <- \} ### (1) @@
@CODE G("languages") = getconcept(findroot(),"languages"); @@CODE
# Since RFB rules are hashed, don't need sentinel. #@POST # noop() #@RULES #_xNIL <- _xWILD [fail=(\\)] @@ @POST rfaname(2) single() @RULES # For efficiency, some rules are triggered on backslash, while # others will be triggered on elt following backslash. The latter # will always match after the former. _cLF [b...
# Convert any unassigned phone numbers to address parts. @NODES _LINE @RULES _addressPart <- _phoneNumber @@ _addressPart <- _cityStateZip @@ _addressPart <- _addressLine @@ @POST S("city") = N("city"); S("state") = N("state"); single(); @RULES _addressPart <- _cityState @@
@NODES _LINE @PRE <1,1> cap(); @RULES # Ex: Afghanistan _countryPhrase [layer=(_Caps )] <- Afghanistan [s] @@ # Ex: Albania _countryPhrase [layer=(_Caps )] <- Albania [s] @@ # Ex: Algeria _countryPhrase [layer=(_Caps )] <- Algeria [s] @@ @PRE <1,1> cap(); <3,3> cap(); @RULES # Ex: American\_Samoa _countryPhrase [...
@CODE L("hello") = 0; @@CODE @NODES _sent @CHECK if (N("pattern",1) == "alpha" && N("pattern",3) == "alpha") fail(); if (N("pattern",1) != "alpha" && N("pattern",3) != "alpha") fail(); @POST if (N("pattern",3) == "alpha") { # Assume no evidence for local glom around conj. if (N("verb",3))...
@CODE L("hello") = 0; @@CODE @NODES _TEXTZONE # ^ cap @PRE <3,3> cap(); @CHECK if (N("quoted",3)) { # Probably a caps region... if (X("quoted caps") > X("quoted prose")) fail(); } @POST N("newsent",3) = 1; noop(); @RULES _xNIL <- _xSTART _xWILD [star match=(_xPUNCT _qEOS _dbldash)] _xWILD [one match...
# Bind a database table's column to an NLP++ variable @CODE dbopen("test","root","mypassword"); dballocstmt(); dbexecstmt("SELECT * FROM employee;"); dbbindcol(1,"varchar",50,&G("employee name"),&G("result1")); while (dbfetch()) {    "output.txt" << "employee name: ";    if (G("result1"))       "output.txt" << G("empl...
@NODES _LINE @POST L("con") = getconcept(G("caps"),N("$text")); S("caps") = L("con"); AddUniqueStr(L("con"),"type","full"); L("con") = getconcept(G("names"),N("$text")); S("names") = L("con"); single(); @RULES _name <- _xWILD [min=2 match=(_xCAP \& 310) fail=(_det _function)] @@ @PRE <1,1> uppercase(); @P...
# Since @POST is non-empty, you must explicitly specify reduction @POST  ++G("nouns");  single();  # NEEDED, or computer will not reduce to _noun. @RULES _noun <- computer @@ # In this case, @POST is empty, so single() occurs by default. @POST @RULES _noun <- sheep @@
@CODE DisplayKB(G("labels"), 1); @@CODE
@CODE G("file") = G("$inputhead") + ".dict"; @@CODE
@NODES _ROOT ############################################### # Rule 9 # # Abbreviations (capital + period alternating # ############################################### @CHECK G("word") = N("$text",2); G("L1") = strlength(G("word")); if (G("L1") > 2) fail(); @@CHECK @RUL...
# Remove all phrases from given subhierarchy. prunephrases(L("hier"));
@PATH _ROOT _pronunciations _headerZone _LINE @RULES _phonetic <- _xWILD [plus match=(_xALPHA)] ### (1) @@
@CODE DisplayKB(G("eui_to_codes_root"), 2); # L("a") = -1; # L("b") = 0; # if (L("b") != 1) { # "negatives.txt" << L("a") << "\n"; # "negatives.txt" << L("b") << "\n"; # } @@CODE
@PATH _ROOT _doctypedecl @RULES _Comment <- _CommentStart [one] ### (1) _xWILD [min=0 max=0 fail=("_CommentEnd" "_CommentEnd" "_DoubleHyphen")] ### (2) _CommentEnd [one] ### (3) @@ _ExternalID <- _xWILD [min=1 max=1 matches=("PUBLIC")] ### (1) _whiteSpace [one] ### (2) _PubidLiteral [one...
@NODES _LINE @POST S("word") = N("$text",2); single(); @RULES _string <- \" ### (1) _xWILD [fail=(\" _xEND)] ### (2) \" ### (3) @@
@NODES _LINE @PRE <1,1> vareq("date","month"); <2,2> var("year"); @RULES _dateRange <- _xALPHA [s] ### (1) _xNUM ### (2) to ### (3) present ### (4) @@