text stringlengths 22 301k |
|---|
@PATH _ROOT _LINE
@POST
# Want to make elt 3 optional and say:
# if (ispresent(elt 3))
N("school type") = "undergraduate";
listadd(5,1,"true");
@RULES
_xNIL <-
_xWILD [s one match=(overall cumulative)]
_xWHITE [s star]
undergraduate [s]
_xWHITE [s star]
_GPA [s]
@@
@POST
listadd(3,1,"true");
@RULES
_xNIL... |
@NODES _ROOT
# LINK TO PRE ACTIONS:
# https://visualtext.org/help/NLP_PP_Stuff/AT-PRE_Actions.htm
@PRE
<4,4> length(4);
<4,4> numrange(1700,2100);
@RULES
_date <-
_month ### (1)
_xNUM ### (2)
\, [opt] ### (3)
_xNUM ### (4)
@@
|
@PATH _ROOT _areaCodes
@POST
L("type") = pnvar(pnup(N(1)),"type");
if (L("type") == "areaCodes") {
"codes.txt" << N("$text",1) << "\n";
X("codes")[X("c")++] = N("$text",1);
}
@RULES
_xNIL <-
_xNUM ### (1)
@@
|
@CODE
if (G("pretagged"))
exitpass();
if (!G("hilite")) # 10/25/10 AM.
exitpass(); # 10/25/10 AM.
G("hello") = 0;
@@CODE
@PATH _ROOT _TEXTZONE _sent _clause
@CHECK
if (N("sem") != "location"
&& !N("sem location"))
fail();
@POST
if (G("verbose"))
"location.txt" << N("$text") << "\n";
# Registering... |
@PATH _ROOT _LINE _language
@RULES
_lang <-
_xALPHA ### (1)
\- ### (2)
_xALPHA ### (3)
@@
@POST
noop();
@RULES
_xNIL <-
_xALPHA [gp=(_lang)] ### (1)
\, ### (2)
_xALPHA [gp=(_lang)] ### (3)
@@
_xNIL <-
_xSTART ### (1)
_xALPHA [gp=(_lang)] ### (2)
@@
|
@NODES _ROOT
@RULES
_documentation <-
_xSTART ### (1)
_xWILD [fail=(_group)] ### (2)
@@
|
@DECL
SplitWord(L("word")) {
L("len") = strlength(L("word"));
L("i") = 0;
L("split") = 0;
while (L("i") < L("len")) {
L("c") = strpiece(L("word"),L("i"),L("i"));
if (strisupper(L("c")))
L("split") = L("split") + " ";
if (!L("i"))
L("c") = strtoupper(L("c... |
@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)
@@ |
@NODES _LINE
@RULES
_degree <- _xWILD [s one match=( _degreePhrase _degreeWord )] @@
_city <- _xWILD [s one match=( _cityPhrase _cityWord )] @@
|
@NODES _ROOT
@RULES
_header <-
_xWILD [plus match=(\# \-)] ### (1)
_xALPHA ### (2)
@@
@RULES
_np <-
_det ### (1)
_xWILD [match=(_adj)] ### (2)
_xWILD [trig plus match=(_noun)] ### (3)
@@
@POST
singler(2,2);
@RULES
_endSent <-
_xWILD [s one match=(_xALPHA _xNUM)] ### (1)
_xWILD [one trig... |
@NODES _LINE
#@CHECK
# Look in merged lines only. (Would like a more efficient
# way, rather than traversing the whole unmerged line.)
# X("merged");
@POST
excise(2,2); # Zap the indent.
@RULES
_xNIL <- \n [s] _whtINDENT [s] @@
_xNIL <- \n [s] _xWHITE [s star] @@ # 12/03/99 AM.
@RULES
_whtSEP [base] <- \t [s plus]... |
# Find a string attribute attrNameStr in the hierarchy starting at the concept childConcept, searching upwards. Search for attribute continues until attribute is found or the concept named topConcept is reached
@CODE
if (findconcept(findroot(),"ontology"))
rmconcept(findconcept(findroot(),"ontology"));
G("ontology")... |
@PATH _ROOT _LINE
#@PRE
#<1,1> unknown()
@CHECK # 09/02/01 AM.
if (spellword(N("$text",1)))
fail();
@POST
++X("nunknowns");
# noop()
@RULES
_xNIL <- _xALPHA [s] @@
|
@CODE
G("out") = cbuf();
G("sentence") = down(G("parse"));
while (G("sentence"))
{
G("object") = down(G("sentence"));
G("out") << "-------------------------------------------------------------\n";
G("out") << "\"" << strwrap(strval(G("sentence"),"text"),60) << "\"\n\n";
while (G("object"))
{
G("printed")... |
@PATH _ROOT _LINE _countryText
@POST
L("country") = N("$text");
L("country") = strsubst(L("country"),"[",0);
L("country") = strsubst(L("country"),"]",0);
X("country",2) = L("country");
X("con",2) = getconcept(G("countries"),L("country"));
if (X("full",2))
addstrval(X("con",2),"full",X("full",2));
single();
@RULES
_... |
@NODES _LINE
@RULES
_saintName <-
_xWILD [s min=1 max=1 matches=(
Agnes
Albert
Ambrose
Andrew
Andrews
Anselm
Anthony
Aquinas
Augustine
Bonaventure
Benedict
Boniface
Catherine
Clare
Cloud
Edward
Elizabeth
Francis
John
Joseph
Lawrence
Leo
Louis
Martin
Mary
Michael
Norbert
Olaf
Patrick
Paul
Peter
Pierre
Rose
Scholast... |
@DECL
###############################################
# General functions
###############################################
AddUniqueCon(L("concept"),L("name")) {
"debug.txt" << conceptpath(L("concept")) << "\n";
L("con") = findconcept(L("concept"),L("name"));
if (!L("con")) L("con") = makeconcept(L("concept"),L("n... |
@PATH _ROOT _labelEntry
@RULES
_xNIL <-
__xALPHA ### (1)
@@
|
@PATH _ROOT _report _headerZone
@POST
L("radLexTerms") = GetRadLexTerms(N(2));
"radLexTerms.txt" << N("$text", 1) << "\n";
if(L("radLexTerms")) {
L("count") = 0;
while (L("count") < arraylength(L("radLexTerms"))) {
"radLexTerms.txt" << "\t" << L("radLexTerms")[L("count")] << "\n";
L("count") = L("count") + 1;
... |
@CODE
G("ontology") = findconcept(findroot(),"ontology");
if (G("ontology"))
exitpass(); # One-time load per VisualText session.
# While developing, wipe it out each time.
#if (G("ontology"))
# rmconcept(G("ontology"));
G("ontology") = makeconcept(findroot(),"ontology");
###### ONTOLOGY TOP LEVELS ###########
L(... |
@NODES _LINE
@POST
X("up") = 1;
single();
@RULES
_list <-
\# ### (1)
_xWILD [fail=(_xEND)]
_xEND
@@
|
@PATH _ROOT _paragraph _sentence
@POST
N("possessive",1) = 1;
excise(2,3);
@RULES
_xNIL <-
_xWILD [one match=(_title _agency)] ### (1)
_quote ### (2)
s ### (3)
@@
|
@CODE
# Sentence counter. #
G("sentence count") = 0;
@NODES _ROOT
@POST
++G("sentence count"); # 05/17/01 AM.
S("name") = "sentence" + str(G("sentence count")); # 05/17/01 AM.
S("object") = makeconcept(G("parse"),S("name")); # 05/17/01 AM.
addstrval(S("object"),"text",N("$text",1));
single();
@RULES
_sentence... |
@NODES _LINE
@PRE
<1,1> var("noun");
<1,1> varz("stop");
@POST
L("text") = N("$text",1);
addstrval(X("con"), "nouns", L("text"));
L("word_exists") = findconcept(findconcept(G("words"), X("type")), L("text"));
if (!L("word_exists")) {
"icd_keywords.dict" << L("text") << " key_word=1\n";
}
L("con") = AddUniqueCon(fi... |
@CODE
# SaveKB("mykb.kbb",G("codes"),2);
DisplayKB(G("codes"), 1);
DisplayKB(G("words"), 1);
kbdumptree(findroot(), "icd_9.kbb");
@@CODE |
@NODES _LINE
@POST
singler(3,3)
@RULES
_CompleteSchoolName [base] <-
_xWILD [s one match=( _xSTART The at from in _xPUNCT )]
_xWHITE [star s]
_SchoolNamePhrase [t]
@@
# Joe (SchoolNamePhrase University) -> ModSchoolPhrase(Joe University)
@PRE
<1,1> cap()
@RULES
_SchoolNamePhrase [base] <-
_xALPHA [o... |
@NODES _LINE
@PRE
<3,3> lowercase();
@POST
X("word") = N("$text",3);
"words.txt" << N("$text",3) << "\n";
@RULES
_xNIL <-
_xSTART ### (1)
_xWILD [match=(\{ \[ _xWHITE)] ### (2)
_xWILD [plus match=(_xALPHA \_ \-)] ### (3)
@@
|
# Remove the two _adjs nodes from the parse tree, merging their children under a new _adjs node
@POST
merge();
@RULES
_adjs <- _adjs _adjs @@ |
@CODE
G("codes") = getconcept(findroot(),"codes");
G("words") = getconcept(findroot(),"words");
G("matches") = getconcept(findroot(),"matches");
G("order") = getconcept(findroot(),"order");
G("icd11") = getconcept(findroot(),"ICD11");
@@CODE |
@NODES _NLPPP
# Catch the start of a function call here, so it won't be grabbed by
# expression grammar. #
# Added L local var reference. #
@POST
fncallstart()
single()
@RULES
_VARLIST [base] <-
_xWILD [s one match=( s G N X P L ) layer=(_VARNAME)]
\( @@
# Eg, user::func() #
@POST
scopefncallstart(1,4)
si... |
@DECL
# Check whether value is in list. List must be iterable
# Push unique value onto var of pnnode
# Optimize later with searching algorithm. Not important for 2-3 elmnts.
# Args
# pnode: Parse tree node with <var>
# var: variable of <pnode> to push to
# val: value to push onto <pnode>'s <var>
# Returns
# ... |
@NODES _ROOT
@POST
if (N("header",1) == "नेपाली")
group(1,1,"_nepali");
else if (N("header",1) == "उच्चारण")
group(1,1,"_pronunciations");
else if (N("header",1) == "पदवर्ग")
group(1,1,"_partofspeech");
else if (N("header",1) == "अर्थ")
group(1,1,"_definition");
else if (N("header",1) == "उदाहरण")
group(1... |
# Convert string or num to float type, if possible
@CODE
G("val") = flt("345.67");
@@CODE |
# Print the text under a range of rule elements number1 to number2 to fileName
@POST
@@POST
@RULES
@@RULES |
@CODE
L("hello") = 0;
@@CODE
@NODES _TEXTZONE
# New tokenization handlers.
@CHECK
if (!N("dissolve"))
fail();
@POST
splice(1,1);
@RULES
_xNIL <-
_tok
@@
# Looks like a lousy rule...
# prep alpha adj
@CHECK
if (!N("adj",2))
fail();
if (N("verb",2))
fail();
@POST
L("tmp2") = N(2);
group(2,2,"_ad... |
@NODES _ROOT
@RULES
_Comment <-
_CommentStart [one] ### (1)
_xWILD [star fail=("_CommentEnd" "_CommentEnd" "_DoubleHyphen")] ### (2)
_CommentEnd [one] ### (3)
@@
@POST
S("textValue") = N("$text",2) ;
single() ;
@@POST
@RULES
_PubidLiteral <-
\" [one] ### (1)
_xWILD [star matches=( "_xALPHA"... |
@PATH _ROOT _educationZone _educationInstance
@POST
splice(1,1); # Zap the _expStart node
@RULES
_xNIL <- _eduStart @@
_xNIL <- _educationBoundary @@
|
@CODE
G("labels") = findconcept(findroot(),"labels");
if (!G("labels")) G("labels") = makeconcept(findroot(),"labels");
rmchildren(G("labels"));
G("phrases") = findconcept(findroot(),"phrases");
if (!G("phrases")) G("phrases") = makeconcept(findroot(),"phrases");
rmchildren(G("phrases"));
DictionaryClear();
@@CODE |
@PATH _ROOT _paragraph _sentence
@POST
L("text") = strtolower(N("$text"));
if (strlength(L("text")) > 1 && !N("functword")) {
single();
}
@RULES
_titleCaps <-
_xWILD [plus match=(_xCAP _nameAbbrevCandidate _nameSuffix \-)] ### (1)
@@
|
@NODES _ROOT
@POST
S("header") = N("header",1);
S("count") = 4;
single();
@RULES
_headerZone <-
_headerFour ### (1)
_xWILD [plus fails=(_headerFour _headerThree _headerTwo _xEND)] ### (2)
@@
|
# Reduce _det _quan _adj _noun nodes to _np, triggering _noun first
@RULES
_np <- _det _quan _adj _noun [trig] @@ |
# Replace all matching attribute-value pairs in the given hierarchy to have the new string value, new_s.
attrchange(L("hier"), L("attr_s"), L("val_s"), L("new_s")); |
@PATH _ROOT _language _headerZone
@PRE
<1,1> vareq("header", "etymology");
@POST
S("con") = MakeCountCon(X("con", 2), "etymology");
S("pos") = makeconcept(S("con"), "pos");
single();
@RULES
_etymologyZone <-
_headerZone ### (1)
@@
|
@CODE
G("emojis") = getconcept(findroot(),"emojis");
@@CODE |
@PATH _ROOT _section
@POST
L("icdDiagnoses") = GetICDTerms(N(2), G("split"));
@RULES
_xNIL <-
_xWILD [one matches=(_xSTART _patientID _time)] ### (1)
_xWILD [one match=(_xALPHA _xNUM)] ### (2)
@@ |
@CODE
G("database con") = findconcept(findroot(),"database");
if (G("database con"))
rmconcept(G("database con"));
G("database con") = makeconcept(findroot(),"database");
G("fields con") = makeconcept(G("database con"),"fields");
G("records con") = makeconcept(G("database con"),"records");
G("field count") = 0;
@@... |
@POST
rfaselect(2)
single()
@RULES
_SELECT [base] <- _soSELECT [opt] _NODES _eoSELECT [opt] @@
_SELECT [base] <- _soSELECT [opt] _MULTI _eoSELECT [opt] @@
_SELECT [base] <- _soSELECT [opt] _PATH _eoSELECT [opt] @@
|
@PATH _ROOT _experienceZone _LINE
# Looking for unassigned caps.
@CHECK
if (
N("len",1) <= 2
&& !N("capofcap",1)
&& !N("capandcap",1)
&& N("hi conf",1) < 70 # Hasn't been assigned to anything.
)
succeed();
fail();
@POST
S("city") = N("$text",1);
S("state") = N("$text",4);
single();
@RULES
_ci... |
@PATH _ROOT _textZone
@POST
S("header") = N("header",1);
single();
@RULES
_headerZone <-
_header ### (1)
_xWILD [fail=(_header _language _xEND)] ### (2)
@@ ### (3)
|
@CODE
# Uncomment passes 3 and 8 to recreate/add to kbbs.
G("icd9_codes") = getconcept(findroot(), "icd9_codes");
G("mimic_splits") = getconcept(findroot(), "mimic_splits");
G("top") = getconcept(G("mimic_splits"), "top");
G("rare") = getconcept(G("mimic_splits"), "rare");
@@CODE |
@NODES _LINE
@POST
group(2,2,"_item");
@RULES
_xNIL <-
_xSTART ### (1)
_comma ### (2)
@@
@POST
group(1,1,"_item");
@RULES
_xNIL <-
_comma ### (1)
_comma ### (2)
@@
|
@CODE
L("hello") = 0;
# Remove spurious words from the dictionary.
L("c") = dictfindword("nondurables");
if (L("c"))
rmconcept(L("c"));
@@CODE
@NODES _TEXTZONE
#####
## CORRECTIONS TO DICTIONARY HERE.
#####
@POST
N("pos num") = 2;
N("noun") = 1; # MISSING.
N("verb") = 1;
N("stem") = "affiliate";
N("... |
@NODES _ROOT
@RULES
_xNIL <- _xALPHA [s min=1 max=0 matches=()] @@
|
@PATH _ROOT _headerZone
@POST
if (strstartswith(N("value"),"verbtxt")) {
N("type") == "verbtxt";
}
@RULES
_xNIL <-
_iOpen ### (1)
@@
|
@CODE
#G("out") = cbuf();
G("out") = "words.xml";
L("word") = down(G("words"));
while (L("word")) {
L("wordid")++;
G("out") << "<word>\n";
G("out") << "\t<wordid>" << L("wordid") << "</wordid>\n";
G("out") << "\t<word>" << conceptname(L("word")) << "</word>\n";
G("out") << "</word>\n";
# pos1, pronunciation, s... |
@PATH _ROOT _textZone _LINE
@POST X("root",3) = N("$text",3); X("numero",3) = N("$text",1); single();
@RULES _numero <- _numero de _xALPHA @@
@POST X("pessoa",3) = N("$text",1); single();
@RULES _pessoa <- _pessoa pessoa @@
@POST X("numero",3) = N("$text",2); single();
@RULES _numero <- do _numero @@
@POST X("temp... |
@CODE
fileout("caps.txt");
prlit("caps.txt", "CAPITALIZED PHRASE CONFIDENCES\n");
prlit("caps.txt", " (RESUME-WIDE)\n");
prlit("caps.txt", "=======================================================\n");
prlit("caps.txt", " HUM CITY FLD SCH JOB CO. TEXT\n");
prlit("caps.txt", " -----------------------------------... |
@NODES _ROOT
@RULES
_xNIL <-
_phrase ### (1)
@@
|
@PATH _ROOT _paragraph _LINE
if (pnvar)
@RULES
_xNIL <-
_xWILD [one] ### (1)
@@
|
@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);
single();
@RULES
_headerZone <-
_header ### (1)
_xWILD [fail=(_header _xEND)] ### (2)
@@
@... |
@NODES _section
@POST
S("subsection") = N("subsection", 1);
merge(1,2);
@RULES
_subsection <-
_subsection [one]
_xWILD [plus fails=(_xEND _subsection)]
@@ |
@CODE
if (!G("find html"))
exitpass();
@@CODE
@NODES _ROOT
# Some html headers, h1 h2 etc.
@POST
L("num") = N("$text",4);
if (L("num") == "1")
L("txt") = "ha";
else if (L("num") == "2")
L("txt") = "hb";
else if (L("num") == "3")
L("txt") = "hc";
else if (L("num") == "4")
L("txt") = "hd";
... |
@CODE
L("arr");
L("i") = 21;
L("count") = 0;
L("arr_2") = 0;
"testfile.txt" << "Init: " << L("arr") << "\n";
"testfile.txt" << "Empty len: " << arraylength(L("arr")) << "\n";
if (L("arr_2")) {
"testfile.txt" << "arr_2: " << L("arr") << "\n";
}
"testfile.txt" << "Empty len: " << arraylength(L("arr")) << "\n";
... |
@NODES _ROOT
@RULES
_ABSTRACT <-
_beginAbs ### (1)
_xWILD ### (2)
_endAbs ### (3)
@@
|
@CODE
L("hello") = 0;
@@CODE
@PATH _ROOT _TEXTZONE _tok
# Artifact of pretagged texts.
# --
# - -
@POST
pncopyvars(X(3),N(4));
X("dissolve") = 1;
clearpos(N(2),1,0);
clearpos(N(3),1,0);
group(2,3,"_dbldash");
N("nopos",2) = 1;
@RULES
_xNIL <-
_xSTART
\-
\-
_xWILD [min=2 match=(_xANY) gp=_tok]
_xEND... |
@POST
rfanodes(2, multi)
single()
@RULES
_MULTI [base] <- _soMULTI _NONLIT [star] _eoMULTI [opt] @@
|
@NODES _LINE
@RULES
_major <- BIOLOGICAL _xWHITE AND _xWHITE AGRICULTURAL _xWHITE ENGINEERING @@
_major <- COMPUTER _xWHITE SCIENCE _xWHITE AND _xWHITE ENGINEERING @@
_major <- AGRICULTURAL _xWHITE AND _xWHITE BIOLOGICAL _xWHITE ENGINEERING @@
_major <- ELECTRICAL _xWHITE AND _xWHITE COMPUTER _xWHITE ENGINEERING @@
... |
@NODES _LINE
@POST
X("title") = N("$text",4);
singler(4,4);
@RULES
_title <-
title ### (1)
\= ### (2)
\" ### (3)
_xWILD [fail=(\")] ### (4)
\" ### (5)
@@
@POST
X("code") = N("$text",4);
singler(4,4);
@RULES
_code <-
_xSTART ### (1)
_xWILD [match=(_indent)] ### (2)
\" ### (3)
_xW... |
@NODES _ROOT
@RULES
_dash <-
\\ [s] ### (1)
textemdash ### (2)
@@
@RULES
_spacing <-
\\ [s] ### (1)
_xWILD [s match=(hspace vspace)] ### (2)
\{ [s] ### (3)
_xWILD [s fails=(\})] ### (4)
\} [s] ### (5)
@@
@POST
S("title") = N("$text",3);
G("title") = S("t... |
# Fetch the right or next sibling of concept.
L("return_con") = next(L("con")); |
@CODE
G("max header") = 0;
# Simplified since tutorials were recorded
G("resume") = getconcept(findroot(),"resume");
G("company") = getconcept(G("resume"),"company");
@@CODE |
@NODES _ROOT
@POST
excise(1,1);
noop();
@RULES
_xNIL <-
_xWHITE [s] ### (1)
@@
|
@NODES _attr
@POST
X("word") = N("$text",20);
X("type") = N("$text",8);
"words.txt" << N("$text",8) << " " << N("$text",20)<< "\n";
@RULES
_xNIL <-
\" ### (1)
concept ### (2)
\" ### (3)
\" ### (4)
sys ### (5)
\" ### (6)
\" ### (7)
_xALPHA ### (8)
\" ### (9)
\" ### (10)
_xALPHA ### (11)
\" ### (1... |
@NODES _LINE
@PRE
<1,1> cap();
@RULES
# Ex: Schooling
_EducationHeaderWord [layer=(_headerWord )] <- _xWILD [min=1 max=1 s match=("Schooling" "Qualifications" "Education")] @@
|
@CODE
# G("kb") = getconcept(findroot(),");
# SaveKB("mykb.kbb",G("pred_codes"),2);
DisplayKB(G("pred_codes"),1);
L("out") = cout();
L("out") << "This is a test.\n";
@@CODE |
@PATH _ROOT _group _subgroup _LINE
@POST
S("emoji") = N("$text",2);
S("description") = N("$text",3);
single();
@RULES
_emoji <-
\# ### (1)
_xEMOJI ### (2)
_xWILD [fail=(_xEND)] ### (3)
@@
|
@NODES _ROOT
@POST
N("field con") = next(N("field con"));
while (N("field con"))
{
addstrval(N("record con"),conceptname(N("field con"))," ");
N("field con") = next(N("field con"));
}
@RULES
_xNIL <-
_RECORD
@@ |
@CODE
if (!G("pretagged"))
exitpass();
@@CODE
@PATH _ROOT _LINE _pos _text
@POST
noop();
@RULES
_xNIL <-
_xWHITE [plus]
@@
@POST
if (X("posarr len",3))
{
N("posarr") = X("posarr",3);
N("posarr len") = X("posarr len",3);
}
else if (X("nopos",3))
N("nopos") = 1;
# Tokenize multi-element text... |
@NODES _sentence
@PRE
<1,1> cap();
@RULES
# Ex: California
_state <- California [s] @@
# Ex: Maryland
_state <- Maryland [s] @@
|
@PATH _ROOT _LINE _example
@POST
X("gender",2) = "male";
@RULES
_xNIL <-
_xWILD [matches=(man boy male father brother uncle)] ### (1)
@@
@POST
X("gender",2) = "female";
@RULES
_xNIL <-
_xWILD [matches=(woman girl female mother sister aunt)] ### (1)
@@ |
@PATH _ROOT _headerZone _headerZone
@POST
L("text") = strtrim(N("text"));
L("text") = strsubst(L("text"),"# ",0);
G("vocab") << " def=\"" << L("text") << "\"";
if (N("isa")) G("vocab") << " isa=" << N("isa");
if (N("is")) G("vocab") << " is=" << N("is");
@RULES
_xNIL <-
_list ### (1)
@@
|
@PATH _ROOT _attr _concept _LINE
@POST
X("word",2) = N("word",1);
@RULES
_xNIL <-
_string
_xEND
@@
|
@PATH _ROOT _LINE
@CHECK
# Only recompute for caps that were glommed in the g_caps1 pass.
if (!N("capofcap")) fail();
@POST
# if (!N("len"))
# print out no length.
# Treating confidences independently, but keep track of
# ambiguity in the phrase.
# Glommed, so must be a multi-node cap phrase.
### REJEC... |
@CODE
sortchilds(G("languages"));
SaveKB("languages.kbb",G("languages"),2);
@@CODE |
# Build an apple kb, adding color attr with values red, yellow, and green, as well as a weight attr with numval of 3
@CODE
# if you find apples in the concept hierarchy
if (findconcept(findroot(),"apple"))
# kill them (to start fresh)
rmconcept(findconcept(findroot(),"apple"));
# Create the apple concept
G("apple") ... |
# If anything follows a rulefile, error.
@POST
rfberror(2)
@RULES
_xNIL <- _RULESFILE _xANY @@
# If anything precedes a rulefile, error.
@POST
rfberror(1)
@RULES
_xNIL <-
_xWILD [plus fail=(_RULESFILE)]
_RULESFILE
@@
|
@CODE
if (!G("num lines"))
exitpass();
@@CODE
@NODES _ROOT
@POST
merge();
@RULES
_TEXTZONE <-
_TEXTZONE
_LINE [star]
@@
|
@NODES _LINE
#@CHECK
# being applied to a non optional here, which it shouldn't be....
# or(1,3) #
# useful is present. Should have a check here that says one of the
# wildcards ought to have some real education or experience stuff.
# Also, should treat education and experience separately.
@POST
single()
@RULES
... |
@PATH _ROOT _PRES _NLPPP
@POST
rfapres(1)
single()
@RULES
_PRES [base] <- _ACTION [plus] @@
|
@NODES _ROOT
@RULES
_termEntry <-
\{ ### (1)
_xWILD [fails=(\})] ### (2)
\} ### (3)
_xWILD [one matches=(\n \r)]
@@
|
@NODES _LINE
@PRE
<1,1> cap();
<3,3> cap();
@RULES
# Ex: Technical\_Skills
_SkillsHeaderPhrase [layer=(_header )] <- Technical [s] _xWHITE [star s] Skills [s] @@
|
# Check if concept's attribute has given value (multiple-value aware). Note that second two arguments must be STR.
L("has_attr_with_val") = attrwithval(L("con"), L("attr_str"), L("val_str")); |
@PATH _ROOT _experienceZone _experienceInstance _LINE
@CHECK
if (
!X("company name",3)
&& X("lineno") == X("anchor lineno",3)
)
succeed();
fail();
@POST
X("company name",3) = N("$text");
@RULES
_xNIL <- _company [s] @@
@CHECK
if (
!X("job title",3)
&& X("lineno") == X("anchor lineno",3)
)
... |
@PATH _ROOT _doctypedecl
@RULES
_NotationDecl <-
_NotationDeclStart [one] ### (1)
_whiteSpace [opt] ### (2)
_xWILD [plus fail=("_EndTag")] ### (3)
_whiteSpace [opt] ### (4)
_EndTag [one] ### (5)
@@
_NDataDecl <-
_whiteSpace [opt] ### (1)
_xWILD [one matches=("NDATA")] ### (2)
_w... |
@PATH _ROOT _LINE
@POST
L("code") = N("$text", 2);
L("title") = N("$text", 4);
X("icd_code") = makeconcept(G("icd9_codes"), L("code"));
addstrval(X("icd_code"), "title", L("title"));
L("term_con") = makeconcept(G("icd9_terms"), L("title"));
addstrval(L("term_con"), "code", L("code"));
excise(1,3);
noop();
@RULES
_xN... |
# Find 'mother' in the KB, then find parent concept and print name to output.txt, repeat for mother, daughter and mother again
@CODE
# Find 'mother' in the KB
G("First") = findhierconcept("mother", findroot());
# goto parent concept (female)
G("Second") = up(G("First"));
"output.txt" << conceptname(G("Second")) << "... |
@PATH _ROOT _labelEntry
#CREATE EMPTY ADJACENCY MATRIX
@CODE
L("len") = 100;
L("matrixSize") = L("len") * L("len");
L("i") = 1;
G("adjacencyMatrix") = 0;
while (L("i") < L("matrixSize")) {
G("adjacencyMatrix")[L("i")] = 0;
}
@@CODE
@POST
"test.txt" << N("$text", 1) << "\n";
single();
@RULES
_xNIL <-
_xALPHA [... |
@NODES _LINE
@PRE
<1,1> cap()
<3,3> cap()
@RULES
# Ex: New\_York
_NY <- New [s] _xWHITE [star s] York [s] @@
@PRE
<1,1> cap()
<4,4> cap()
@RULES
# Ex: N.\_Y.
_NY <- N [s] \. [s] _xWHITE [star s] Y [s] \. [s] @@
@PRE
<1,1> cap()
@RULES
# Ex: NY
_NY <- NY [s] @@
|
# Execute a statement on the currently open database
@CODE
dbopen("test","root","mypassword");
dbexec("INSERT INTO abc (name, number) VALUES('Joe','0013');");
dbclose();
@@CODE |
@DECL
AddPhrase(L("node")) {
L("con") = G("icd_p");
while (L("node")) {
L("text") = strtolower(pnvar(L("node"), "$text"));
L("con") = AddUniqueCon(L("con"), L("text"));
L("node") = pnnext(L("node"));
}
}
@@DECL
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.