text stringlengths 22 301k |
|---|
# Replace the values of an attribute. There are three variants of replaceval, one each for replacing the value of a concept concept's attribute named attrNameStr with either integer valueInt, string valueString or concept values valueConcept
@CODE
if(findconcept(findroot(),"apples"))
rmconcept(findconcept(findroot(),"... |
@NODES _ROOT
@RULES
_BLANKLINE <-
\n ### (1)
\n ### (2)
@@
@RULES
_NEWLINE <-
\n ### (1)
@@
|
@NODES _NLPPP
@RULES
# NLP++ KEYWORDS. #
_IF [base] <- if [s] @@
_ELSE [base] <- else [s] @@
_WHILE [base] <- while [s] @@ # 08/31/00 AM.
_RETURN [base] <- return [s] @@ # 03/07/02 AM.
# @POST
# rfavar(1, 2)
# single()
# @RULES
# _VAR [layer=(_EXPR)] <- _xWILD [s one match=( s G N X P )]
# _LIST
# @@
# FUNC... |
@CODE
prlit("zdump.txt", "\nCharacterizing General Cap Phrases\n");
prlit("zdump.txt", "----------------------------------\n");
@@CODE
@PATH _ROOT _LINE
@POST
ndump("zdump.txt",1);
prlit("zdump.txt", "-------\n");
@RULES
_xNIL <- _Caps @@
|
@CODE
if (!G("unhandled periods"))
exitpass();
@@CODE
@NODES _TEXTZONE
@POST
listadd(5,6,"false");
@RULES
_xNIL <-
_qEOS
_xWHITE [star]
_xCAP [s]
_xWHITE [star]
_letabbr
\.
@@
# Rearguard.
@POST
++G("unhandled periods");
if (G("error"))
"err.txt" << "[Unhandled period]" << "\n";
L("n") = N(1);
... |
# Move a concept childConcept after next sibling (Moves the concept to the 'right' or 'lower' in the pecking order.)
@CODE
"output.txt" << "move\n";
G("alpha") = makeconcept(findroot(),"first");
G("beta") = makeconcept(findroot(),"second");
G("gamma") = makeconcept(findroot(),"third");
movecleft(G("gamma"));
movecrig... |
@CODE
if (!G("pretagged"))
exitpass();
@@CODE
@PATH _ROOT _LINE
# NON-special chars.
@POST
excise(1,1);
@RULES
_xNIL <-
\\
\/
@@
_xNIL <-
\\
\|
@@
# Else, special chars.
@POST
singlex(2,2);
@RULES
_slash <-
\/
_xWILD [plus fail=(_xWHITE)]
@@
@POST
excise(1,1);
@RULES
_xNIL <-
\[
@@
_xNIL <-
\]... |
# Get each component directory of the current input file path
G("array") = unpackdirs(G("$input"));
"output.txt" << "file=" << G("$input") << "\n";
"output.txt" << "dirs=" << G("array") << "\n";
"output.txt" << "split=" << split(G("$input"),"\\") << "\n";
|
# Send output to user-supplied buffer
@CODE
# In VisualText, output to a file. Outside VisualText, output to user-supplied buffer.
if (interactive())
G("out") = "buf.txt";
else
G("out") = cbuf();
G("out") << "Hello output buffer!" << "\n";
@@CODE |
@NODES _ROOT
@POST
addstrval(N("con",3),"comment",N("text",1));
if (N(2))
addstrval(N("con",3),"comment",N("text",2));
@RULES
_xNIL <-
_comment ### (1)
_comment [opt] ### (2)
_pos ### (3)
@@
|
@NODES _ROOT
@RULES
_BLANKLINE <-
_xWILD [min=0 max=0 matches=(\ \t \r)] ### (1)
\n ### (2)
@@
@POST
S("num") = G("line")++;
single();
@RULES
_LINE <-
_xWILD [min=0 max=0 fails=(\r \n)] ### (1)
_xWILD [one match=(\n _xEND)] ### (2)
@@
|
@NODES _ROOT
@RULES
_paragraph <-
_xWILD [plus match=(_LINE)] ### (1)
@@
|
@NODES _LINE
# ex. English Major
@POST
singlex(1,1);
@RULES
_RealMajor <- _major
_xWHITE [s]
_xWILD [s one matches = ( major ) ]@@
@POST
singlex(3,3);
# ex. "major English"
@RULES
_RealMajor <- _xWILD [s one matches = ( majored major ) ]
_xWHITE [s]
_major @@
# ex. "major in English"
@POST
singlex(... |
@NODES _ROOT
@PRE
<3,3> var("lang");
<5,5> var("ps");
@RULES
_lang <-
\{ ### (1)
\{ ### (2)
_xALPHA ### (3)
\- ### (4)
_xALPHA ### (5)
_xWILD [fail=(\})] ### (6)
\} ### (7)
\} ### (8)
@@
@RULES
_curly <-
\{ ### (1)
\{ ### (2)
_xWILD... |
@CODE
prlit("output.txt","\n");
prlit("output.txt","EDUCATION:\n\n");
@@CODE
@PATH _ROOT _educationZone
# Not sure what to require yet. #
# @CHECK
# Require the instance to have a daterange.
# N("date range",1);
@POST
if (N("date"))
{
"output.txt"
<< LJ("Date:",G("indent"))
<< N("date",1)
<< "\n";
}
if (N("sc... |
@NODES _LINE
@RULES
# Ex: what
_posDET [layer=(_funWORD )] <- _xWILD [min=1 max=1 s match=("what" "an" "the" "my" "our" "your" "his" "her" "its"
"their" "no" "whose" "which" "whichever" "a" "whatever" "some" "any" "enough"
"this" "that" "these" "those" "every" "each" "either" "neither" "much")] @@
|
@PATH _ROOT _posZone _partofspeech _headerZone
@POST
addstrval(X("con",2),"pos",N("$text",3));
@RULES
_xNIL <-
_xSTART ### (1)
_LINE ### (2)
_LINE ### (3)
@@
|
@PATH _ROOT _pronunciations _headerZone _LINE
@POST
addstrval(X("pronunciation",2),"phonemic",N("$text",3));
"debug.txt" << N("$text",1) << "\n";
@RULES
_xNIL <-
_phonetic ### (1)
_xWILD [fail=(_phonemic)] ### (2)
_phonemic ### (3)
@@
|
@CODE
if (G("$islastfile")) {
KBDump();
DisplayKB(G("stats"),1);
DisplayKB(G("words"),1);
G("debug") << "Conjugations: " << str(G("conju")) << "\n";
}
closefile(G("debug"));
@@CODE |
@CODE
G("filepath") = G("$kbpath") + "\\" + "en-surnames.dict";
L("type") = "app";
if (!G("$isdirrun") || G("$isfirstfile"))
G("file") = openfile(G("filepath"));
else
G("file") = openfile(G("filepath"),"app");
@@CODE |
@CODE
if (!G("pretagged"))
exitpass();
posacctdump();
if (G("mismatch out"))
closefile(G("mismatch out"));
if (G("zero out"))
closefile(G("zero out"));
# Get current doc score.
L("currgood") = numval(G("scorepos"),"currgood");
L("currtot") = numval(G("scorepos"),"currtot");
if (!L("currtot"))
{
"err.txt... |
@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 _LINE
@RULES
_conj <-
_xWILD [one match=(\,)]
@@
|
@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=(\")]
@@
|
# Fetch the first node in phrase.
L("return_con") = firstnode(L("phrase")); |
@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... |
@PATH _ROOT _AttlistDecl
@RULES
_DefaultDecl <-
\# [one] ### (1)
_xWILD [s one matches=("REQUIRED" "IMPLIED")] ### (2)
@@
_DefaultDecl <-
\# [one] ### (1)
_xWILD [s one matches=("FIXED")] ### (2)
_whiteSpace [opt] ### (3)
_PERefence [one] ### (4)
@@
_DefaultDecl <-
\# [one] ##... |
@CODE
DictionaryEnd();
@@CODE |
###############################################
# FILE: XML SubSchema.pat #
# SUBJ: Put together the major blocks of an #
# XML Document #
# AUTH: Paul Deane #
# CREATED: 14/Jan/01
# DATE OF THIS VERSION: 31/Aug/01 #
# C... |
@NODES _LINE
@POST
S("two") = strtolower(N("$text",1));
S("three") = strtolower(N("$text",2));
S("num") = strtolower(N("$text",3));
single();
@RULES
_codes <-
_xALPHA ### (1)
_xALPHA ### (2)
_xNUM ### (3)
_xEND ### (4)
@@
|
@MULTI _ROOT
@POST
excise(1,1);
noop();
@RULES
_xNIL <-
_xWHITE [s] ### (1)
@@
|
@NODES _LINE
@CHECK
"debug.txt" << "Checking on " << N("$text", 1) << "\n";
if (IsPOS(N(1), "prep") && N("$text", 2)) {
succeed();
}
fail();
@@CHECK
@POST
# Add prepositional object as attribute
L("text") = N("$text",2);
addstrval(X("con"), "prep_phrase", L("text"));
# Add noun/adjs/conjs before preposition
L("pre... |
@NODES _LINE
@RULES
_major <- ADULT _xWHITE EDUCATION @@
_major <- AERONAUTICAL _xWHITE ENGINEERING @@
_major <- AEROSPACE _xWHITE ENGINEERING @@
_major <- AFRICAN _xWHITE STUDIES @@
_major <- AFRO-AMERICAN _xWHITE STUDIES @@
_major <- AGRICULTURAL _xWHITE COMMUNICATIONS @@
_major <- AGRICULTURAL _xWHITE... |
@CODE
if (G("pretagged"))
exitpass();
if (!G("hilite")) # 10/25/10 AM.
exitpass(); # 10/25/10 AM.
G("hello") = 0;
@@CODE
# Traverse the whole tree.
@MULTI _ROOT
@PRE
<1,1> var("ne"); # FEATURE-BASED MATCH IN NLP++ ! 6/16/05 AM.
@POST
if (G("verbose"))
"multi.txt" << pnname(N(1)) << "\t" << phrasetext() <<... |
@PATH _ROOT _educationZone _educationInstance _LINE
# If higher conf stuff hasn't filled education instance yet, try
# some stuff in here.
# If there's an unclaimed turd to the left, glom it in!
# Should have constraints on that turd. If end of it can relate
# to start of head phrase, so much the better. etc. etc.
... |
@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... |
@PATH _ROOT _paragraph _sentence
@POST
if (!N("normal"))
N("normal") = N("$text");
N("object") = makeconcept(X("object"),N("$text"));
addstrval(N("object"),"type","company");
addstrval(N("object"),"normal",N("normal"));
@RULES
_xNIL <-
_company [s] ### (1)
@@
|
# Create a new directory
@CODE
mkdir("c:\abc\myfolder"); # This will work on Windows OS even if abc doesn't exist.
@@CODE |
@NODES _LINE
@PRE
<1,1> cap()
@RULES
_CompleteSchoolName <- _xWILD [s one matches=(
MIT
SJSU
UCLA
USC
UCSB
UCSD
UCSC
URI
UMASS
SUNY
CALTECH
Citadel
USNA
USMA
USAFA
SMU
LACC
CSU
UNSW
)] @@
|
@NODES _term
@POST
excise(1,1);
@RULES
_xNIL <-
_xWILD [matches=(\n \r \")]
@@
@POST
excise(2,2);
@RULES
_xNIL <-
_xWILD [one matches=(_xWHITE)]
_xWILD [plus matches=(_xWHITE)]
@@ |
@NODES _ROOT
@RULES
_EmptyTag <-
\< [one] ### (1)
_xWILD [s one matches=("_xALPHA" "_" ":")] ### (2)
_xWILD [s star matches=("_xALPHA" "_xNUM" "." "-" "_" ":")] ### (3)
_whiteSpace [opt] ### (4)
_xWILD [star fails=("_EndEmptyTag" "_EndTag")] ### (5)
_EndEmptyTag [one] ### (6)
@@
@@RULES
... |
@PATH _ROOT _columnHeaders
@POST
# Add column attributes for each concept in KB here
L("tempCon") = down(findconcept(findroot(),"RadLex"));
while ( L("tempCon") ) {
addattr(L("tempCon"), N("$text", 1));
L("tempCon") = next(L("tempCon"));
}
excise(2,2);
singler(1,1);
@RULES
_columnName <-
_xWILD [fails=(\t \n)] ... |
@NODES _ROOT
@PRE
<1,1> uppercase();
@POST
S("header") = N("$text", 1) + N("$treetext", 2);
single();
@RULES
_zoneHeader <-
_xALPHA [plus fails=(REFERRING CM MM _xCAPLET)] ### (1)
@@ |
@NODES _LINE
@PRE
<1,1> cap();
<5,5> cap();
@RULES
# Ex: Master's\_Project
_Thesis [layer=(_Caps )] <- Master [s] \' [s] s [s] _xWHITE [star s] Project [s] @@
# Ex: Master's\_Thesis
_Thesis [layer=(_Caps )] <- Master [s] \' [s] s [s] _xWHITE [star s] Thesis [s] @@
# Ex: Master's\_Work
_Thesis [layer=(_Caps )] <- Ma... |
@NODES _LINE
@POST
N("text") = N("$treetext");
@RULES
_xNIL <-
_item ### (1)
@@
|
@PATH _ROOT _headerZone
@POST
if (N("attr",1) == "class") {
S("text") = N("$text",2);
single();
}
@RULES
_iGroup <-
_iOpen ### (1)
_xWILD [fail=(_iOpen _iClose)] ### (2)
_iClose ### (3)
@@
#@POST
#S("text") = N("$text",3);
#singler(2,4);
#@RULES
#_iGroup <-
# _liOpen ### (1)
# _iOpen ... |
@CODE
L("hello") = 0;
@@CODE
@NODES _ROOT
@RULES
_xNIL <-
_xNIL ### (1)
@@
|
# show how we can create a concept like noun and assign it as the value of a word's attribute. We create the concepts named words and noun as children to the root of the KB (concept), and then make the concept book a child of words
G("words") = makeconcept(findroot(), "words");
G("noun") = makeconcept(findroot(),"nou... |
@NODES _section
@POST
S("subsection") = N("$text", 2);
excise(4,4);
singler(2,3);
@RULES
_subsection <-
_xWILD [one matches=(_xPUNCT _xSTART)] ### (1)
_xWILD [one matches=(_patientID _xCAP)]
_xWILD [min=0 max=3 match=(_xCAP _xNUM)]
\:
@@
|
@CODE
"output.txt" << "\n==References==\n<references />\n";
@@CODE
|
# Match a _verb node optionally preceded by _modal, _have, or _be nodes, reducing to _vgroup
@RULES
_vgroup <- _modal [o]
_have [o] _be [o]
_verb @@ |
@NODES _LINE
@RULES
_dateBoundary <-
_xWILD [s one matches=(_SingleDate _DateRange)] @@
#_dateBoundary <- _xWILD [s one matches=(_date _dateRange)] @@
|
@NODES _LINE
@RULES
# Ex: a.\_s.
_companyRoot <- a [s] \. [s] _xWHITE [star s] s [s] \. [s] @@
# Ex: a/s
_companyRoot <- a [s] \/ [s] s [s] @@
# Ex: co.
_companyRoot <- co [s] \. [s] @@
# Ex: corp.
_companyRoot <- corp [s] \. [s] @@
# Ex: cos.
_companyRoot <- cos [s] \. [s] @@
# Ex: inc.
_companyRoot <- inc [s] ... |
@CODE
G("icd_hier") = getconcept(findroot(),"icd_hier");
if (! G("icd_hier")) {
G("icd_hier") = makeconcept(findroot(),"icd_hier");
}
rmchildren(G("icd_hier"));
@@CODE |
@DECL
IsHex(L("string")) {
L("len") = strlength(L("string"));
L("i") = 0;
while (L("i") < L("len")) {
L("c") = strpiece(L("string"),L("i"),L("i"));
if (!strcontainsnocase(L("c"),"abcdef") && !strcontainsnocase(L("c"),"1234567890")) {
"letters.txt" << " NOT HEX\n";
r... |
@PATH _ROOT _educationZone _LINE
@CHECK
if (
(N("hi class") == "school")
&& (N("hi conf") >= G("threshold"))
)
succeed();
fail();
@POST
noop();
@RULES
#_school <- _Caps @@ #
_xNIL <- _Caps [rename=(_school)] @@
@CHECK
if (
(N("hi class") == "minor")
&& (N("hi conf") >= G("threshold"))
... |
@NODES _ROOT
@PRE
<1,1> var("bases");
@POST
# Check for section or subsection title.
"extract_codes.txt" << "Beginning code extraction step." << ":\n";
L("section_title") = N("section_title", 1);
L("subsection_title") = N("subsection", 1);
G("line_count") = G("line_count") + 1;
L("section") = getconcept(G("note_word... |
@NODES _LINE
@PRE
<3,3> cap();
@POST
S("daySD") = N("$text", 1);;
S("monthSD") = N("$text", 3);;
S("yearSD") = N("$text", 7);;
single();
@RULES
# Ex: 3\_Sept.,\_99
_SingleDate <- _xNUM [s layer=("_daySD")] _xWHITE [star s] _monthWord [trig s layer=("_monthSD")] \. [s] \, [s] _xWHITE [star s] _year [s layer=("_yea... |
# Fetch the first 10 characters of the input text as a string
G("str") = inputrange(0,9); #
Fetch the first 10 characters of the input text as a string. |
@CODE
fileout("output.xml");
prlit("output.xml", "<?xml version=\"1.0\" ?>\n");
prlit("output.xml", "<BizTalk xmlns=\"urn:schemas-biztalk-org/biztalk-0.81.xml\">\n");
prlit("output.xml", "<Body>\n");
prlit("output.xml", "<CandidateProfile xmlns=\"urn:schemas-biztalk-org:HR-XML-org/CandidateProfile\">\n");
@@CODE
#N("... |
# Count the occurrences of a character in a string
G("count") = strchrcount("abcabc","b");
# This should evaluate to 2, for the two occurrences of "b"
in "abcabc". |
# Fetch number from numeric VAL.
L("return_int") = getnumval(L("val")); |
@NODES _LINE
@PRE
<1,1> cap();
@RULES
# Ex: Department
_subOrg <- _xWILD [min=1 max=1 s match=("Department" "Section" "Project" "Office" "Branch" "Division")] @@
|
@NODES _term
@POST
AddPhrase(N(2));
"debug.txt" << N("$text", 2) << "\n";
@RULES
_xNIL <-
_xSTART ### (1)
_xWILD [one match=(_xALPHA _xNUM)] ### (2)
@@
|
@DECL
AddPhrase(L("node")) {
L("con") = G("phrases");
while (L("node")) {
L("text") = pnvar(L("node"), "$text");
L("con") = AddUniqueCon(L("con"), L("text"));
L("node") = pnnext(L("node"));
if (!L("node")) {
makeconcept(L("con"), "00000");
}
}
}
AddDictionaryWord(L("node")) {
DictionaryWord(pnvar(... |
@NODES _ROOT
@RULES
_prep <-
_prep ### (1)
_np ### (2)
@@
|
@PATH _ROOT _posZone _defZone _definition _headerZone _LINE _item
@POST
L("con") = MakeCountCon(X("con",3),"variation");
addstrval(L("con"),"text",N("$text",2));
singler(2,2);
@RULES
_variation <-
\; ### (1)
_xWILD [plus fail=(\; । _xEND)] ### (2)
@@ |
@CODE
G("hello") = 0;
@@CODE
@NODES _TEXTZONE
@CHECK
if (!N("ne type",1))
fail();
@POST
L("tmp2") = N(2);
if (!N(3))
L("one") = 1;
group(2,3,"_caps");
group(2,2,"_noun");
if (L("one"))
pncopyvars(L("tmp2"),N(2));
N("sem",2) = "name";
N("ne",2) = 1;
N("ne type",2) = N("ne type",1);
N("... |
@NODES _LINE
@RULES
_field <-
_xWILD [s matches=(_fieldName _field)]
_xWHITE [s]
_xWILD [s matches=(_fieldName _field)]
_xWHITE [s star]
_xWILD [s opt matches=(_fieldName _field)]@@ |
@NODES _LINE
@RULES
# Ex: summer
_Season <- _xWILD [min=1 max=1 s match=("summer" "winter" "fall" "spring")] @@
|
@CODE
DictionaryClear();
@@CODE |
@CODE
if (!G("verbose"))
exitpass();
#L("dir") = G("$apppath") + "\\data\\ne";
#mkdir(L("dir"));
#L("fname") = L("dir") + "\\" + G("$inputname");
#G("kout") = openfile(L("fname"));
G("kout") = "clause_ne.txt";
G("kout") << "PART SEM STEM NE_TEXT ALL_TEXT" << "\n"
<< "============... |
@NODES _section
@PRE
<1,7> length(1);
@RULES
_abbr <-
_xALPHA ### (1)
\. ### (2)
_xALPHA ### (3)
\. ### (4)
_xALPHA [opt] ### (5)
\. [opt] ### (6)
_xALPHA [opt] ### (7)
\. [opt] ### (8)
@@
|
@NODES _td
@POST L("node") = pnnext(pnup(N(1)));pnrename(L("node"),"_abbrev");@RULES _info <- state abbreviation @@
@POST L("node") = pnnext(pnup(N(1)));pnrename(L("node"),"_capital");@RULES _xNIL <- state capital @@
@POST L("node") = pnnext(pnup(N(1)));pnrename(L("node"),"_numCounties");@RULES _xNIL <- number of cou... |
@PATH _ROOT _LINE
# Adding some semantics here, etc. #
# Seen this a few times even in Dev1. #
# Cumulative GPA 4.7 on a weighted 4.0 scale.
# Cumulative GPA 4.01 on 4.0 scale.
@POST
if (N("major gpa",1))
S("major grade") = N("$text",6);
else if (N("minor gpa",1))
S("minor grade") = N("$text",6);
else
S("g... |
@NODES _LINE
@POST
S("text",2) = N("$text",2);
singler(2,2);
@RULES
_item <-
\# ### (1)
_xWILD [plus fail=(_xEND)] ### (2)
@@
|
@CODE
L("hello") = 0;
@@CODE
#@PATH _ROOT _TEXTZONE _sent _clause
@NODES _clause
@POST
L("x3") = pnparent(X()); # _sent # 07/10/12 AM.
X("last chunk") = "v";
++X("vg count");
++X("vg count",3); # Count in sentence also. # 01/07/05 AM.
L("cc") = num(pnvar(L("x3"),"vg count")); # 07/07/12 AM.
pnreplaceval(L("... |
@PATH _ROOT _headerZone
@POST
if (N("header")) {
L("node name") = "_" + N("header");
pnrename(N(1),L("node name"));
}
@RULES
_xNIL <-
_headerZone ### (1)
@@
@POST
if (N("header")) {
pnrename(N(1),"_Person");
}
@RULES
_xNIL <-
_header ### (1)
@@ |
@NODES _LINE
@POST
S("len") = 2;
single();
@RULES
_saintName [layer=(_Caps)] <-
St [s]
\.
_xWHITE
_saintName [s]
@@
_saintName [layer=(_Caps)] <-
Saint
_xWHITE
_saintName [s]
@@
|
@PATH _ROOT _AttlistDecl
@RULES
_DefaultDecl <-
\# [one] ### (1)
_xWILD [s one matches=("REQUIRED" "IMPLIED")] ### (2)
@@
_DefaultDecl <-
\# [one] ### (1)
_xWILD [s one matches=("FIXED")] ### (2)
_whiteSpace [opt] ### (3)
_PERefence [one] ### (4)
@@
_DefaultDecl <-
\# [one] ##... |
@CODE
DisplayKB(G("terms"), 1);
#DumpKB(G("terms"), "terms");
@@CODE |
@MULTI _ROOT _section _looseText _sentence _subsection _item
@PRE
<1,1> var("keyword");
@POST
L("parent_keys") = pnvar(X(), "key_words");
if (L("parent_keys")) {
pnrpushval(X(), "key_words", N("$text", 1));
}
else {
X("key_words") = N("$text", 1);
}
# pnmakevars()
# # X("keyword") = varinlist("keyword", 2);
# noo... |
@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... |
###############################################
# 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 _LINE
@PRE
<1,1> cap();
<1,1> length(5);
<3,3> cap();
<3,3> length(5);
@RULES
# Ex: Brent\_Biggs
_humanname <- Brent [s layer=("_firstname")] _xWHITE [star s] Biggs [s layer=("_lastname")] @@
|
@CODE
L("hello") = 0;
@@CODE
@NODES _LINE
# Looking for numbered lines.
@POST
N("nopos",3) = 1;
L("num") = num(N("$text",2));
if (!G("num lines"))
{
if (L("num") == 1)
G("num lines") = 1;
xrename("_TEXTZONE");
}
else if (
(L("num") == G("num lines"))
|| (L("num") == G("num lines") + 1) )
... |
@CODE
if (!G("pretagged"))
exitpass();
@@CODE
@PATH _ROOT _LINE
@POST
excise(1,1);
@RULES
_xNIL <-
_xWHITE [plus]
@@
@RULES
_pos <-
_xWILD [fail=(_slash _xWHITE) gp=_text]
_slash
@@
@POST
if (G("error"))
"err.txt" << "[Bad tagging: " << phrasetext() << "\n";
@RULES
_xNIL <-
_xANY [plus]
@@
|
@NODES _LINE
@PRE
<1,1> length(5);
@RULES
# Ex: pager:\_(
_phonePagerPhrase <- _xWILD [min=1 max=1 s layer=("_Pager") match=("pager" "Pager")] \: [s] _xWHITE [star s] _phoneNumber [s] @@
@PRE
<2,2> length(5);
@RULES
# Ex: (pager)\_(
_phonePagerPhrase <- _xWILD [min=1 max=1 s match=("_openPunct" "\(")] _xWILD [min=1... |
@CODE
if (G("pretagged"))
exitpass();
if (!G("hilite")) # 10/25/10 AM.
exitpass(); # 10/25/10 AM.
G("hello") = 0;
@@CODE
# Traverse the whole tree.
@MULTI _ROOT
@POST
# Active/passive output with clause. #
if (G("verbose"))
{
if (N("vg")) # If there are verbs in clause.
{
if (N("voice") == ... |
@CODE
prlit("zdump.txt", "Unreduced unknown words in Caps\n");
prlit("zdump.txt", "-------------------------------\n");
@@CODE
@PATH _ROOT _LINE _Caps
# Preceding passes should look for some capitalized phrase types:
# In general, look for head word at the end, as main thing.
# People names.
# Areas of study, en... |
@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... |
@CODE
G("icd_terms") = getconcept(findroot(),"icd_terms");
if (! G("icd_terms")) {
G("icd_terms") = makeconcept(findroot(),"icd_terms");
}
rmchildren(G("icd_terms"));
@@CODE |
@CODE
L("hello") = 0;
@@CODE
@NODES _sent
# np that clause clause
# that
# Need a verb in last clause.
# "The snail that ate Manhattan, our favorite town, is green."
# that
@CHECK
if (N("vg count",7))
fail();
@POST
N("need verb",7) = 1;
N("need voice",7) = "active"; # If ambiguous.
N("need inf",7) = "VBP... |
@PATH _ROOT _EntityDecl
@POST
S("public")=1 ;
S("URI") = N("textValue",3) ;
single() ;
@@POST
@RULES
_ExternalID <-
_xWILD [one matches=("PUBLIC")] ### (1)
_whiteSpace [one] ### (2)
_PubidLiteral [one] ### (3)
_whiteSpace [one] ### (4)
_PubidLiteral [one] ### (5)
@@
_ExternalID <-
_xW... |
@NODES _ROOT
@RULES
_xNIL <-
Hello ### (1)
@@
|
@NODES _ROOT
@POST
N("stopword", 1) = 1;
@RULES
_xNIL <-
_xWILD [one matches=(
i
me
my
myself
we
our
ours
ourselves
you
your
yours
yourself
yourselves
he
him
his
himself
she
her
hers
herself
it
its
itself
they
them
their
theirs
themselves
what
which
wh... |
@PATH _ROOT _bodyZone _trZone
@POST
X("value1") = N("value",1);
X("value2") = N("value",2);
@RULES
_xNIL <-
_tdZone
_tdZone
@@
|
@PATH _ROOT _experienceZone _experienceInstance _LINE _experiencePart _Caps
@RULES
@POST
X("job title") = N("$text");
@RULES
_xNIL <- _jobTitle [s] @@
|
@NODES _ROOT
@POST
S("section_title") = N("section_title", 1);
merge();
@RULES
_section <-
_section [one]
_looseText [plus]
@@
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.