text stringlengths 22 301k |
|---|
# Fetch the first child of given concept.
L("return_con") = down(L("con")); |
@CODE
G("kb") = getconcept(findroot(),"kb");
DisplayKB(L("top con"),L("display type"))
SaveKB("mykb.kbb",G("kb"),2);
@@CODE |
@NODES _LINE
@POST
# Add attr's to parent node
X("code") = N("$text", 4);
X("type") = N("$text", 8);
# Add code to kb
# L("type") = findconcept(G("codes"), N("$text", 8));
X("con") = AddUniqueCon(L("type"), N("$text", 1));
addstrval(X("con"), "code", N("$text", 4));
excise(2,9);
noop();
@RULES
_xNIL <-
_xWILD [fai... |
@NODES _ROOT
@POST
if (N("verb",3) && N("noun",3)) {
pnrename(N(3),"_noun");
}
@RULES
_xNIL <-
_det ### (1)
_adj [opt] ### (2)
_ambig ### (3)
@@
@POST
if (N("verb",2) && N("noun",2)) {
pnrename(N(2),"_noun");
}
@RULES
_xNIL <-
_adj ### (1)
_ambig ### (2)
@@
@POST
if (N("prep",1) && N("noun",1)) {... |
@NODES _ROOT
@POST
excise(1,1);
noop();
@RULES
_xNIL <-
_xWHITE [s] ### (1)
@@
|
@CODE
G("icd9_codes") = getconcept(findroot(), "icd9_codes");
if (!G("icd9_codes")) {
G("icd9_codes") = makeconcept(findroot(), "icd9_codes");
}
rmchildren(G("icd9_codes"));
G("icd9_terms") = getconcept(findroot(), "icd9_terms");
if (!G("icd9_terms")) {
G("icd9_terms") = makeconcept(findroot(), "icd9_terms")... |
@NODES _textZone
@POST
S("language") = N("language",1);
single();
@RULES
_languageZone <-
_language ### (1)
_xWILD [plus match=(_headerZone)] ### (2)
@@
|
@NODES _ROOT
@POST
S("con") = MakeCountCon(G("emojis"),"group");
addstrval(S("con"),"description",N("description",1));
single();
@RULES
_group <-
_groupHeader ### (1)
_xWILD [fail=(_subgroupHeader _groupHeader)] ### (2)
@@
|
@CODE
L("hello") = 0;
@@CODE
#@PATH _ROOT _TEXTZONE _sent
@NODES _sent
@CHECK
if (!N("possessive",2))
fail();
@POST
group(1,2,"_det");
N("ignorepos",1) = 1;
@RULES
_xNIL <-
_det
_adj
@@
# det num
@POST
if (N("num",2) == 1)
N("mypos",2) = "NN";
else
N("mypos",2) = "NNS";
pnrename(N(2),"_noun... |
# Add numeric value number as a string to concept concept's attribute named nameString
@CODE
G("Malibu") = makeconcept(findroot(), "Malibu");
addsval(G("Malibu"),"Route",1+2); |
@NODES _LINE
@RULES
_CompleteSchoolName <- _university @@
@POST
singler(3,3)
@RULES
_CompleteSchoolName [base] <-
The [s]
_xWHITE [s star]
_SchoolNamePhrase [t]
@@
_CompleteSchoolName [base] <-
_xSTART
_xWHITE [s star]
_SchoolNamePhrase [t]
@@
@RULES
_CompleteSchoolName [base] <-
_PostalState [s]
_xWHITE ... |
@CODE
prlit("ctc.txt", "\n CONTACT ZONE LINES DUMP\n");
prlit("ctc.txt", "----------------------------------\n");
@@CODE
@PATH _ROOT _contactZone
# @INI
# Dump contact zone node's data once.
# xdump()
# @@INI
@POST
ndump("ctc.txt",1);
prlit("ctc.txt", "-------\n");
@RULES
_xNIL <- _LINE @@
|
@CODE
# Iterate over note_words, getting codes associated with
# tagged euis
L("iter") = down(G("note_words"));
while (L("iter")) {
L("euis") = findvals(L("iter"), "bases");
if (L("euis")) {
addattr(L("iter"), "codes");
}
# Iterate over euis, adding to section codes attribute
L("eui_iter... |
@NODES _term
@POST
excise(1,1);
noop();
@RULES
_xNIL <-
_xWILD [one matches=(_xNUM _xPUNCT)]
@@
@PRE
<1,1> var("stopword");
@POST
excise(1,1);
noop();
@RULES
_xNIL <-
_xANY
@@ |
@PATH _ROOT _edge
@POST
excise(2,2);
single();
@RULES
_child <-
_xWILD [fails=(\t)] ### (1)
\t
@@
|
# Todo: DROP NLP++ regions into their own segments, to
# be able to say @PATH _ROOT _NLPPP
@NODES _NLPPP
@POST
# movesem(1) #
makestmts(1) # Renamed. # 05/29/01 AM.
single()
@RULES
# NEED THE BASE, OR INFINITE LOOP!
_STMTS [base] <- _xWILD [s one match=(_STMT _EXPR
_BLOCK # 12/15/99 AM.
)] @@
@POST
addstmt(... |
@PATH _ROOT _equation
@POST
X("type",2) = N("label type");
X("name",2) = N("label name");
addEquationName(N("label name"));
@RULES
_xNIL <-
_label [s]
@@
|
@NODES _LINE
@PRE
<1,1> cap();
<4,4> cap();
@RULES
# Ex: N.\_H.
_statePhrase [layer=(_Caps )] <- N [s] \. [s] _xWHITE [star s] H [s] \. [s] @@
# Ex: N.\_M.
_statePhrase [layer=(_Caps )] <- N [s] \. [s] _xWHITE [star s] M [s] \. [s] @@
# Ex: N.\_J.
_statePhrase [layer=(_Caps )] <- N [s] \. [s] _xWHITE [star s] J [s]... |
# Find string attribute's value up the hierarchy. con is the current concept, topCon is the root to be searched up to, and name is the name of the attribute. If hier==0, goes to root of KB.
L("return_str") = inheritval(L("con"), L("name"), L("topCon")); |
@CODE
G("enclosed by") = "\"";
G("separator") = ",";
G("lineTerminator") = "\n";
G("escaped by") = "\"";
@@CODE
@NODES _ROOT
@RULES
_enclosedBy <-
\" ### (1)
@@
_separator <-
\, ### (1)
@@
_lineTerminator <-
\r [optional] ### (1)
\n ### (2)
@@
_escapedBy <-
\\ ### (1)
@@
|
@CODE
G("people") = getconcept(findroot(),"people");
rmchildren(G("people"));
@@CODE |
@NODES _ROOT
@POST
excise(1,1);
@RULES
_xNIL <-
_rest ### (1)
@@
|
@CODE
L("hello") = 0;
@@CODE
@NODES _sent
# another ugly tiptoeing
# adj verb
# Sometimes it's a verb, sometimes ving noun.
@CHECK
L("n") = pndown(N(2));
if (!vconjq(L("n"),"-ing"))
fail();
@POST
pnrename(N(2),"_noun"); # verb -> noun
posacct(N(2));
@RULES
_xNIL <-
_adj
_verb
@@
# prep noun alpha pre... |
@PATH _ROOT _equation _split
@RULES
_separator <-
\\ ### (1)
\\ ### (2)
NEWLINE ### (3)
@@
@POST
excise(1,1);
single();
@RULES
_equal <-
\& ### (1)
_xWHITE [optional] ### (2)
\= ### (3)
@@ |
@NODES _ROOT
@POST
S("sent") = MakeCountCon(G("parse"),"sentence");
addstrval(S("sent"),"text",N("$text",1));
"sents.txt" << "'" << N("$text",1) << "'\n";
single();
@RULES
_sentence [unsealed] <-
_xWILD [s plus fails=(\. \? \! _paragraphSeparator)] ### (1)
_xWILD [s one matches=(\. \? \!)] #... |
@CODE
L("hello") = 0;
@@CODE
@NODES _TEXTZONE
@POST
S("sem") = S("ne type") = "organization";
S("ne type conf") = 95;
S("stem") = phrasetext();
S("ne") = 1;
single();
@RULES
_caps [layer=_noun] <-
united [s]
_xWHITE [star]
nations [s]
@@
_caps [layer=_noun] <-
tamil [s]
_xWHITE [star]
_xANY
@@
@P... |
@CODE
G("line_count") = 0;
@@CODE
|
@CODE
G("bookkeeping") = findconcept(findroot(),"bookkeeping");
if (!G("bookkeeping")) G("bookkeeping") = makeconcept(findroot(),"bookkeeping");
G("cites") = findconcept(G("bookkeeping"),"cites");
if (!G("cites")) G("cites") = makeconcept(G("bookkeeping"),"cites");
rmchildren(G("cites"));
G("figures") = findconcep... |
@NODES _LINE
@PRE
<1,1> cap();
<3,3> cap();
@RULES
# Ex: IBM\_RS\_
_hardware [layer=(_Caps )] <- IBM [s] _xWHITE [star s] RS [s] _xWHITE [star s] 6000 [s] @@
# Ex: IBM\_PC\_compatibles
_hardware [layer=(_Caps )] <- IBM [s] _xWHITE [star s] PC [s] _xWHITE [star s] compatibles [s] @@
@PRE
<1,1> cap();
@RULES
# Ex: P... |
@CODE
G("kb") = getconcept(findroot(),"kb");
SaveKB("mykb.kbb",G("kb"),2);
@@CODE |
@CODE
fileout("exp_anchors1.txt"); # 06/10/00 AM.
@@CODE
@PATH _ROOT _experienceZone
@CHECK
#Ngt(1, "nanchors", 0) # If it's an anchor line.
if (N("nanchors",1) <= 0) fail();
@POST
"exp_anchors1.txt" << "-------------------" << "\n";
ndump("exp_anchors1.txt",1);
# Transfer data up to anchor!
S("lineno") = N("l... |
@NODES _LINE
@PRE
<1,1> cap();
<5,5> cap();
@RULES
# Ex: Activities\_and\_Honors
_OtherHeaderPhrase [layer=(_header )] <- Activities [s] _xWHITE [star s] and [s] _xWHITE [star s] Honors [s] @@
|
@DECL
########
# FUNC: LOADATTR
# SUBJ: Load attr into dictionary concept.
# RET:
# NOTE: Updates dictionary in kb.
########
loadattr(
L("entry"),
L("attr_s"),
L("val")
)
{
if (!L("entry") || !L("attr_s"))
return;
L("lc") = strtolower(L("entry"));
L("dict concept") = dictgetword(L("lc"));
if (!L("dict concept")... |
@CODE
if (!G("pretagged"))
exitpass();
@@CODE
@NODES _ROOT
@POST
excise(1,1);
@RULES
_xNIL <- _xWILD [one match=(
_COMMENT
)] @@
@POST
splice(1,1);
@RULES
_xNIL <-
_LINE
@@
|
@NODES _ROOT
@POST
singler(2,2);
@RULES
_endSent <-
_xWILD [s one match=(_xALPHA _xNUM)] ### (1)
_xWILD [one trig match=(\. \? \!)] ### (2)
_xWILD [one match=(_xWHITE _xALPHA _xNUM _xEND _xCTRL)] ### (3)
@@
|
@NODES _paragraph
@POST
excise(1,1);
noop();
@RULES
_xNIL <-
_xWHITE [s] ### (1)
@@
|
@CODE
G("corporate") = findconcept(findroot(),"corporate");
if (!G("corporate"))
G("corporate") = makeconcept(findroot(),"corporate");
G("parse") = findconcept(G("corporate"),"parse");
if (G("parse"))
rmchildren(G("parse"));
else
G("parse") = makeconcept(G("corporate"),"parse");
G("companies") = findconcept(G(... |
# put attribute and value in the KB
if(findconcept(findroot(),"apple"))
rmconcept(findconcept(findroot(),"apple"));
G("apple") = makeconcept(findroot(), "apple");
addstrval(G("apple"),"color","red");
# access
"output.txt" << "getstrval = " <<
getstrval(findvals(G("apple"), "color")) << "\n";
"output.txt" << "strv... |
@NODES _ROOT
@POST
if (N("type") == "figure")
{
S("image") = N("image");
S("label") = N("label");
S("caption") = N("caption");
}
else
{
S("text") = N("text");
S("title") = N("title");
}
S("type") = N("type");
single();
@RULES
_item <-
_xWILD [one match=(_abstract _sectionBlock _figure)] ### (1)
... |
@NODES _LINE
# NOTE: Hand building some generalized email handling. #
@POST
singler(3,5);
@RULES
_email <- _emailHeader [s]
_xWILD [s star match=(\ \t \n _whtSEP)]
_xWILD [s fails=(\ \t \n _whtSEP _emailHeader \@)]
\@ [s trig]
_xWILD [s fails=(\ \t \n _whtSEP)]
_xWILD [s star... |
@DECL
# Add code to word
# code: alphanumeric code
# type: procedure or diagnosis
# word: word to add code to
addCodeToWord(L("code"), L("type"), L("word")) {
L("word_concept") = AddUniqueCon(G("word2codes"),L("name"));
}
# Add word to code
#
@@DECL |
@PATH _ROOT _defZone _definition _LINE
@RULES
_xNIL <-
_item ### (1)
@@
|
@CODE
L("hello") = 0;
@@CODE
@NODES _ROOT
# First paragraph.
@PRE
<3,3> varz("PAR");
@RULES
_TEXTZONE [unsealed] <-
_xSTART
_LINE
_LINE [star]
@@
@PRE
<1,1> var("PAR");
<2,2> varz("PAR");
@RULES
_TEXTZONE [unsealed] <-
_LINE
_LINE [star]
@@
# Excise blank lines.
@POST
excise(1,1);
@RULES
_xNIL <-
_xWILD ... |
@CODE
G("persist") = findconcept(findroot(),"persist");
if (!G("persist")) G("persist") = makeconcept(findroot(),"persist");
G("counter") = IncrementCount(G("persist"),"count");
G("file") = openfile(FileNameNumbered("outfile",5));
@@CODE |
# Remove value val from attribute attr.
rmval(L("attr"), L("val")); |
@PATH _ROOT _paragraph _sentence
@RULES
_officer <-
CEO [s] ### (1)
_conj [s] ### (2)
president [s] ### (3)
@@
_moneyType <-
assumed [s] ### (1)
debt [s] ### (2)
@@
_commentor <-
analysts [s] ### (1)
predictions [s] ### (2)
@@ |
@CODE
DictionaryStart();
@@CODE
|
@NODES _sentence
@PRE
<1,1> cap();
<2,2> cap();
@RULES
# Ex: Los\_Angeles
_city <- Los [s] Angeles [s] @@
|
@CODE
L("hello") = 0;
@@CODE
#@PATH _ROOT _TEXTZONE _sent
#@NODES _sent
|
@MULTI _ROOT _section _looseText _sentence _subsection _item
@PRE
<1,1> var("bases");
@POST
if (strcontains(",", N("bases", 1))) {
L("base_list") = split(N("bases", 1), ",");
L("base_lens") = 0;
if (!L("parent_keys")) {
pnmakevar(X(),"bases", L("child_keys")[L("i")]);
L("i")++;
}
while (L("i") < L("keys_l... |
@NODES _ROOT
@POST
excise(1,1);
@RULES
_xNIL <-
_BLANKLINE [s] ### (1)
@@
|
@CODE
exitpass(); # IGNORE THIS PASS! # 09/02/01 AM.
prlit("dump.txt", "Before sort\n");
"dump.txt" << G("Words");
# fprintvar("dump.txt", "Words", " ");
prlit("dump.txt", "\n\n");
sortvals("Words"); # Sort alphabetically.
prlit("dump.txt", "After sort\n");
"dump.txt" << G("Words");
prlit("dump.txt", "\n\n");
gt... |
@CODE
# Count the total number of cityStateZip matches.
# For use in determining best address block.
#var("cityStateZip", "0")
G("cityStateZip") = 0;
@@CODE
# Scour each line for all its addressParts and count them.
@MULTI _LINE
@POST
++X("addressParts");
@RULES
_xNIL <- _addressPart @@
# Record instances of cit... |
@PATH _ROOT _CODE _NLPPP
@POST
# rfacode(1) #
rfaactions(1) # 01/14/00 AM.
single()
@RULES
#_CODE [base] <- _xWILD [plus match=(_ACTION)] @@
_CODE [base] <- _STMTS [plus] @@ # 01/14/00 AM.
@POST
noop()
@RULES
_xNIL <- _xWILD [one match=(
_xPUNCT
_WHILECOND
)] @@
@POST
rfberror(1)
single()
@RULES
_ER... |
@NODES _ROOT
@RULES
_defZone <-
_definition ### (1)
_example ### (2)
@@
|
@NODES _LINE
@PRE
<1,1> cap();
<3,3> cap();
@RULES
# Ex: Customer\_Service
_jobPhrase [layer=(_Caps )] <- Customer [s] _xWHITE [star s] Service [s] @@
# Ex: Customer\_Support
_jobPhrase [layer=(_Caps )] <- Customer [s] _xWHITE [star s] Support [s] @@
|
# Find mother in the kb, then print parent concept name to output.txt, then go back to mother concept and print, then print daughter concept name, then print daughter's previous sibling name.
# The output should look like:'\nfemale\nmother\ndaughter\nmother'
@CODE
# Find 'mother' in the KB
G("First") = findhierconcept... |
@PATH _ROOT _contactZone _LINE _humanName
# Just some samples here. These could be done by a RUG hierarchy!!
# If name is unlabeled, meaning first middle, last haven't been set.
@PRE
<2,2> lengthr(2,20) # Title must be length > 1.
@CHECK
if (!X("unlabeled")) fail();
@POST
X("unlabeled") = 0;
X("prefixName"... |
@PATH _ROOT _translations _headerZone _LINE
@POST
L("con") = MakeCountCon(X("language",3),"translation");
addstrval(L("con"),"text",N("$text",1));
@RULES
_xNIL <-
_translation ### (2)
@@
|
@NODES _ROOT
@RULES
_attrBlock <-
_startAttr ### (1)
_xWILD [fail=(_endAttr)]
_endAttr
@@
|
#@NODES _REZZONE
@PATH _ROOT _REZZONE
@POST
excise(1,1)
@RULES
_xNIL <- _BLANKLINE @@
|
@NODES _ROOT
@POST
excise(1,1);
@RULES
_xNIL <-
_rest ### (1)
@@
|
@PATH _ROOT _paragraph _sentence
@POST
S("value") = N("value",1);
S("asset") = N("$text",2);
single();
@RULES
_money <-
_money ### (1)
_asset ### (2)
@@
@POST
S("value") = num(N("$text",1)) * num(N("numeric",2));
single();
@RULES
_money <-
_xNUM ### (1)
_number ### (2)
_currency ### (3)
@@
@POST
S("v... |
@PATH _ROOT _RULES
@RECURSE listarg
@POST
rfaarg(1)
single()
@RULES
_ARG [base] <- _NONLIT @@
_ARG [base] <- _LIT @@
_ARG [base] <- _STR @@
_ARG [base] <- _NUM @@
@@RECURSE listarg
@RECURSE argtolist
@POST
rfaargtolist(1)
single()
@RULES
_LIST <- _ARG @@
@@RECURSE argtolist
@POST
rfapair(1, 3)
single()
@... |
@NODES _LINE
# Fix it up as a capitalized phrase!
# Special terminations
@RULES
_companyRoot <-
of [s] _xWHITE [s star]
North [s opt] _xWHITE [s star]
America [s] @@
@POST
S("len") = 2;
single()
@RULES
_Caps [base unsealed] <-
\, [s] _xWHITE [s star]
_parenList _xWHITE [s star]
_companyRoot [s trig]
@@
# ... |
# Create apple concept with color and weight attributes, then print out values
if (findconcept(findroot(),"apple"))
# kill them (to start fresh)
rmconcept(findconcept(findroot(),"apple"));
# Create the apple concept
G("apple") = makeconcept(findroot(),"apple");
# Apple's color's red
addstrval(G("apple"),"color","red... |
@DECL
SomeFunction(L("attr"), L("value")) {
if (!L("attr") || !L("value"))
return 0;
"output.txt" << L("attr") << " is " << L("value") << "\n";
return 1;
}
@@DECL |
@NODES _ROOT
@POST
noop();
@@POST
@RULES
_xNIL <-
_cardinalNumeral [one] ### (1)
_xWILD [opt match=(_xWHITE "_whiteSpace")] ### (2)
\- [opt] ### (3)
_xWILD [opt match=(_xWHITE "_whiteSpace")] ### (4)
_cardinalNumeral [one] ### (5)
_xWILD [opt match=(_xWHITE "_whiteSpace")] ### (6)
\- [one]... |
@PATH _ROOT _headerZone
@RULES
_iClose <- \< \/ i \> @@
_iOpen <- \< i _xWILD [fail=(\>)] \> @@
_liClose <- \< \/ li \> @@
_liOpen <- \< li _xWILD [fail=(\>)] \> @@
_paraClose <- \< \/ p \> @@
_paraOpen <- \< p \> @@
|
@NODES _LINE
@POST
X("words") = X("words") + 1;
if (strlength(N("$text")) > 1) {
if (striscaps(N("$text"))) {
X("caps") = X("caps") + 1;
}
else if (strisupper(N("$text"))) {
X("upper") = X("upper") + 1;
}
}
if (N("common") || (N("lower") && spellword(N("$text")))) {
X("prose")++;
}
@RULES
_xNI... |
@NODES _LINE
@RULES
_brackets <-
\[ ### (1)
_xWILD [fail=(\])] ### (2)
\] ### (3)
@@
|
@NODES _ROOT
@RULES
_row <-
_trStart ### (1)
_xWILD [fail=(_trEnd)] ### (2)
_trEnd ### (3)
@@
|
@NODES _ROOT
@CHECK
if (G("people"))
succeed();
fail();
@RULES
_person <-
fred ### (1)
@@
@CHECK
if (G("people"))
fail();
succeed();
@RULES
_animal <-
horse ### (1)
@@
|
# Fetch the first node in given node's list.
L("return_con") = listnode(L("node")); |
@NODES _ROOT
@RULES
_BLANKLINE <-
_xWILD [min=0 max=0 matches=(\ \t \r)] ### (1)
\n ### (2)
@@
@POST
S("num") = G("line count")++;
single();
@RULES
_LINE <-
_xWILD [min=0 max=0 fails=(\r \n)] ### (1)
_xWILD [one match=(\n _xEND)] ### (2)
@@
|
@NODES _ROOT
@POST
excise(1,1);
@RULES
_xNIL <-
_zap ### (1)
@@
|
# Find 'mother' in the KB, then go up to the parent concept, then go back down to 'mother' concept, then find mother's first sibling, then find daughters previous sibling
@CODE
# Find 'mother' in the KB
G("First") = findhierconcept("mother", findroot());
# goto parent concept (female)
G("Second") = up(G("First"));
"... |
@NODES _ROOT
@RULES
_Email <-
_xWILD [match=(_xALPHA \. _xNUM \_)]
\@ [s]
_xWILD [match=(_xALPHA _xNUM \_)]
\.
_xWILD [match=(_xALPHA \. _xNUM \_)]
@@
|
@CODE
G("sortedWordArr") = sortconsbyattr(G("wordArr"),"count",1,1);
G("wordArr") = 0;
if (G("wordArrLen")) {
L("i") = 0;
while (L("i") < G("wordArrLen")) {
L("word") = G("sortedWordArr")[L("i")];
"wordFile.txt" << conceptname(L("word")) << ", " << numval(L("word"), "count") << "\n";
++L("i");
}
}
@@CODE |
# Create the concept apple, then create two attributes of apple, then delete both of them. Finally, add both of the attributes back and then delete only one
if(findconcept(findroot(), "apples"))
rmconcept(findconcept(findroot(), "apples"));
G("apples") = makeconcept(findroot(), "apples");
addstrval(G("apples"), "colo... |
@NODES _split
@POST
L("text") = N("code", 1);
"debug.txt" << L("text") << "\n";
if (strcontains("-", L("text"))) {
L("range") = split(L("text"), "-");
L("class_start") = L("range")[0];
L("class_end") = L("range")[1];
L("class_end") = split(L("class_end"), ".");
L("class_end") = L("class_end")[0];
S("con") = Ad... |
@PATH _ROOT
@POST
noop();
@RULES
_xNIL <- _xSTART
_xWILD [s min=0 max=25 match=(_BLANKLINE _horizRule)]
_xANY
@@
@RULES
_contactBoundary <-
_BLANKLINE [s star]
_horizRule [s opt]
_BLANKLINE [s star]
_xWILD [tree one matches=(_contactHeader) trigger]
_BLANKLINE [s star]
_horizRule [s opt]
_... |
@CODE
G("langs") = getconcept(findroot(),"langs");
@@CODE |
@PATH _ROOT _LINE
@POST
"negex.dict" << N("$text",1) << " negex=" << X("code",2) << "\n";
"negtest.txt" << N("$text",1) << "\n";
@RULES
_xNIL <-
_phrase ### (1)
@@
|
@CODE
L("hello") = 0;
@@CODE
#@PATH _ROOT _TEXTZONE _sent _clause _seg
@NODES _seg
@CHECK
if (!N("noun",3) && !N("adj",3))
fail();
if (!N("noun",4))
fail();
@POST
L("tmp4") = N(4);
L("tmp3") = N(3);
if (N("adj",3))
{
group(3,3,"_adj");
pncopyvars(L("tmp3"),N(3));
fixadj(N(3));
}
els... |
# create the concepts named words and noun as children to the root of the KB, then make the concept book a child of words
G("words") = makeconcept(findroot(), "words");
G("noun") = makeconcept(findroot(),"noun");
G("noun_book") = makeconcept(G("words"),"book"); |
# Fetch the string value name of a concept
@CODE
"output.txt" << conceptname(makeconcept(findroot(),"test")); |
@DECL
SaveName(L("name")) {
L("word") = strtolower(L("name"));
L("gender") = "male";
if (strcontains("female",strtolower(G("$inputhead")))) {
L("gender") = "female";
}
G("file") << L("word") << " name=first gender=" << L("gender") << "\n";
}
@@DECL |
@NODES _ROOT
@RULES
_rest <-
_xWILD [fail=(_td)]
@@
|
# Sort concept's subhierarchy alphabetically.
sorthier(L("con")); |
## CODE REGION
@CODE
# NOTE: Because the analyzer could potentially find multiple contact
# zones, gathering data globally. (Could gather data in each
# contact zone node also, if beneficial.)
# Count the number of ASSIGNED phone numbers found in contact zones.
G("Assigned Phones") = 0; # No assigned phones yet.
... |
@NODES _attrBlock
@POST
pnrename(N(1),"_word");
pnrename(N(2),"_zero");
pnrename(N(3),"_attr");
pnrename(N(4),"_type");
pnrename(N(5),"_value");
@RULES
_xNIL <-
_LINE ### (1)
_LINE ### (2)
_LINE ### (3)
_LINE ### (4)
_LINE ### (5)
@@
|
@NODES _ROOT
@POST
S("header") = N("header", 1);
single();
@RULES
_headerZone <-
_header ### (1)
_xWILD [fail=(_header _xEND)] ### (2)
@@
|
@DECL
#################
## FN: POSTORDER
## SUBJ: Postorder action for kb traversal.
#################
postorder(L("con"))
{
if (!L("con"))
return; # Error.
"postorder.txt" << "postorder: " << conceptname(L("con")) << "\n";
}
#################
## FN: PREORDER
## SUBJ: Preorder action for kb traversal.
############... |
@PATH _ROOT _group _subgroup _LINE
@PRE
<1,1> var("SP");
<2,2> var("NOSP");
@POST
L("text") = str(N("$text",1)) + str(N("$text",2));
if (strlength(L("text")) <= 5) {
if (IsHex(L("text")))
single();
}
@RULES
_hex <-
_xWILD [one] ### (1)
_xWILD [min=1 max=4] ### (2)
@@ |
@CODE
L("hello") = 0;
@@CODE
@NODES _TEXTZONE
@POST
L("start") = N(2);
L("end") = lasteltnode(2);
pnreplacevalrange("mypos","NP",L("start"),L("end"));
singler(2,3);
@RULES
_company [layer=_noun] <-
_xWILD [one match=(_dbldash \, _conj)]
_xWILD [s plus match=(_xCAP) except=(_companyDESIG)]
_companyDESIG [s... |
@NODES _humanName
# Just some samples here. These could be done by a RUG hierarchy!!
# If name is unlabeled, meaning first middle, last haven't been set.
@PRE
<2,2> lengthr(2,20) # Title must be length > 1.
@CHECK
if (!X("unlabeled")) fail();
@POST
X("unlabeled") = 0;
X("prefixName") = N("$text", 2);
X(... |
@CODE
G("output") = G("$inputhead") + ".dict";
@@CODE |
@CODE
G("parse") = getconcept(findroot(),"parse");
G("verbs") = getconcept(findroot(),"verbs");
G("caps") = getconcept(findroot(),"caps");
G("names") = getconcept(findroot(),"names");
@@CODE |
@CODE
L("hello") = 0;
if (!G("dbl quotes"))
exitpass(); # No double quotes found.
@@CODE
@NODES _TEXTZONE
@POST
if (G("inquotes"))
G("inquotes") = 0;
else
G("inquotes") = 1;
@RULES
_xNIL <-
_dblquote
@@
@CHECK
if (!G("inquotes"))
fail();
@POST
N("quoted") = 1;
N("cap") = 1;
++X("quoted caps");
@... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.