text stringlengths 22 301k |
|---|
@CODE
# Initialize next break point line.
#var("break", 0)
G("break") = 0;
@@CODE
@PATH _ROOT _experienceZone
# If anchor is a breakpoint, starts a new instance.
@CHECK
if (
G("break") && G("break") == N("lineno", 1)
)
succeed();
fail();
#GeqN("break", "lineno", 1);
@POST
# Compute the next breakpoint ... |
@NODES _enum
@POST
noop();
@RULES
_xNIL <-
_itemMarker ### (1)
_xWILD [group="_itemNum"] ### (2)
_itemMarker [lookahead] ### (3)
@@
_xNIL <-
_itemMarker ### (1)
_xWILD [group="_itemNum"] ### (2)
_endEnum ### (3)
@@
_xNIL <-
_itemMarker ### (1)
_xWILD [group="_i... |
@NODES _LINE
@PRE
<2,2> length(1);
@POST
L("text") = N("$text");
if (L("text") != "(") {
L("bullet") = getconcept(G("format"),"bullet");
L("con") = AddUniqueCon(L("bullet"),L("text"));
IncrementCount(L("con"),"count");
single();
}
@RULES
_bullet <-
_xSTART ### (1)
_xWILD [one match=(_xCTRL _x... |
# Look only at cap phrases within lines within experience zones.
@PATH _ROOT _experienceZone _LINE _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 jobtitlero... |
@NODES _ROOT
@PRE
<1,1> var("code");
@POST
if (N("type", 1) == "diagnosis") {
L("con") = AddUniqueCon(G("diagnosis_codes"), N("code", 1));
addstrval(L("con"), "keywords", strclean(N("$treetext", 1)));
}
else if (N("type", 1) == "procedure") {
L("con") = AddUniqueCon(G("procedure_codes"), N("code", 1));
L("attr")... |
@NODES _LINE
@PRE
<1,1> cap();
<3,3> cap();
@RULES
# Ex: Digital\_Equipment
_companyPhrase [layer=(_Caps )] <- Digital [s] _xWHITE [star s] Equipment [s] @@
@PRE
<1,1> cap();
@RULES
# Ex: Canon
_companyPhrase [layer=(_Caps )] <- Canon [s] @@
# Ex: Fujitsi
_companyPhrase [layer=(_Caps )] <- Fujitsi [s] @@
# Ex: Mi... |
# Set the UNSEALED attribute of the numth node to "true" or "false"
@POST
setunsealed(1,"true"); # Allows _sentence nodes to be examined by a subsequent pass that uses @NODES.
@RULES
_xNIL <- _sentence @@ |
@CODE
L("hello") = 0;
@@CODE
@PATH _ROOT _TEXTZONE _sent
@POST
if (N("sem texts") && N("sem vals"))
{
"output.txt" << "TEXT= " << phrasetext() << "\n";
L("ii") = 0;
L("max") = arraylength(N("sem texts"));
L("key") = N("sem texts");
L("val") = N("sem vals");
while (L("ii") < L("max"))
{
"output.txt" << ... |
@PATH _ROOT _XMLDecl
@RULES
_Comment <-
_CommentStart
_xWILD [min=0 max=0 fail=("_CommentEnd" "_CommentEnd" "_DoubleHyphen")]
_CommentEnd
@@
_VersionInfo <-
_whiteSpace [opt]
_xWILD [s trig one matches=("version")]
_whiteSpace [opt]
\=
_whiteSpace [opt]
_PubidLiteral
@@
_VersionInfo <-
_whiteSpace [op... |
@NODES _labelEntry
@POST
AddPhrase(N(2));
"debug.txt" << N("$text", 2) << "\n";
@RULES
_xNIL <-
_xSTART ### (1)
_xWILD [one match=(_xALPHA _xNUM)] ### (2)
@@
|
@NODES _ROOT
# Acronyms/initialisms are all uppercase
@PRE
<1,1> var("upper");
@POST
# Do lookup here.
@RULES
_xNIL <-
_xANY ### (1)
@@
# Abbreviations (Start with cap)
@PRE
<1,1> var("cap");
@POST
# Do lookup here.
@RULES
_xNIL <-
_xANY ### (1)
@@ |
@NODES _ROOT
@RULES
_rest <-
_xWILD [fail=(_td)] ### (1)
@@
|
@CODE
# Find abbrevations in caps
sortchilds(G("caps"));
L("cap") = down(G("caps"));
while (L("cap")) {
L("abr") = GetAbbreviation(conceptname(L("cap")));
if (strval(L("cap"),"type") == "full") {
"abbr.txt" << conceptname(L("cap")) << " => " << L("abr") << "\n";
L("abbr") = down(G("caps"));
... |
@NODES _ROOT
@PRE
<1,1> numrange(1,12);
<3,3> numrange(1,31);
<5,5> numrange(1900,2050);
@POST
S("month") = num(N("$text",1));
S("day") = num(N("$text",3));
S("year") = num(N("$text",5));
single();
@RULES
_date <-
_xNUM ### (1)
_xWILD [match=(\- \/)] ### (2)
_xNUM ### (3)
_xWILD [match=(\- \/)] ### (2... |
@MULTI _ROOT
@CHECK
if (N(1)) {
fail();
}
if (pnname(X()) == "_item") {
fail();
}
@@CHECK
@POST
singler(4,4);
@@POST
@RULES
_endSent <-
_endSent [opt]
_xWILD [one fails=(_endSent)] ### (1)
_xWILD [one fails=(_endSent)]
_xWILD [one trig match=(\. \?)] ### (2)
_xWILD [one match=(_... |
@CODE
L("hello") = 0;
@@CODE
@NODES _TEXTZONE
@POST
if (N("sent end",3))
S("sent end") = N("sent end",3);
if (pnname(N(3)) == "_qEOS")
{
setlookahead(3);
singler(1,2);
}
else # _EOS
singler(1,3); # Include the _EOS node.
@RULES
_sent [unsealed] <-
_xWILD [one fail=(_qEOS \" \( \< \[ _EO... |
@CODE
DisplayKB(G("body"),0);
@@CODE |
@DECL
Spaces(L("num"), L("spaces")) {
while (L("i") < L("num")) {
L("str") = L("str") + L("spaces");
L("i")++;
}
return L("str");
}
@@DECL |
# Invoke a recursive rules pass on nodes that matched the current rule element
@RULES
_tag <- \< _xWILD [passes=(tagrules)]
\> @@ |
@CODE
L("hello") = 0;
@@CODE
@NODES _ROOT
# First paragraph.
@PRE
<4,4> varz("PAR");
@POST
singler(3,4);
@RULES
_TEXTZONE [unsealed] <-
_xSTART
_header
_LINE
_LINE [star]
@@
@PRE
<1,1> var("PAR");
<2,2> varz("PAR");
@RULES
_TEXTZONE [unsealed] <-
_LINE
_LINE [star]
@@
# Excise blank lines.
@POST
excise... |
@CODE
###############################################
# Load KB's, storing references to concepts
# as global variables
###############################################
#Define split to run on here.
G("split") = "rare";
G("mimic_split_codes") = getconcept(findroot(),"mimic_splits");
G("acronyms") = getconcept(find... |
@PATH _ROOT _AttlistDecl
@RULES
_AttType [unsealed] <-
_xWILD [s one matches=("NOTATION")] ### (1)
_whiteSpace [opt] ### (2)
\( [one] ### (3)
_whiteSpace [opt] ### (4)
_xWILD [s one matches=("_xALPHA" "_" ":")] ### (5)
_xWILD [s star matches=("_xALPHA" "_xNUM" "." "-" "_" ":")] ### (6)
_x... |
@CODE
G("words") = getconcept(findroot(),"words");
@@CODE |
# Too general a rule. #
@NODES _LINE
@RULES
_possessive <-
_xALPHA [s]
\' [s]
s [s]
@@
|
@NODES _LINE
@POST
excise(4,5);
excise(1,2);
@RULES
_xNIL <-
\[ ### (1)
\[ ### (2)
_xWILD [plus fail=(\])] ### (3)
\] ### (4)
\] ### (5)
@@
|
@POST
rfaregions(1)
single()
@RULES
_REGIONS [base] <- _REGION [plus] @@
|
@NODES _paragraph
@POST
splice(1,1);
@RULES
_xNIL <-
_LINE ### (1)
@@
|
# Find the root of the kb
G("the root") = findroot(); |
@CODE
if (!G("pretagged"))
exitpass();
@@CODE
@NODES _ROOT
@RULES
_LINE <-
_xWILD [plus fail=(_BLANKLINE _HRULE)]
@@
|
@NODES _LINE
@PRE
<1,1> cap();
<1,1> length(12);
@RULES
# Ex: Publications
_PublicationsHeaderWord [layer=(_headerWord )] <- _xWILD [min=1 max=1 s match=("Publications")] @@
|
@NODES _TEXTZONE
@POST
splice(1,1);
@RULES
_xNIL <-
_headerZone ### (1)
@@
|
@PATH _ROOT _posZone _defZone _definition _headerZone _LINE _item
@POST
L("con") = makeconcept(X("con",3),"text");
addstrval(L("con"),"defText",N("$text",1));
singler(1,1);
@RULES
_text <-
_xWILD [plus fail=(\; _xEND)] ### (1)
\; ### (2)
@@
|
@PATH _ROOT _LINE
# So putting in the check. If calc hasn't been done yet, do it.
@CHECK
# !N("city conf");
if (N("city conf"))
fail();
@POST
# if (!N("len"))
# print out no length.
# Treating confidences independently, but keep track of
# ambiguity in the phrase.
# Need NLP++ looping to add evidence three t... |
@NODES _termEntry
@POST
addConceptPhrase(N(1), X("entry"));
@RULES
_xNIL <-
_base ### (1)
@@
|
@CODE
#Rationals/floats
L("x") = 3;
L("y") = 2;
L("x/y") = L("x") * L("y");
"math_output.txt" << "x=" << L("x") << " * y=" << L("y") << " => " << L("x/y") << "\n";
L("x") = 3.0;
L("y") = 2.0;
L("x/y") = L("x") / L("y");
"math_output.txt" << "x=" << L("x") << " / y=" << L("y") << " => " << L("x/y") << "\n";
L("x") =... |
@NODES _ROOT
@PRE
<1,1> var("word");
<1,1> var("male");
<1,1> varz("female");
@POST
"output.txt" << N("word") << " male\n";
@RULES
_xNIL <-
_LINE ### (1)
@@
|
@PATH _ROOT
@POST
S("x-coordinate") = num(N("$text",2));
S("y-coordinate") = num(N("$text",4));
S("sem") = "location";
single();
@RULES
_coord [layer=_noun] <-
\( [s]
_xNUM [s]
\, [s]
_xNUM [s]
\) [s]
@@
@CHECK
if (N(5) && N("$length",5) != 3)
fail();
if (N("$length",3) != 3)
fail();
@POST
... |
@NODES _sentence
@POST
excise(1,1);
noop();
@RULES
_xNIL <-
_xWHITE [s] ### (1)
@@
|
@CODE
DisplayKB(G("numbers"),0);
@@CODE |
###############################################
# FILE: XML tagStructure.pat #
# SUBJ: Put together segments bounded by #
# XML tags #
# AUTH: Paul Deane #
# CREATED: 14/Jan/01
# DATE OF THIS VERSION: 31/Aug/01 #
# C... |
@NODES _LINE
@POST
excise(1,1);
noop();
@RULES
_xNIL <-
_xWHITE ### (1)
@@
|
@PATH _ROOT _bodyZone _trZone _tdZone
@POST
L("name") = "_" + N("$text",3) + "Close";
group(1,4,L("name"));
@RULES
_xNIL <-
\< ### (1)
\/ ### (2)
strong ### (3)
\> ### (4)
@@
@POST
L("name") = "_" + N("$text",2);
group(1,4,L("name"));
@RULES
_xNIL <-
\< ### (1)
strong ### (2)
_xWILD [fail=(\>)]... |
@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(... |
@PATH _ROOT _LINE _item
@POST
excise(1,1);
noop();
@RULES
_xNIL <-
_xWHITE [s] ### (1)
@@
|
@CODE
L("con") = findconcept(down(G("P_eui")), "E0018490");
L("attr") = findattr(L("con"), "codes");
L("vals") = attrvals(L("attr"));
"nums.txt" << getnumval(L("vals")) << "\n";
@@CODE |
@CODE
L("hello") = 0;
@@CODE
@NODES _sent
# np , vg to vg , vg
# John , trying to work... , left the room...
@CHECK
if (N("pattern",2) != "n")
fail();
if (!N("start to-vg",5))
fail();
@POST
L("vg") = N("vg node",7);
if (L("vg"))
fixvg(L("vg"),"active","VBP");
@RULES
_xNIL <-
_xWILD [one match=(_... |
# Rename con's numth child concept to name.
renamechild(L("con"), L("num"), L("name")); |
@CODE
# LINK TO ALL THE SPECIAL VARIABLES: http://visualtext.org/help/NLP_PP_Stuff/Special_Variables.htm
"output.txt" << "$text: " << pnvar(pnroot(),"$text") << "\n";
"output.txt" << "$treetext: " << pnvar(pnroot(),"$treetext") << "\n";
"output.txt" << "\n";
"output.txt" << "$apppath: " << G("$apppath") << "\n";
"ou... |
@NODES _ROOT
@POST
excise(1,1);
noop();
@RULES
_xNIL <-
_xWHITE [s] ### (1)
@@
|
@NODES _LINE
@POST
if (X("num")) {
L("code1") = ItemValue(N("$text",2));
L("code2") = ItemValue(N("$text",3));
if (L("code1")) {
X("code1") = L("code1");
}
if (L("code2")) {
X("code2") = L("code2");
}
X("indent") = N("indent",4);
}
@RULES
_xNIL <-
_xSTART ### (1)
_item ### (2)
_item ### (3)
_item ### ... |
@NODES _paragraph
@POST
singler(2,2);
@RULES
_endSent <-
_xWILD [s one match=(_xALPHA _xNUM _phrase)] ### (1)
_xWILD [one trig match=(\. \? \!)] ### (2)
_xWILD [one match=(_xWHITE _xALPHA _xNUM _xEND _xCTRL _quote)] ### (3)
@@
|
@PATH _ROOT _LINE _description
@POST
excise(1,1);
noop();
@RULES
_xNIL <-
_xWHITE [s] ### (1)
@@
|
@CODE
L("hello") = 0;
@@CODE
@NODES _TEXTZONE
@POST
if (N("pos num") == 1) # UNAMBIGUOUS PART OF SPEECH.
{
if (N("pos"))
{
G("node") = N(1);
group(1,1,N("pos"));
pncopyvars(G("node"),N(1)); # 12/14/01 AM.
if (!N("sem")) # 01/01/02 AM.
{
if (N("text"))
S("tmp") = N("text... |
@NODES _ROOT
@POST
single() ;
@@POST
@RULES
_XMLDecl <-
_StartXML ### (1)
_xWILD [min=0 max=0 fail=("_EndProcessingInstruction")]
_EndProcessingInstruction ### (3)
@@
_doctypedecl [unsealed] <-
_StartDocType
_whiteSpace [opt]
_xWILD [min=0 max=0 fail=("_EndTag" "[")]
_EndTag
@@
_doctypedecl <-
_Sta... |
@CODE
TakeKB("ICD");
#G("root") = findconcept(findroot(), "ICD");
#rmchildren(G("root"))
#G("icd_p") = findconcept(G("root"),"icd_p");
#if (!G("icd_p")) G("icd_p") = makeconcept(G("root"),"icd_p");
#G("icd_d") = findconcept(G("root"),"icd_d");
#if (!G("icd_d")) G("icd_d") = makeconcept(G("root"),"icd_d");
G("root")... |
@NODES _LINE
@POST
L("word") = N("$text");
L("len") = strlength(L("word"));
while (L("i") < L("len")) {
L("let") = strpiece(L("word"),L("i"),L("i"));
L("x") = "x";
if (striscaps(L("let"))) L("x") = "X";
L("str") = L("str") + L("x");
L("i")++;
}
pnrename(N(1),L("str"));
@RULES
_xNIL <-
_xALPHA
@@ |
@NODES _section
@PRE
<1,7> length(1);
# <3,3> length(1);
# <5,5> length(1);
# <7,7> length(1);
@RULES
_abbr <-
_xALPHA ### (1)
\. ### (2)
_xALPHA ### (3)
\. ### (4)
_xALPHA [opt] ### (5)
\. [opt] ### (6)
_xALPHA [opt] ### (7)
\. [opt] ### (8)
@@
|
@CODE
L("match") = down(G("matches"));
while (L("match")) {
L("code") = findconcept(G("codes"),conceptname(L("match")));
if (L("code")) {
L("match count") = ChildCount(L("match"));
L("code count") = ChildCount(L("code"));
L("percent") = 100*L("match count")/L("code count");
"pe... |
@CODE
G("iso") = getconcept(findroot(),"iso");
G("countries") = getconcept(findroot(),"countries");
@@CODE |
# Open a 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";
else
"out... |
@NODES _abstract
@POST
if (N("ref type") == "eq") {
L("number") = getEquationNumber(N("ref"));
"output.txt" << L("number");
} else {
"output.txt" << " <xr id=\"" << N("full") << "\"/> ";
}
@RULES
_xNIL <-
_ref ### (1)
@@
@POST
L("body") = getRefereceBody(N("cite"));
"output.txt" << " <ref>" << L... |
@DECL
########
# FUNC: DICTATTR
# SUBJ: Add attribute for dictionary word.
########
dictattr(L("str"),L("attr"),L("val"))
{
if (!L("str") || !L("attr"))
return;
L("str") = strtolower(L("str"));
L("con") = dictgetword(L("str"));
replaceval(L("con"),L("attr"),L("val"));
}
########
# FUNC: FINDDICTATTR
# SUBJ: Add att... |
@CODE
# A global threshold for confidence in a category.
#var("threshold", 70) # Minimum is 70%
G("threshold") = 70;
# Moved here. #
@@CODE
@NODES _ROOT
@RULES
_BLANKLINE <- _xWILD [min=0 max=0 matches=(\ \r \t)] \n @@
# Just whitespace.
#_LINE <- _xWILD [min=0 max=0 fails=(\r \n \t)] \n @@
_LINE [unsealed] <- _... |
@NODES _LINE
@PRE
<1,1> cap();
<1,1> length(6);
@RULES
# Ex: Skills
_SkillsHeaderWord [layer=(_headerWord )] <- _xWILD [min=1 max=1 s match=("Skills")] @@
|
@NODES _ROOT
@POST
prlit("ctc.txt", "CONTACT ZONE\n");
prlit("ctc.txt", "------------\n");
ndump("ctc.txt",1);
prlit("ctc.txt", "\n");
@RULES
_xNIL <- _contactZone @@
|
@DECL
printblurb(L("out"))
{
L("out") << "*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*\n";
L("out") << "*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*\n";
L("out") << "*x* *x*\n";
L("out") <<... |
# Make concept under given parent concept. Optionally as the numth child of the parent. num==0 or absent places concept at end of list of children. name is the name of new concept.
L("return_con") = makeconcept(L("parent"), L("name"), L("num")); |
@PATH _ROOT _headerZone _conjugationGroup _catGroup _liGroup
@POST
G("file") << G("verb") << " \"" << X("title",3) << "\" " << N("text",1) << " " << N("text",2) << " " << N("text",3) << "\n";
@RULES
_xNIL <-
_iGroup ### (1)
_iGroup ### (2)
_hiGroup [look] ### (3)
@@
@POST
G("file") << G("verb") << " \"" << ... |
@NODES _ROOT
@PRE
<1,1> vareq("num",0);
@POST
G("word") = N("$text",1);
"word.txt" << N("$text",1) << "\n";
@RULES
_xNIL <-
_LINE ### (1)
@@
|
###################################################
# FILE: lines.pat
# SUBJ: Gather Lines
# CREATED: 10/Mar/99
# Date of this version: 31/Aug/01
# Copyright
###################################################
@NODES _ROOT
@RULES
_BLANKLINE <-
_xWILD [min=0 max=0 matches=(\ \t \r)] ### (1)
\n ### (2)
@... |
@PATH _ROOT _experienceZone _LINE
@POST
S("len") = 1; # One cap in list.
single()
@RULES
# With [s], BASE is needed to prevent infinite loop in REC pass!
# Making this unsealed so we can gather data within _Caps later.
# (May not be needed.)
_Caps [base unsealed] <- _xCAP [s] @@
_Caps [base unsealed] <- _educatio... |
@PATH _ROOT _posZone _defZone _definition _headerZone _LINE
@POST
addstrval(X("con",6),"text",N("text",1));
@RULES
_xNIL <-
_item ### (1)
@@ |
# Sort the strings in multi-string-valued global variable varname
@CODE
G("xx") = "abacus";
G("xx")[1] = "aardvark";
sortvals("xx");
"output.txt" << G("xx") << "\n"; |
#@NODES _ROOT
@PATH _ROOT
@RULES
_REZZONE [unsealed] <- _xWILD [plus fail=(
_contactBoundary
_objectiveBoundary
_educationBoundary
_experienceBoundary
_skillsBoundary
_presentationsBoundary
_publicationsBoundary
_referencesBoundary
_otherBoundary
)] @@
|
@CODE
# rmchildren(findroot());
G("level_1_con") = makeconcept(findroot(),"level_1_con");
G("level_1_words") = addstrval(G("level_1_con"), "words", "Space separated string 1.");
# G("level_1_num") = addnumval(G("level_1_con"), "num", 1);
# G("level_1_word") = addstrval(G("level_1_con"), "word", "one");
G("level_2_co... |
@CODE
if (!G("pretagged"))
exitpass();
@@CODE
@PATH _ROOT _LINE _pos _tok
@POST
lookupword(N(1));
@RULES
_xNIL <-
_xALPHA
@@
|
@CODE
DisplayKB(G("kb"),0);
@@CODE |
@CODE
DisplayKB(G("people"),2);
@@CODE |
@NODES _ROOT
@PRE
<1,1> var("con");
<3,3> var("con");
@POST
L("con") = PathToConcept(G("kb"),N("$text",1));
addstrval(L("con"),N("con",3),N("con",5));
@RULES
_xNIL <-
_LINE ### (1)
_LINE ### (2)
_LINE ### (3)
_LINE ### (4)
_LINE ### (5)
@@
|
@NODES _ROOT
@RULES
_BLANKLINE <-
_xWILD [min=0 max=0 matches=(\ \t \r)] ### (1)
\n ### (2)
@@
@POST
S("num") = G("line number")++;
S("text") = N("$text",1);
single();
@RULES
_LINE <-
_xWILD [min=0 max=0 fails=(\r \n)] ### (1)
_xWILD [one match=(\n _xEND)] ### (2)
@@
|
# Create a dump file of knowledge base concept.
kbdumptree(L("root_con"), L("file_str")); |
@CODE
SaveKB("iso-countries.kbb",G("iso"),2);
sortchilds(G("countries"));
DisplayKB(G("countries"),2);
L("con") = down(G("countries"));
"countries.dict" << "# Country names in English\n";
while (L("con")) {
L("country") = strtolower(conceptname(L("con")));
"countries.dict" << L("country") << " country=1";
L("fu... |
@NODES _LINE
@RULES
# Ex: "University of XXX (XXX), -> _SchoolNamePhrase"
_SchoolNamePhrase [sealed] <-
_SchoolNamePhrase [s]
_xWHITE [star s]
_xWILD [min=1 max=1 s match=(for of) ]
_xWHITE [star s]
_xWILD [s opt match=(the)]
_xWHITE [s star]
_xALPHA [s]
_xWHITE [star s]
_xWILD [opt s fails=( _xPUN... |
@PATH _ROOT _paragraph _sentence
###############################################
# Gal Luft, 57,
###############################################
@PRE
<3,3> var("age");
@POST
S("con") = AddPerson(N(1),0);
addnumval(S("con"),"age",num(N("$text",3)));
single();
@RULES
_person <-
_xWILD [one match=(_person _titleCaps)... |
@NODES _LINE
@PRE
<1,1> cap();
@RULES
# Ex: Northeastern
_adjDirection <- _xWILD [min=1 max=1 s match=("Northeastern" "Southern" "Eastern" "Western" "Northern" "Northwestern" "Southeastern" "Southwestern" "Central")] @@
|
@CODE
# If found new sentence breaks, do this pass.
if (!G("eos"))
exitpass();
@@CODE
@NODES _TEXTZONE
@CHECK
if (!N("eos"))
fail();
@RULES
_EOS <-
_xANY
@@
|
@PATH _ROOT _paragraph _sentence
@POST
S("stock") = makeconcept(N("object",1),"stock");
addstrval(S("stock"),"action",N("$text",4));
addstrval(S("stock"),"percent",N("$text",5));
addnumval(S("stock"),"from",num(N("value",7)));
addnumval(S("stock"),"to",num(N("value",9)));
single();
@RULES
_event <-
_compan... |
@DECL
DictionaryStart() {
G("dict path") = G("$apppath") + "\\kb\\user\\all.dict";
G("dict") = openfile(G("dict path"));
}
DictionaryWord(L("word"),L("attrName"),L("value"),L("attrType")) {
G("dict") << L("word") << " " << L("attrName") << "=" << L("value") << "\n";
}
DictionaryEnd() {
closefile(G("dict"));
}
... |
@NODES _ROOT
@POST
"end.txt" << N("$text", 1) << "\n";
noop();
@RULES
_xNIL <-
_xWILD [fails=( \n _xEND)] ### (1)
_xWILD ### (2)
@@
|
@PATH _ROOT _headerZone
@PRE
<1,1> var("pos");
@POST
G("vocab") << G("word") << " pos=" << N("pos");
@RULES
_xNIL <-
_headerZone ### (1)
@@
|
@PATH _ROOT _paragraph _sentence
@RULES
_anaphora <-
_pro [s] ### (1)
@@
@POST
pncopyvars();
single();
@RULES
_anaphora <-
_det [s optional] ### (1)
_adj [s star] ### (2)
_buyEvent [s] ### (3)
@@ |
@CODE
L("f") = "math.txt";
# L("sqrt") = sqrt(9);
# L("pow") = pow(3,3);
# L("max") = max(5,4);
# L("min") = min(5,4);
L("f") << "Square root 9: " << L("sqrt") << "\n";
L("f") << "3 squared: " << L("pow") << "\n";
L("f") << "max(5,4): " << L("min") << "\n";
L("f") << "min(5,4): " << L("min") << "\n";
@@CODE |
@CODE
L("hello") = 0;
@@CODE
@PATH _ROOT
@PRE
<2,2> varz("NL");
<3,3> var("NL"); # The newline-before-me attribute.
@POST
if (N("NL",1) > 1)
{
++X("PARS"); # Count potential paragraphs.
++S("PAR");
}
singler(1,2);
@RULES
_LINE [unsealed] <-
_xANY
_xWILD [star fail=(_dummy)]
_xANY [opt lookahead]
@@
|
@CODE
L("hello") = 0;
@@CODE
#@PATH _ROOT _TEXTZONE _tok
@NODES _tok
# num - year - old
# alpha - alpha - alpha
@CHECK
if (X("hyphenated"))
fail();
@POST
X("hyphenated") = 1;
X("pos_np") = "JJ"; # Default. # 06/07/06 AM.
xrename("_adj");
X("num-year-old") = 1;
@RULES
_xNIL <-
_xSTART
_xWILD [plus mat... |
@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 [plus fails=(_break _xEND)] ### (3)
# _xWILD [one matches=(_break _xEND)] ### (4)
@@
# @POST
# excise(1,1);... |
@NODES _LINE
@POST
group(4,4,"_description");
group(2,2,"_code");
@RULES
_xNIL <-
_indent ### (1)
_xWILD [fail=(_xWHITE)] ### (2)
_xWHITE ### (3)
_xWILD [fail=(_xEND)] ### (4)
_xEND ### (5)
@@
|
# Pre action that succeeds if leaf token has capitalized first letter
@PRE
<1,1>cap();
@RULES
_noun <- _xALPHA@@ |
@NODES _LINE
@RULES
_comma <-
\, ### (1)
@@
|
@PATH _ROOT _doctypedecl _EntityDecl
@POST
if (N("$text",4))
S("buffer1") = str(N("$text",4)) ;
if (N("$text",5))
S("buffer2") = str(N("$text",5)) ;
if (S("buffer1") && S("buffer2")) {
S("EntityName") = S("buffer1") + S("buffer2") ;
}
else if (S("buffer1"))
S("EntityName") = S("buffer1") ;
else if (S("... |
@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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.