text stringlengths 22 301k |
|---|
@NODES _LINE
@RULES
# Ex: Office:\_(
_phoneWorkPhrase <- _xWILD [min=1 max=1 s layer=("_Work") match=("Office" "Wk" "w" "O" "Work")] \: [s] _xWHITE [star s] _phoneNumber [s] _xWHITE [star s] _phoneExtension [s] @@
_phoneWorkPhrase <- _phoneNumber [s] _xWHITE [star s] _phoneExtension [s] _xWHITE [star s] _xWILD [min=... |
@DECL
FileNameNumbered(L("name"),L("zero count")) {
L("c") = 0;
L("stop") = L("zero count") - strlength(str(G("counter"))) + 1;
while (L("c") < L("stop")) {
L("zeroes") = L("zeroes") + "0";
L("c")++;
}
L("filename") = G("$apppath") + "/files/" + L("name") + L("zeroes") + str(G("counter")) + ".txt";
"debug.t... |
@NODES _ROOT
@PRE
<1,1> var("word");
<1,1> var("female");
<1,1> varz("male");
@POST
"output.txt" << N("word") << " female\n";
@RULES
_xNIL <-
_LINE ### (1)
@@
|
@CODE
L("hello") = 0;
if (!G("hilite"))
exitpass();
@@CODE
# Traverse the whole tree.
@MULTI _ROOT
@PRE
<1,1> var("mypos");
#<1,1> var("pos_np");
@POST
noop(); # Merely matching the rule will set text to green.
@RULES
_xNIL <- _xANY @@
|
@CODE
DispKB();
@@CODE |
@POST
excise(1, 1)
noop()
@RULES
_xNIL <- \, [plus] @@
|
@DECL
# EUIToCodes
# Gets all codes for EUI
GetCodes(L("eui")) {
L("eui_con") = findconcept(G("eui_to_codes"), L("eui"));
if (L("eui_con")) {
L("return_vals") = findvals(L("eui_con"), "codes");
return L("return_vals");
}
else {
return 0;
}
}
# AddVals
# Add string vals to ... |
@CODE
# Traverse top split of eui_to_codes concept, saving sum total
# and adding eui/count to kb
G("top_eui_sum") = 0;
G("top_eui_exp_sum") = 0;
L("iter") = down(G("eui_to_codes_top"));
while (L("iter")) {
# Get all codes for eui
L("codes") = findvals(L("iter"), "codes");
# Create concept for code in P_... |
# To demonstrate nextattr, we first need to build a KB:
if (findconcept(findroot(),"apple"))
rmconcept(findconcept(findroot(),"apple"));
# Create the apple concept
G("apple") = makeconcept(findroot(),"apple");
# Apples have color
addstrval(G("apple"),"have","color");
# Apple's color is red
addstrval(G("apple"),"color... |
@NODES _ROOT
@RULES
## Changed this from _BLANKLINE to _LINE from library Lines.pat
_LINE <-
_xWILD [min=0 max=0 matches=(\ \t \r)] ### (1)
\n ### (2)
@@
_LINE <-
_xWILD [min=0 max=0 fails=(\r \n)] ### (1)
_xWILD [one match=(\n _xEND)] ### (2)
@@
|
@NODES _ROOT
@POST
L("con") = AddUniqueCon(G("pos"),N("$text",3));
"pos.txt" << N("$text",3) << "\n";
IncrementCount(L("con"),"count");
@RULES
_xNIL <-
pos ### (1)
\= ### (2)
_xALPHA ### (3)
@@
|
@NODES _ROOT
@POST
# Saving code, but not adding to KB, so we can put it in order later
S("code") = AddUniqueCon(G("icd_codes"), N("$text", 1));
addstrval(S("code"), "term", N("$text", 3));
# S("code") = N("$text", 1);
excise(4,4);
excise(1,2);
single();
@RULES
_entry<-
_xWILD [fails=(\t)] ### (1)
\t ###... |
@CODE
# Replace "labels.kb" with file path to store in different dir
#kbdumptree(G("labels"), "labels.kb");
#DumpKB(G("root"), "ICD");
DisplayKB(G("root"),1);
@@CODE
|
@NODES _LINE
@POST
X("code") = N("$text",1);
@RULES
_xNIL <-
_code
@@ |
# Lookup all the values in the words variable in the dict.words file
@CODE
G("Words")[0] = "aardvark";
G("Words")[1] = "abacus";
gtolower("Words");
sortvals("Words");
guniq("Words");
lookup("Words","dict.words","word");
@PRE
<1,1> unknown();
@POST
N("unknown word") = 1;
@RULES
_xNIL <- _xALPHA @@ |
@NODES _LINE
# No intervening whitespace. "retokenization".
@POST
S("len") = 2;
S("puncts") = 1; # 01/11/00 AM.
single();
@RULES
_Caps [unsealed] <- _xCAP [s] _xWILD [s one match=( \- \/ )] _xCAP [s] @@
# Some special names.
# Ex, O'Henry.
@RULES
_surName [layer=(_humanNamepart _Caps)] <-
O [s]
_xWILD [s on... |
@NODES _ROOT
@RULES
_nameToken <- _xNUM _xCAP @@
@RULES
_USA <- U \. S \. A \. @@
_USA <- U \. S \. @@
_AKA <- a \. k \. a \. @@
_AKA <- aka @@
_ST <- st \. @@
_month <-
_xWILD [one match=(
jan
feb
mar
apr
jun
jul
aug
sept
oct
nov
dec
)]
\.
@@
_quote <-
_xWILD [one match=(\' \")] ###... |
# Rename every node that matched the current element to NAME
@RULES
_locfield <- location \: _xWILD [ren=_location] \n @@ |
@NODES _ROOT
@CHECK
if (N("count",1) == G("max header"))
succeed();
fail();
@POST
"nesting.txt" << "header: " << N("count",1) << " " << N("header",1) << "\n";
S("count") = N("count",1);
S("header") = N("header",1);
single();
@RULES
_headerZone <-
_header ### (1)
_xWILD [fail=(_header _xEND)] ### (2)
@@
@... |
@NODES _LINE
@POST
L("header") = N("$text",2);
S("header") = L("header");
X("header") = 1;
S("count") = strlength(N("$text",1));
if (S("count") > G("max header")) {
G("max header") = S("count");
}
"header.txt" << L("header") << " " << str(S("count")) << "\n";
single();
@RULES
_header <-
_xWILD [min=1 match=(\#)] #... |
@NODES _ROOT
@RULES
_tdOpen <- \< td _xWILD [fail=(\>)] \> @@
_tdClose <- \< \/ td \> @@
|
# Match a _verb node optionally preceded by _modal, _have, or _be nodes, reducing to _vgroup
@RULES
_vgroup <- _modal [opt]
_have [opt] _be [opt]
_verb @@ |
@PATH _ROOT _paragraph _sentence
@POST
S("title") = N("$text",3);
single();
@RULES
_titleParen <-
\( ### (1)
a ### (2)
_agency ### (3)
\) ### (4)
@@
|
@NODES _ROOT
@RULES
_xNIL <-
_xNIL ### (1)
@@
|
# Do a mini-reduction of all the nodes that matched _noun, naming the
@RULES
_np <- _det
_quan _adj _noun [plus group=_nouns] @@ |
@NODES _ROOT
@POST
PathToConcept(G("kb"),N("con"));
@RULES
_xNIL <-
_LINE ### (1)
@@
|
@PATH _ROOT _paragraph _sentence
@POST
L("con") = getconcept(G("caps"),N("$text"));
S("caps") = L("con");
AddUniqueStr(L("con"),"type","full");
single();
@RULES
_name <-
_xWILD [min=2 match=(_xCAP)]
@@
@PRE
<1,1> uppercase();
@POST
L("con") = getconcept(G("caps"),N("$text"));
S("caps") = L("con");
AddUnique... |
@CODE
TakeKB("phrases");
G("phrases") = findconcept(findroot(), "phrases");
@@CODE
|
@NODES _ROOT
@RULES
_BLANKLINE <-
_xWILD [min=0 max=0 matches=(\ \t \r)] ### (1)
\n ### (2)
@@
@POST
S("con") = MakeCountCon(G("sentences"),"sentence");
single();
@RULES
_LINE <-
_xWILD [min=0 max=0 fails=(\r \n)] ### (1)
_xWILD [one match=(\n _xEND)] ### (2)
@@
|
@PATH _ROOT _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 jobtitleroot"); # Bonus. Last word in cap phrase.
# noop() # Implicit.
@RULES
_xNIL <- _j... |
@NODES _ROOT
@RULES
_section <-
_xWILD [min=2 matches=(\n \r)]
@@
|
@NODES _LINE
@RULES
_degree <-
_xWILD [s one match=(Bachelor Master Bachelors Masters)]
_xWHITE [s star]
Degree [s]
@@
_degree <-
_xWILD [s one match=(Bachelor Master)]
\' [s]
s [s]
_xWHITE [s star]
Degree [s]
@@
_degree <-
_xWILD [s one match=(Bachelor Bachelors Master Masters)]
_xWHITE [s star]
... |
@NODES _LINE
@PRE
<1,1> cap()
<1,1> length(4)
<3,3> cap()
<3,3> length(5)
@RULES
# Ex: West\_Point
_university <- _xWILD [min=1 max=1 s match=(_cityMod _companyMod _jobMod _Direction West)] _xWHITE [star s] _xWILD [min=1 max=1 s match=(_PostalRoad Point)] @@
@PRE
<1,1> cap()
<1,1> length(1)
<3,3> cap()
<3,3> length(... |
@NODES _ROOT
@POST
"header.txt" << N("$text",2) << "\n\n";
S("text") = N("$text",2);
single();
@RULES
_header <-
_headerOpen ### (1)
_xWILD [fail=(_headerClose)] ### (2)
_headerClose ### (3)
@@
|
@NODES _LINE
@PRE
<1,1> cap();
@RULES
# Ex: Media
_companyMod <- _xWILD [min=1 max=1 s match=("Media" "Advanced" "Air" "America" "American" "Apparel" "Applied" "Atlantic" "Auto"
"Automotive" "Bio" "Business" "Capital" "Care" "Cellular" "Central" "China" "City" "Computer"
"Consolidated" "Control" "Crown" "Data" "De"... |
## CODE REGION
@CODE
prlit("output.txt","\n");
prlit("output.txt","EXPERIENCE:\n");
@@CODE
@PATH _ROOT _experienceZone
@CHECK
# Require the instance to have a daterange.
if (!N("date range",1)) fail();
@POST
if(N("date range")){
"output.txt"
<< LJ("Date:",G("indent"))
<< N("date range",1)
<< "\n";
}
if(N("compa... |
# Allocate statement handle for the currently open database
@CODE
dbopen("test","root","mypassword");
dballocstmt();
dbexecstmt("INSERT INTO employee (name, age) VALUES('John Smith','32');");
dbfreestmt();
dbclose();
@@CODE |
@NODES _LINE
@RULES
# ex. Linguistics and Philosophy
_major [] <- _major [s]
_xWHITE [s]
_xWILD [s one matches = ( and \& ) ]
_xWHITE [s]
_major [s]
@@
# ex. Linguistics, Philosophy
_major [] <- _major [s]
_xWILD [s one matches = ( \,) ]
_xWHITE [s]
_major [s]
@@
# ex. Linguistics, Philoso... |
@PATH _ROOT _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("buffer2"))
S... |
@NODES _LINE
@RULES
_item <-
_comma ### (1)
@@
|
@NODES _ROOT
@POST
excise(1,3);
noop();
@RULES
_xNIL <-
RID ### (1)
_xNUM ### (2)
\n [opt] ### (3)
@@
|
# Fetch the float-value of a kb attribute attrName belonging to concept concept. If there are multiple numeric values, only the first value is returned
@CODE
L("pi") = makeconcept(findroot(), "pi");
replaceval(L("pi"),"val",3.14);
"output.txt" << "pi = " << fltval(L("pi"), "val") << "\n"; |
@NODES _ROOT
@POST
if (N("$text", 4)) {
S("code") = str(N("$text", 4)) + str(N("$text", 5));
}
else {
S("code") = str(N("$text", 5));
}
S("type") = N("$text", 9);
excise(2,9);
single();
@RULES
_term <-
_xWILD [fail=(code)] ### (1)
_xWILD [one matches=(code)] ### (2)
\= ### (3)
_xLET [opt] ##... |
@CODE
G("parse") = getconcept(findroot(),"parse");
@@CODE |
@NODES _ROOT
# ONLINE HELP:
# http://visualtext.org/help/NLP_PP_Stuff/Phrase_element_modifiers.htm
@RULES
_np <-
_det ### (1)
_adj [optional] ### (2)
_noun [trig] ### (3)
@@ |
@NODES _LINE
@POST
X("concept") = N("$text",2);
@RULES
_xNIL <-
\" ### (1)
_xWILD [fails=(\")] ### (2)
\" ### (3)
_xEND ### (4)
@@
|
@CODE
G("kb") = getconcept(findroot(),"kb");
@@CODE |
@CODE
if (!G("pretagged"))
exitpass();
@@CODE
@NODES _ROOT
@POST
splice(1,1);
@RULES
_xNIL <-
_text
@@
@POST
excise(1,1);
@RULES
_xNIL <-
_slash
@@
|
# Make a phrase in con by creating named node.
L("return_phr") = makephrase(L("con"), L("name")); |
@CODE
L("hello") = 0;
@@CODE
#@PATH _ROOT _TEXTZONE _sent _clause
@NODES _clause
@POST
X("stuff-in-clause") = 1;
noop();
@RULES
_xNIL <- _xWILD [one match=(
_xALPHA _seg _tok _aposS
_noun _verb _adj _adv _premod
_interj
# _prep
_xNUM _xPUNCT
)] @@
# Funny things to check on.
_xNIL <-
_vg
_vg
@@
|
@NODES _LINE
@PRE
<1,1> cap();
<4,4> cap();
<7,7> cap();
<10,10> cap();
@RULES
# Ex: B.\_S.\_E.\_E.
_degreeInMajor <- B [s] \. [s] _xWHITE [star s] S [s] \. [s] _xWHITE [star s] E [s] \. [s] _xWHITE [star s] E [s] \. [s] @@
# Ex: B.\_S.\_C.\_S.
_degreeInMajor <- B [s] \. [s] _xWHITE [star s] S [s] \. [s] _xWHITE [st... |
@NODES _ROOT
@POST
excise(1,6);
noop();
@RULES
_xNIL <-
Report ### (1)
_xWHITE ### (2)
approved ### (3)
_xWHITE ### (4)
on ### (5)
_xWILD [one matches=(\r \n)] ### (6)
@@
@POST
excise(1,6);
noop();
@RULES
_xNIL <-
NationalRad ### (1)
_xWHITE ### (2)
\| ... |
@NODES _LINE
@POST
noop()
@RULES
# ex. University of Miami(,) Orlando
_xNIL <-
_CompleteSchoolName [s]
_xWILD [s opt matches = (\, \: \; \-)]
_xWILD [s star matches = ( _xWHITE _whtSEP )]
_CityName [tree layer = ( _SchoolLocation )] @@
# ex. UNiversity of Pittsburg - Miami
_xNIL <-
_CompleteSchoolName [s]... |
@NODES _LINE
@RULES
_xNIL <- _xNIL @@
#_company <-
# _xWILD [s one match=(_company _companyPhrase _companyModroot)]
# \, [s opt]
# _xWHITE [s]
# _companyRoot [s] @@
#@RULES
#_company <-
# _xALPHA [s]
# \, [s opt]
# _xWHITE [s]
# _companyRoot [s] @@
|
@PATH _ROOT _attr _type _LINE
@POST
X("type",2) = N("word",1);
@RULES
_xNIL <-
_string
_xEND
@@
|
@NODES _ROOT
@RULES
_brackets <-
\[ ### (1)
_xWILD [fail=(\])] ### (2)
\] ### (3)
@@
|
@NODES _LINE
@RULES
_countryName <-
_xWILD [s one match=(_countryWord _countryPhrase)]
@@
|
@PATH _ROOT _LINE _language
@POST
X("abbrev",3) = N("$text",2);
X("con",2) = makeconcept(G("languages"),N("$text",2));
single();
@RULES
_abbrev <-
\[ ### (1)
_xALPHA ### (2)
\] ### (3)
@@
|
# Reduces a node labeled _noun to an _np
@RULES
_np [base] <- _noun @@ |
##################################################
# FILE: SIMPLE_NUMERICS.pat #
# SUBJ: Analyse simple numeric words as numerals #
# AUTH: Paul Deane #
# CREATED: 04/Jan/01
# DATE OF THIS VERSION: 31/Aug/01 #
# Copyright
########################... |
@NODES _LINE _humanNameCandidate
# Zap all matched nodes in parse tree.
@POST
excise(1,1);
@RULES
# Retaining these for now. #
_xNIL <- _xWILD [one match=(_whtINDENT _whtSEP)] @@
|
@CODE
L("hello") = 0;
if (G("verbose"))
"wsd.txt" << "\n" << "ANAPHORA100 PASS" << "\n";
@@CODE
@NODES _sent
# that
@CHECK
if (N("pattern",2) != "n")
fail();
@POST
L("np") = N("np",2);
if (N("pattern",4) == "vn"
|| N("pattern",4) == "v"
)
{
# Resolve using earlier np.
N("np1 remote",4) = L("np"... |
@CODE
prlit("output.xml", "<JobCandidateContact>\n");
@@CODE
@MULTI _contactZone # 09/04/99 AM.
@POST
prxtree("output.xml", "Title: ", 1, "_prefixName", "\n");
prxtree("output.xml", "<Name>\n<First>", 1, "_firstName", "</First>\n");
prxtree("output.xml", "Middle Name: ", 1, "_middleName", "\n");
prxtree... |
# @NODES _ROOT
@PATH _ROOT
@CHECK
if (
#Nlt(3, "nblobs", 6)
#Nlt(5, "nblobs", 6)
(N("nblobs",3) < 6) && (N("nblobs",5) < 6)
)
succeed();
fail();
@POST
noop();
@RULES
_xNIL <- _xSTART
_xWILD [s star match=( _BLANKLINE _horizRule)]
_xANY
_xWILD [s star match=( _BLANKLINE _horizRule)]
_xANY
@@
@POST
... |
# Switch places of first two children of parse tree root (assumes they
exist).
L("n1") = pndown(pnroot());
L("n2") = pnnext(L("n1"));
pnmove(L("n1"),L("n2"),1); |
@CODE
if (!G("pretagged"))
exitpass();
@@CODE
@NODES _ROOT
@POST
splice(1,1);
@RULES
_xNIL <-
_pos
@@
|
###############################################
# FILE: DATE_PATTERNS.pat #
# SUBJ: Recognize date expressions with year #
# AUTH: Paul Deane #
# CREATED: 26/Feb/01
# DATE OF THIS VERSION: 31/Aug/01 #
# Copyright
#######################################... |
@NODES _ROOT
@POST
splice(1,1);
@RULES
_xNIL <-
_enum
@@
|
@NODES _ROOT
@RULES
_textEnd <-
\< ### (1)
\/ ### (2)
text ### (3)
\> ### (4)
@@
@RULES
_textStart <-
\< ### (1)
text ### (2)
_xWILD [fail=(\>)] ### (3)
\> ### (4)
@@
@POST
X("word",1) = N("$text",4);
single();
@RULES
_word <-
\< ### (1)
title ### (2)
\> ### (3)
_xALPHA ### (4)
\< #... |
@CODE
# Bitwise tests
# L("or") = 8 | 4;
# "test.txt" << "8 | 4 = 12 [" << L("or") << "]\n";
# L("and") = 8 & 12;
# "test.txt" << "8 & 12 = 4 [" << L("and") << "]\n";
# L("rshift") = 8 >> 2;
# "test.txt" << "8 >> 2 = 2 [" << L("rshift") << "]\n";
# L("lshift") = 8 << 2;
# "test.txt" << "8 << 2 = 32 [" << L("lshift") ... |
# Add str as string value to concept con's attribute called name.
addstrval(L("con"), L("name"), L("str")); |
@CODE
XMLOut(cbuf());
XMLOut("output.xml");
@@CODE |
@NODES _ROOT
@POST
S("header") = N("header", 1);
single();
@RULES
_headerZone <-
_zoneHeader ### (1)
_xWILD [fail=(_zoneHeader _xEND)] ### (2)
@@
|
@PATH _ROOT _paragraph _sentence
@POST
S("value") = N("value",1);
S("type") = N("$text",3);
single();
@RULES
_money <-
_money [s] ### (1)
in [s] ### (2)
_moneyType [s] ### (3)
@@
_money <-
_money [s] ### (1)
_det [s] ### (2)
share [s] ### (3)
@@
@POST
S("value") = N("value",4);
S("type") = N("$text",2... |
@CODE
fileout( "edu.txt" );
@@CODE
# Traverse a line, looking for education parts.
# Keep an ordering counter for each line.
# NOTE: Because the edu parts may be scattered, the ordering may
# be approximate, but that's good enough for now.
# NOTE: If an edupart is already assigned, it's value gets
# overwritten. Cou... |
@CODE
fileout("dumpy.txt"); # Must declare file.
prlit("dumpy.txt", "Globals:\n");
gdump("dumpy.txt");
prlit("dumpy.txt", "\n");
prlit("dumpy.txt", "DUMPING LINES\n");
prlit("dumpy.txt", "-------------\n");
prlit("dumpy.txt", "\n");
@@CODE
@NODES _ROOT
@POST
ndump("dumpy.txt",1);
prlit("dumpy.txt", "Globals:\n");
... |
@NODES _LINE
@POST
group(2,2,"_item");
@RULES
_xNIL <-
_xSTART ### (1)
_xWILD [fail=(\,)] ### (2)
@@
@POST
group(2,2,"_item");
@RULES
_xNIL <-
\, ### (1)
_xWILD [fail=(\,)] ### (2)
@@ |
# Find and return the concept with name str under the parent concept con.
L("return_con") = findconcept(L("con"), L("str")); |
# Calculate the keyword density
@CODE
G("confidence") = hitconf(5, 100, 17);
@@CODE |
@NODES _LINE
@POST
if (!X("num")) {
if (!X("c")) {
"headers.kbb" << "headers" << "\n";
}
"headers.kbb" << " " << N("$text",1) << "\n";
X("c")++;
}
@RULES
_xNIL <-
_item ### (1)
@@
|
@NODES _ROOT
@POST excise(1,2); @RULES _xNIL <- \[ \[ @@
@POST excise(1,2); @RULES _xNIL <- \] \] @@
@POST excise(1,2); @RULES _xNIL <- \{ \{ @@
@POST excise(1,2); @RULES _xNIL <- \} \} @@
@POST excise(1,2); @RULES _xNIL <- \( \( @@
@POST excise(1,2); @RULES _xNIL <- \) \) @@
@POST excise(1,2); @RULES _xNIL <- \< \< ... |
@NODES _ROOT
@POST
singler(2,3);
@RULES
_labels <-
_columnHeaders ### (1)
_xWILD [plus fails=(_xEND)] ### (2)
_xEND ### (3)
@@
|
@CODE
L("hello") = 0;
@@CODE
@NODES _TEXTZONE
# Non- eos cases also.
@PRE
<3,3> lowercase();
@POST
noop();
@RULES
_xNIL <-
\.
_xWHITE [star lookahead]
_xALPHA
@@
# Some abbreviatons.
@POST
pncopyvars(1);
S("mypos") = "NP";
single();
@RULES
_companyDESIG [layer=(_abbr _noun)] <-
_xWILD [one match=(inc c... |
@CODE
G("kb") = makeconcept(findroot(),"kb");
G("kb_child") = makeconcept(G("kb"), "kb_child");
addstrval(G("kb_child"), "attr", "first attr");
addstrval(G("kb_child"), "attr", "secondattr");
addstrval(G("kb_child"), "attr", "third attr");
G("kb_child_2") = makeconcept(G("kb"), "kb_child_2");
addstrval(G("kb_child_2"... |
@NODES _NLPPP
@POST
preaction()
single()
@RULES
_ACTION [base] <- _PREPAIR _FNCALL [s] \; [s opt] @@
|
@NODES _ROOT
@RULES
_paragraph <-
_xWILD [match=(_LINE)] ### (2)
@@
|
@CODE
L("hello") = 0;
#"metric.txt" << G("$passnum") << "\n";
@@CODE
#@PATH _ROOT _TEXTZONE _sent
@NODES _sent
# dqa alpha alpha
@PRE
<5,5> var("noun");
@CHECK
if (!N(1) && !N(2))
fail();
if (!N("adj",4) && !N("noun",4))
fail();
@POST
fixnphead(5);
fixnpnonhead(4);
if (pnname(N(4)) == "_adj")
L("nn")... |
@CODE
# Created in pr_laddr.txt
#fileout("addr.txt");
prlit("addr.txt","\n");
prlit("addr.txt","ZONE ADDRESSPARTS\n");
prlit("addr.txt","-----------------\n");
@@CODE
# @NODES _ROOT #
@PATH _ROOT # 10/19/99 AM.
# Print out the total count of vars in each line.
@POST
prlit("addr.txt", "zone count=");
# fprintn... |
@NODES _LINE
@POST
X("concept") = N("$text",2);
@RULES
_xNIL <-
\" ### (1)
_xALPHA ### (2)
\" ### (3)
_xEND ### (4)
@@
|
# Build an apple kb with color and weight
@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") = makeconcept(findroot(),"apple");
# Apples have color
addstrval(G("apple")... |
# Execute commands in a knowledge base command file (.KB file)
@CODE
take("e:\\apps\\tester\\companies.kb");
take("\\data\\myadditions.kb"); # Starts from G("$apppath"),
project folder.
@@CODE
where the companies.kb file might contain the following:
add hier "concept" "company"
add hier "concept" "company"
"ford"
... |
@POST
rfanodes(2, path)
single()
@RULES
_PATH [base] <- _soPATH _NONLIT [star] _eoPATH [opt] @@
|
@POST
rfanodes(2, "nodes")
single()
@RULES
_NODES [base] <- _soNODES [s] _NONLIT [star] _eoNODES [s opt] @@
@POST
rfanodes(2, "path")
single()
@RULES
_PATH [base] <- _soPATH [s] _NONLIT [star] _eoPATH [s opt] @@
@POST
rfanodes(2, "multi")
single()
@RULES
_MULTI [base] <- _soMULTI [s] _NONLIT [star] _eoMULTI [s... |
@CODE
L("hello") = 0;
@@CODE
@NODES _sent
@PRE
<1,1> lowercase();
@CHECK
if (N("ne type",2))
fail();
@POST
L("tmp") = lasteltnode(3);
# if (pnvar(L("tmp"),"apos-s"))
# {
# S("apos-s") = 1;
# group(2,3,"_adj");
# }
# else
group(2,3,"_noun");
pncopyvars(L("tmp"),N(2));
@RULES
_xNIL <-
_xWILD [s ... |
@CODE
L("hello") = 0;
@@CODE
@NODES _sent
@POST
group(1,2,"_clause");
setunsealed(1,"true"); # 07/10/12 AM.
@RULES
_xNIL <-
_clausestart [opt]
_xWILD [plus fail=(\, _fnword _qEOS _dbldash \" _dblquote _clause _clausestart _clausesep)]
_xWILD [plus lookahead match=(\, _fnword _qEOS _dbldash \" _dblquote _claus... |
@DECL
########
# FUNC: DOMVNN
# SUBJ: Query semantics for VNN clause.
# EX: "Is Smith an author?"
########
domvnn(
L("clause"),
L("vg"),
L("np1"),
L("np2")
)
{
if (!L("clause") || !L("vg") || !L("np1") || !L("np2"))
return;
L("sem vg") = nodesem(L("vg"));
L("sem np1") = nodesem(L("np1"));
L("sem np2") ... |
@CODE
# Simplified since tutorials were recorded
G("person") = getconcept(findroot(),"person");
G("sentences") = getconcept(findroot(),"sentences");
@@CODE |
@PATH _ROOT _equation _split
@POST
addEquationToLabel(X("name",2),N("$text"));
X("split",2) = 1;
@RULES
_xNIL <-
_equation [s]
@@
|
@PATH _ROOT _headerZone
@POST
excise(1,1);
noop();
@RULES
_xNIL <-
_xBLANK [s] ### (1)
@@
|
@NODES _LINE
@PRE
<1,1> cap();
@RULES
# Ex: E-mail:
_emailHeader <- E [s] \- [s] mail [s] \: [s] @@
@RULES
# Ex: e-mail:
_emailHeader <- e [s] \- [s] mail [s] \: [s] @@
@PRE
<1,1> cap();
@RULES
# Ex: Email:
_emailHeader <- Email [s] \: [s] @@
@RULES
# Ex: email:
_emailHeader <- email [s] \: [s] @@
@PRE
<1,1> c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.