AshtonIsNotHere/CodeLlama_7B_nlp_pp
Text Generation • 7B • Updated • 563
text stringlengths 22 301k |
|---|
@NODES _LINE
@POST
"urls.txt" << "https://state.1keydata.com/" << N("$text",4) << "\n";
single();
@RULES
_xNIL <-
href ### (1)
\= ### (2)
\" ### (3)
_xWILD [fail=(\")] ### (4)
\" ### (5)
@@
|
@CODE
G("icd_codes") = getconcept(findroot(),"icd_codes");
if (! G("icd_codes")) {
G("icd_codes") = makeconcept(findroot(),"icd_codes");
}
@@CODE |
@NODES _split
@POST
L("code") = N("code", 1);
L("term") = N("term", 1);
if (!strcontains(".", L("code"))) {
addEntryToHier(X("con"), L("code"), L("term"));
}
noop();
@RULES
_xNIL <-
_entry ### (1)
@@
|
@NODES _LINE
@RULES
_sep <-
\t
@@
|
@MULTI _section _sentence _looseText
@CHECK
if (pnname(X()) == "_item") {
fail();
}
@POST
excise(2,2);
single();
@RULES
_sentence <-
_xWILD [fail=(_section _subsection _endSent _BLANKLINE)] ### (1)
_xWILD [one trig match=(_endSent _BLANKLINE)] ### (2)
@@
@CHECK
if (pnname(X()) == "_item") {
f... |
@NODES _NLPPP
@RECURSE littoaction
@POST
rfalittoaction(1)
single()
@RULES
_ACTION <- _LIT @@
@@RECURSE littoaction
@RECURSE littoaction
@POST
rfalittoaction(1)
single()
@RULES
_ACTION <- _LIT @@
@@RECURSE littoaction
@POST
rfaactions(2)
single()
@RULES
_POSTS [base] <-
_soPOST
_xWILD [match=(_LIT _ACTI... |
# This is the tagrules minipass
@RECURSE tagrules
# This rule in the minipass operates on the phrase of nodes that
# matched _xWILD in the _tag rule.
@RULES
_keywords <-
keywords
\=
\(
_xALPHA
[star]
\)
@@
@@RECURSE tagrules
# This is the main rules area, called the Grammar Zone.
# When this rule matches, i... |
@NODES _LINE
@PRE
<1,1> cap();
@RULES
# Ex: Alice
_femaleName [layer=(_humanNamepart )] <- _xWILD [min=1 max=1 s match=("Alice" "Patricia" "Linda" "Barbara" "Elizabeth" "Jennifer" "Maria" "Susan" "Margaret"
"Dorothy" "Lisa" "Nancy" "Karen" "Betty" "Helen" "Sandra" "Donna" "Carol" "Ruth"
"Sharon" "Michelle" "Laura" ... |
@NODES _LINE
@PRE
<1,1> cap();
<6,6> cap();
<6,6> length(1);
@POST
group(6, 8, "_room");
single();
@RULES
# Ex: Rm.\_#\_A
_unitRoom <- _PostalUnit [s layer=("_unit")] \. [s] _xWHITE [star s] \# [s] _xWHITE [star s] _xALPHA [s] \- [s] _xNUM [s] @@
@PRE
<1,1> cap();
@RULES
# Ex: Rm.\_#\_
_unitRoom <- _PostalUnit [s... |
@NODES _ROOT
@POST
splice(1,1)
@RULES
_xNIL <- _LINE @@
|
@CODE
G("words") = findconcept(findroot(),"words");
if (!G("words")) G("words") = makeconcept(findroot(),"words");
rmchildren(G("words"));
G("word") = makeconcept(G("words"),G("$inputhead"));
@@CODE
|
@NODES _ROOT
@PRE
<2,2> uppercase();
@RULES
_addendum <-
_xSTART
_xALPHA
_xWILD
_xWILD [min=4 matches=(_)] ### (1)
@@ |
@NODES _LINE
@POST
S("language") = N("language",1);
single();
@RULES
_languageZone <-
_language ### (1)
_xWILD [plus match=(_headerZone)] ### (2)
@@
|
@NODES _LINE
@RULES
# Ex: 02
_monthNum <- _xWILD [min=1 max=1 s match=("02" "2" "3" "4" "5" "6" "7" "8" "9"
"01" "1" "03" "04" "05" "06" "07" "08" "09" "10"
"11" "12")] @@
|
@NODES _ROOT
@POST
S("split") = N("$text", 1);
excise(1,3);
single();
@RULES
_split <-
_xWILD [one matches=(top rare)]
_xPUNCT
50
_xWILD [plus fails=(top rare _xEND)]
@@ |
@NODES _LINE
@PRE
<1,1> cap();
<3,3> cap();
<5,5> cap();
@RULES
# Ex: Absolute\_Real\_Time,\_Inc.
_company <- Absolute [s] _xWHITE [star s] Real [s] _xWHITE [star s] Time [s] \, [s] _xWHITE [star s] _companyRoot [s] @@
@PRE
<1,1> cap();
<3,3> cap();
@RULES
# Ex: General\_Instrument
_company <- General [s] _xWHITE [... |
@CODE
G("RadLex") = findconcept(findroot(),"RadLex");
if (!G("RadLex")) G("RadLex") = makeconcept(findroot(),"RadLex");
rmchildren(G("RadLex"));
@@CODE |
@PATH _ROOT _headerZone
@RULES
_catGroup <-
_xWILD [plus match=(_liGroup _hiGroup)] ### (2)
@@
|
@NODES _ROOT
@POST
excise(1,1);
@RULES
_xNIL <-
_xWILD [fail=(_term)] ### (1)
@@
|
# Check if a batch analysis process has just begun
@CODE
G("startflag") = batchstart();
@@CODE |
@DECL
########
# FUNC: LOOKUPALPHADICTTOKZ
# SUBJ: Look up an alphabetic word (with DICTTOKZ tokenize pass).
# INPUT: Assumes there's a word-node to attach results to.
# OUTPUT:
# WARN: Modifies vars in the given node.
# ERROR: DICTTOKZ neglects to put the "POS" attribute on
# nodes. # [BUG, FEATURE, OMISSION,... |
@NODES _LINE
@POST
# Made $length cover multiple nodes. #
#xaddlen("nindent", 2);
X("nindent") = X("nindent") + N("$length",2); # 06/04/00 AM.
singler(2,2); # 10/09/99 AM.
@RULES
# Count indentation separately. Doesn't add to nonwhite blob count.
_whtINDENT [base] <- _xSTART _xWHITE [s plus]@@
# Recording lon... |
@NODES _ROOT
@POST
G("filename") = N("pos") + ".dict";
G("filename") << N("word") << " pos=" << N("pos") << "\n";
@RULES
_xNIL <-
_LINE
@@
|
@NODES _ROOT
@CODE
G("wordArr");
G("wordArrLen") = 0;
@@CODE
@POST
L("word") = findconcept(G("words"), strtolower(N("$text", 1)));
if ( L("word") ) {
replaceval(L("word"), "count", numval(L("word"), "count") + 1);
}
else {
L("newWord") = makeconcept(G("words"), strtolower(N("$text", 1)));
addnumval(L("newWord"), ... |
@NODES _LINE
@PRE
<3,3> lowercase();
@POST
X("word") = N("$text",3);
"words.txt" << N("$text",3) << "\n";
@RULES
_xNIL <-
_xSTART ### (1)
\{ ### (2)
_xWILD [plus match=(_xALPHA \_ \-)] ### (3)
@@
|
@PATH _ROOT _textZone _headerZone _LINE
@POST X("lang") = N("lang");
@RULES _xNIL <- _langauge @@
@POST
if (X("pessoa",3)) {
X("pessoa2",3) = N("$text",1);
} else {
X("pessoa",3) = N("$text",1);
}
X("meaning",3) = 1;
@RULES _xNIL <- _pessoa @@
@POST X("numero",3) = X("numero",4); X("meaning",3) = 1;
@RULES ... |
@NODES _ROOT
@POST
if (N("type")) {
G("dict") << " " << N("type") << "=" << QuoteIfNeeded(strtolower(N("text")));
}
@RULES
_xNIL <-
_info ### (1)
@@
|
@NODES _LINE
@RULES
# Ex: minor\_concentration
_minorKey <- minor [s] _xWHITE [star s] concentration [s] @@
# Ex: minored
_minorKey <- minored [s] @@
# Ex: minors
_minorKey <- minors [s] @@
# Ex: minoring
_minorKey <- minoring [s] @@
# Ex: minor
_minorKey <- minor [s] @@
# Ex: concentration
_minorKey <- concentr... |
# Built two layers of the same thing, so get rid of one.
@NODES _ROOT
@POST
oldsplice(1,1) # 07/19/02 AM.
@RULES
_xNIL <- _RULES @@
_xNIL <- _CODE @@
_xNIL <- _DECL @@ # 12/19/01 AM.
_xNIL <- _PRES @@
_xNIL <- _CHECKS @@
_xNIL <- _POSTS @@
|
# Count nouns that have a non-zero feature (i.e. node variable)
@PRE
<1,1> var("mass");
@POST
++G("count mass nouns");
@RULES
_xNIL <-
_noun
@@ |
@NODES _ROOT
@POST
S("buf") = "Grammar" ;
S("Grammar") = str(N("$text",3)) ;
G("CurrentConcept") = findconcept(G("Elements"),N("ElementName",1)) ;
G("attr") = findattr(G("CurrentConcept"),S("buf")) ;
if (G("attr") == 0 ) {
addattr(G("CurrentConcept"),S("buf")) ;
addstrval(G("CurrentConcept"),S("buf"),S... |
# Fetch the word following the given word in the KB dictionary hierarchy.
L("return_con") = dictnext(L("con")); |
@NODES _LINE
@PRE
<1,1> varz("common");
@RULES
_header <-
_xALPHA ### (1)
experience ### (2)
@@
@PRE
<2,2> vareq("resume","header");
@RULES
_header <-
_xSTART ### (1)
_xALPHA ### (2)
_xEND ### (3)
@@
|
@NODES _ROOT
@POST
"verb.txt" << N("$text",5) << "\n";
single();
@RULES
_header <-
\< ### (1)
h ### (2)
2 ### (3)
\> ### (4)
_xALPHA ### (5)
Conjugation ### (6)
\: ### (7)
Present ### (8)
Tense ### (9)
\< ### (10)
\/ ### (11)
h ### (12)
2 ### (13)
\> ### (14)
@@
@RULES
_tbody <-
... |
# Sort an array of concepts by comparing an attribute named "count", of numeric type, in ascending order
G("sorted concepts") = sortconsbyattr(G("unsorted concepts"),"count",1,0);
G("unsorted concepts") = 0; # Explicitly remove the unsorted array. |
@DECL
# Join KB path concept names to form phrase
GetKBPathString(L("path")) {
L("pathArray") = split(L("path"), " ");
L("len") = arraylength(L("pathArray"));
L("i") = 4;
L("string") = L("pathArray")[3];
L("string") = strpiece(L("string"), 1, strlength(L("string"))-2);
while (L("i") < L("len")) {
L("string... |
@NODES _LINE
@POST
X("header",2) = N("$text",3);
single();
@RULES
_header <-
_xSTART ### (1)
_xWILD [plus match=(\=)] ### (2)
_xWILD [plus fail=(\=)] ### (3)
_xWILD [plus match=(\=)] ### (4)
_xEND ### (5)
@@ |
@NODES _ROOT
@POST
S("header") = N("header",1);
single();
@RULES
_headerZone <-
_header ### (1)
_xWILD [fail=(_header _xEND)] ### (2)
@@
|
@PATH _ROOT _educationZone
@RULES
_educationInstance <-
_xWILD [s one match=( _xSTART _educationBoundary )]
_xWILD [s star match=(_LINE _BLANKLINE) except=(_eduStart)]
@@
_educationInstance <-
_eduStart [s]
_xWILD [s star match=(_LINE _BLANKLINE) except=(_eduStart)]
@@
|
# Randomly permute N integers 0 to N-1, such that none are in normal order
@CODE
"output.txt" << "0 1 2 3 4" << "\n";
"output.txt" << permuten(5) << "\n";
@@CODE
Outputs something like:
0 1 2 3 4
3 0 4 1 2 |
@NODES _ROOT
@POST
S("tag") = N("$text",3);
single();
@RULES
_tag <-
\< ### (1)
\/ [optional] ### (2)
_xALPHA ### (3)
\> ### (4)
@@
|
@PATH _ROOT _bibItem
@POST
S("text") = N("$text",3);
S("type") = "text";
single();
@RULES
_text <-
_xWILD [s plus fails=(_dash _bibItem _bibRef _spacing _text _bold _italics _emph _NEWLINE)] ### (3)
@@ |
@NODES _ROOT
@RULES
_xNIL <-
the ### (1)
@@
|
@CODE
L("hello") = 0;
G("LINUX") = 0;
# G("LINUX") = 1; # If on Linux system.
# Workaround: use relative or hardwired filenames on Linux for now.
# No #IFDEF in NLP++ #
# If verbose outputs.
G("verbose") = 1;
# If error outputs.
G("error") = 1;
# If highlighting passes.
# If not interactive (VisualText session), ... |
@POST
rfarecurses(1)
single()
@RULES
_RECURSES [base] <- _RECURSE [plus] @@
|
# Look only at cap phrases within lines within experience zones.
@PATH _ROOT _experienceZone _LINE
@POST
N("job conf",1) =
N("len",1)
+ N("caplen",1)
+ N("jobtitleroots",1) * 3
+ N("end jobtitleroot",1) * 10
;
N("company conf",1) =
N("len",1)
+ N("caplen",1)
+ N("unknowns",1) * 10 # 12/09/99 AM.
+ N... |
@PATH _ROOT _CHECKS _NLPPP
@POST
rfaactions(1)
single()
@RULES
#_CHECKS [base] <- _ACTION [star] @@
_CHECKS [base] <- _STMTS [plus] @@
|
@CODE
G("kb") = getconcept(findroot(),"kb");
rmchildren(G("kb"));
@@CODE |
@CODE
G("codes") = getconcept(findroot(),"codes");
G("words") = getconcept(findroot(),"words");
G("lookups") = getconcept(findroot(),"lookups");
G("pos") = getconcept(findroot(),"pos");
@@CODE |
# Remove the _adjs nodes from the parse tree, replacing them with their children
@POST
splice(1,2);
@RULES
_xNIL <- _adjs _adjs @@ |
###############################################
# FILE: XML baseElements.pat #
# SUBJ: Collect the smallest syntactic pieces #
# of an XML file ... starts and ends of #
# tags, entity references, and the like #
# AUTH: Paul Deane #
# CREATED: 11/Jan/01
# D... |
@NODES _ROOT
@POST
L("counties") = getconcept(G("state"),"counties");
addnumval(L("counties"),"number",num(N("text",1)));
single();
@RULES
_xNIL <-
_numCounties ### (1)
@@
|
@CODE
L("hello") = 0;
@@CODE
|
@PATH _ROOT _textZone _LINE
@RULES _pessoa <- _xWILD [one match=(primeira segunda terceira)] @@
@RULES _numero <- _xWILD [one match=(singular plural)] @@
@RULES _tempo <- presente @@
@RULES _tempo <- futuro @@
@RULES _tempo <- afirmativo @@
@RULES _tempo <- negativo @@
@RULES _tempo <- pretérito _xWILD [one match=(i... |
# Close the currently open database
@CODE
dbopen("test","root","mypassword");
dballocstmt();
dbexecstmt("SELECT * FROM table;");
dbbindcol(1,"varchar",50,&G("employee name"),&G("result1"));
while (dbfetch())
{
"output.txt" << "employee name: ";
if (G("result1"))
"output.txt" << G("employee name") << "\n";
... |
@CODE
DisplayKB(G("currtext"),1);
@@CODE |
@PATH _ROOT _doctypedecl _Mixed
@RULES
_childItem <-
_whiteSpace [opt] ### (1)
\| [one] ### (2)
_whiteSpace [opt] ### (3)
_xWILD [s one matches=("_xALPHA" "_" ":")] ### (4)
_xWILD [s star matches=("_xALPHA" "_xNUM" "." "-" "_" ":")] ### (5)
@@
_childItem <-
_whiteSpace [opt] ### (1)
\... |
# Remove child con "a concept" under concept "myConcept" in kb, additionally create a child concept "a child" under "aParent" and then remove by number
G("myConcept") = makeconcept(findroot(),"a concept");
G("result") = rmchild(G("myConcept"),"a concept");
This one does it by number:
G("aParent")= makeconcept(findroot... |
# Dynamically set the next node that the rule matcher will look at, after the current rule match is done
@POST
if (N(3))
single();
else
{
# Discard the comma match,if any.
setlookahead(2);
singler(1,1);
}
@RULES
_namewtitle <-
Smith
\, [opt]
CEO [opt]
@@ |
@PATH _ROOT _LINE _description
@POST
L("con") = getconcept(G("codes"),X("code",2));
addstrval(L("con"),"disease",N("$text",1));
addstrval(L("con"),"cause",N("$text",4));
@RULES
_newNode <-
_xALPHA ### (1)
due ### (2)
to ### (3)
_xALPHA ### (4)
@@
|
@DECL
# e to 15 decimal places
e(L("flt")) {
if (!L("flt")) {
return "2.718281828459045";
}
else {
return flt("2.718281828459045");
}
}
# Pi to 15 decimal places
pi(L("flt")) {
if (!L("flt")) {
return "3.141592653589793";
}
else {
return flt("3.141592653589... |
@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
@@
_xNI... |
@NODES _termEntry
@POST
S("base") = N("$text", 3);
X("base") = N("$text", 3);
excise(4,4);
excise(1,2);
single();
@RULES
_base <-
base ### (1)
\= ### (2)
_xWILD [fails=(\n \r)] ### (3)
_xWILD [one matches=(\n \r)] ### (4)
@@
|
# Fetch the first word in the KB dictionary hierarchy
@CODE
L("con") = dictfirst();
while (L("con"))
{
"output.txt" << conceptname(L("con") << "\n";
L("con") = dictnext(L("con"));
}
Prints a list of the dictionary entries, one per line. |
@NODES _LINE
@POST
excise(1,1);
noop();
@RULES
_xNIL <-
_xWHITE [s] ### (1)
@@
|
@PATH _ROOT _paragraph _sentence
###############################################
# Eastern District of New York
###############################################
@PRE
<2,2> var("direction");
<3,3> var("region");
<5,5> var("state");
@POST
S("region") = N("$text",2) + " " + N("$text",3);
S("state") = N("$text",5);
sing... |
@CODE
DispKB();
@@CODE
|
@NODES _ROOT
@RULES
_NotationDecl <-
_NotationDeclStart [one] ### (1)
_whiteSpace [opt] ### (2)
_xWILD [min=1 max=0 fail=("_EndTag")] ### (3)
_whiteSpace [opt] ### (4)
_EndTag [one] ### (5)
@@
_NDataDecl <-
_whiteSpace [opt] ### (1)
_xWILD [one matches=("NDATA")] ### (2)
_whiteSp... |
@NODES _LINE
@POST
excise(6,6);
excise(4,4);
excise(2,2);
@RULES
_xNIL <-
_xWILD [fail=(_sep) gp=(_rank)] ### (1)
_sep ### (2)
_xWILD [fail=(_sep) gp=(_language)] ### (3)
_sep ### (4)
_xWILD [fail=(_sep) gp=(_country)] ### (5)
_sep ### (6)
_xWILD [fail=(_sep) gp=(_pop)] ### (7)
@@
|
@CODE
G("body") = getconcept(findroot(),"body");
G("part") = G("body");
@@CODE |
@DECL
#############
# FN: XMLRECURSION
# SUBJ: Traverse parse tree to output embedded tags.
# NOTE: To minimize recursion, each first child will manage
# its list of siblings.
# Using the global G("oxml") stream for printout.
#############
xmlrecursion(
L("n"), # Current node.
L("root"), # 1 if a "root", else 0... |