<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">

<html>

<!--(==============================================================)-->
<!--(Document created with RoboEditor. )============================-->
<!--(==============================================================)-->

<head>

<title>About KB Command Files</title>

<!--(Meta)==========================================================-->

<meta http-equiv=content-type content="text/html; charset=windows-1252">
<meta name=date content="06 4, 2002 6:11:47 PM">
<meta name=generator content="RoboHELP by eHelp Corporation - www.ehelp.com">
<meta name=generator-major-version content=0.1>
<meta name=generator-minor-version content=1>
<meta name=filetype content=kadov>
<meta name=filetype-version content=1>
<meta name=page-count content=1>
<meta name=layout-height content=1592>
<meta name=layout-width content=1024>


<!--(Links)=========================================================-->

<link rel="StyleSheet" href="../default.css">



</head>

<!--(Body)==========================================================-->


<body>

<h1>About KB Command Files</h1>

<p>On examining the interpreted knowledge base in the kb\user folder of 
 an analyzer project, you will find files with human-readable commands:</p>

<!--(Table)=========================================================-->
<table x-use-null-cells
		style="x-cell-content-align: top;
				width: 100%;
				border-spacing: 0px;
				border-spacing: 0px;"
		cellspacing=0
		width=100%>
<col style="width: 12.914%;">
<col style="width: 87.086%;">

<tr style="x-cell-content-align: top;"
	valign=top>
<td colspan=1
	rowspan=1
	style="width: 12.914%;
			border-left-width: 1px;
			border-left-color: #000000;
			border-left-style: Solid;
			border-top-style: Solid;
			border-top-color: #000000;
			border-top-width: 1px;
			border-right-width: 1px;
			border-right-color: #000000;
			border-right-style: Solid;
			border-bottom-style: Solid;
			border-bottom-color: #000000;
			border-bottom-width: 1px;
			padding-right: 10px;
			padding-left: 10px;"
	width=12.914%>
<p>main.kb</td>
<td colspan=1
	rowspan=1
	style="width: 87.086%;
			border-top-style: Solid;
			border-top-color: #000000;
			border-top-width: 1px;
			border-right-width: 1px;
			border-right-color: #000000;
			border-right-style: Solid;
			border-bottom-style: Solid;
			border-bottom-color: #000000;
			border-bottom-width: 1px;
			padding-right: 10px;
			padding-left: 10px;"
	width=87.086%>
<p>Invokes command files for loading the knowledge base.</td></tr>

<tr style="x-cell-content-align: top;"
	valign=top>
<td style="width: 12.914%;
			padding-right: 10px;
			padding-left: 10px;
			border-left-style: Solid;
			border-left-color: #000000;
			border-left-width: 1px;
			border-right-style: Solid;
			border-right-color: #000000;
			border-right-width: 1px;
			border-bottom-width: 1px;
			border-bottom-color: #000000;
			border-bottom-style: Solid;"
	width=12.914%>
<p>hier.kb</td>
<td style="width: 87.086%;
			padding-right: 10px;
			padding-left: 10px;
			border-right-style: Solid;
			border-right-color: #000000;
			border-right-width: 1px;
			border-bottom-width: 1px;
			border-bottom-color: #000000;
			border-bottom-style: Solid;"
	width=87.086%>
<p>Adds the concepts in the knowledge base hierarchy</td></tr>

<tr style="x-cell-content-align: top;"
	valign=top>
<td style="width: 12.914%;
			border-left-width: 1px;
			border-left-color: #000000;
			border-left-style: Solid;
			border-right-width: 1px;
			border-right-color: #000000;
			border-right-style: Solid;
			border-bottom-style: Solid;
			border-bottom-color: #000000;
			border-bottom-width: 1px;
			padding-right: 10px;
			padding-left: 10px;"
	width=12.914%>
<p>word.kb</td>
<td style="width: 87.086%;
			border-right-width: 1px;
			border-right-color: #000000;
			border-right-style: Solid;
			border-bottom-style: Solid;
			border-bottom-color: #000000;
			border-bottom-width: 1px;
			padding-right: 10px;
			padding-left: 10px;"
	width=87.086%>
<p>Adds the words in the dictionary</td></tr>

<tr style="x-cell-content-align: top;"
	valign=top>
<td style="width: 12.914%;
			border-left-width: 1px;
			border-left-color: #000000;
			border-left-style: Solid;
			border-right-width: 1px;
			border-right-color: #000000;
			border-right-style: Solid;
			border-bottom-style: Solid;
			border-bottom-color: #000000;
			border-bottom-width: 1px;
			padding-right: 10px;
			padding-left: 10px;"
	width=12.914%>
<p>phr.kb</td>
<td style="width: 87.086%;
			border-right-width: 1px;
			border-right-color: #000000;
			border-right-style: Solid;
			border-bottom-style: Solid;
			border-bottom-color: #000000;
			border-bottom-width: 1px;
			padding-right: 10px;
			padding-left: 10px;"
	width=87.086%>
<p>Adds phrases to concepts</td></tr>

<tr style="x-cell-content-align: top;"
	valign=top>
<td style="width: 12.914%;
			border-left-width: 1px;
			border-left-color: #000000;
			border-left-style: Solid;
			border-right-width: 1px;
			border-right-color: #000000;
			border-right-style: Solid;
			border-bottom-style: Solid;
			border-bottom-color: #000000;
			border-bottom-width: 1px;
			padding-right: 10px;
			padding-left: 10px;"
	width=12.914%>
<p>attr#.kb</td>
<td style="width: 87.086%;
			border-right-width: 1px;
			border-right-color: #000000;
			border-right-style: Solid;
			border-bottom-style: Solid;
			border-bottom-color: #000000;
			border-bottom-width: 1px;
			padding-right: 10px;
			padding-left: 10px;"
	width=87.086%>
<p>Adds attributes to concepts and phrase nodes</td></tr>
</table>

<p style="margin-top: 0pt; margin-bottom: 0pt;">&nbsp;</p>

<p>When an interpreted KB is read as part of loading an analyzer, the commands 
 in these four files are executed in the order given above. <!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}-->(This 
 ordering guarantees that concepts are added to the kb before they are 
 used in phrases, and that all concepts and nodes are present before attaching 
 attributes to them.) <!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}-->Similarly, 
 the gui.kb file at the top-level directory of an analyzer project defines 
 the analyzer sequence and the input file hierarchy, as loaded into the 
 knowledge base.</p>

<p>All these .kb files execute a batch command language for adding and 
 editing the knowledge base. <!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}-->A 
 typical command looks like</p>

<p>add hier &quot;concept&quot; &quot;sys&quot;</p>

<p><span style="font-weight: bold;">add hier &lt;path&gt;</span> specifies 
 that a concept is to be added to the hierarchy, as specified by a path 
 of concept names that starts at the root of the knowledge base hierarchy, 
 called &quot;concept.&quot; <!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}-->Thus, 
 the command above says to start at the root, named &quot;concept,&quot; 
 and to add a concept called &quot;sys&quot; under the root, if not already 
 present. <!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}-->Another 
 example is</p>

<p>add word &quot;xyz&quot;</p>

<p>The <span style="font-weight: bold;">add word</span> command above adds 
 the word &quot;xyz&quot; under its appropriate index-concept in the special 
 dictionary hierarchy within the KB.</p>

<p>The command <span style="font-weight: bold;">ind phrase</span> is used 
 to add a phrase of nodes to a concept. <!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}-->Each 
 concept can only have one phrase, with any number of nodes:</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;"><span style="font-family: 'Courier New', monospace;">ind 
 phrase</span></p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">&lt;concept&gt; <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->; 
 The concept to which the phrase is being added.</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">&lt;concept 1&gt; <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->; 
 Concept referenced by 1st node of phrase.</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;"><span style="font-family: 'Courier New', monospace;">&lt;concept 
 2&gt; <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->; 
 Concept referenced by 2nd node of phrase.</span></p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">...</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">end ind</p>

<p>An example that adds an attribute to a concept is</p>

<p style="margin-bottom: 0pt; font-family: 'Courier New', monospace;">ind 
 attr</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">&quot;concept&quot; 
 &quot;gram&quot;</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">0</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">&quot;concept&quot; 
 &quot;sys&quot; &quot;dict&quot; &quot;a&quot; &quot;c&quot; &quot;co&quot; 
 &quot;constrain&quot;</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">pst</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">&quot;true&quot;</p>

<p style="margin-top: 0pt; font-family: 'Courier New', monospace;">end 
 ind</p>

<p>The command <span style="font-weight: bold;">ind attr</span> is a multi-line 
 command for adding an attribute. <!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}-->Its 
 general form is</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">ind attr</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">&lt;concept&gt; <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->; 
 The concept to which an attribute is being added.</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">&lt;concept index&gt; 
 <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->; 
 0 means attr is to be added to the concept itself. <!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}-->1 
 = add attr to 1st</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;"><span style="margin-top: 0pt;
	margin-bottom: 0pt;
	font-family: 'Courier New', monospace;"><!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->; 
 node of concept's phrase, etc.</span></p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">&lt;key concept&gt; 
 <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->; 
 The attribute key (or name), specified by a concept in the kb.</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">&lt;value type&gt; 
 <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->; 
 The type of value:</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;"><!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->; 
 (pst = string, pnum = integer, pfloat = float pcon = concept)</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">&lt;value&gt; <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->; 
 The value itself, according to its type.</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">...</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">&lt;value type N&gt; 
 <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->; 
 Can optionally add second value type, second value, and so on.</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">&lt;value N&gt;</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">end ind</p>

<p style="margin-top: 0pt; margin-bottom: 0pt;">&nbsp;</p>

<p style="margin-top: 0pt; margin-bottom: 0pt;">Each command file should 
 end with the <span style="font-weight: bold;">quit</span> command alone 
 on a line. <!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}-->Comments 
 are indicated by a semicolon, as above.</p>

<p style="margin-top: 0pt; margin-bottom: 0pt;">&nbsp;</p>

<p style="margin-top: 0pt; margin-bottom: 0pt;">Note that command files 
 can be executed from an analyzer pass file, using the NLP++ <span style="font-weight: bold;">take</span> 
 function (also available as an API function in include/API/consh/cg.h). 
 <!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}-->take(filename) 
 executes the commands in the specified .kb file. <!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}-->This 
 is one way in which knowledge can be layered or imported into a knowledge 
 base conveniently. <!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}-->In 
 addition, there's a <span style="font-weight: bold;">take</span> command, 
 as in</p>

<p style="margin-top: 0pt; margin-bottom: 0pt;">&nbsp;</p>

<p style="margin-top: 0pt; margin-bottom: 0pt;">take &quot;kb\\user\\main.kb&quot;</p>

<p style="margin-top: 0pt; margin-bottom: 0pt;">&nbsp;</p>

<p style="margin-top: 0pt; margin-bottom: 0pt;">which accepts both an absolute 
 and relative filename as argument, and executes the commands within the 
 given filename. <!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}-->Relative 
 filenames assume the current application project as the root directory.</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-weight: bold;
			color: #ff0000;">&nbsp;</p>

<p style="margin-top: 0pt; margin-bottom: 0pt;">A variant to add attributes 
 to a dictionary word concept has been implemented, called <span style="font-weight: bold;">ind 
 wattr</span>. <!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}-->Its 
 format is identical with ind attr, except that instead of a concept, a 
 word may be specified for convenience.</p>

<p style="margin-top: 0pt; margin-bottom: 0pt;">&nbsp;</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;"><span style="font-family: 'Courier New', monospace;">ind 
 wattr</span></p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">&lt;word&gt; <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->; 
 A string. <!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}-->The 
 dictionary word to which an attribute is being added.</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">0 <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->; 
 This line is kept merely to match the format of ind attr.</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">&lt;key concept&gt; 
 <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->; 
 The attribute key (or name), specified by a concept in the kb.</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">&lt;value type&gt; 
 <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->; 
 The type of value:</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;"><!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->; 
 (pst = string, pnum = integer, pfloat = float pcon = concept)</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">&lt;value&gt; <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->; 
 The value itself, according to its type.</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">...</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">&lt;value type N&gt; 
 <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->; 
 Can optionally add second value type, second value, and so on.</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">&lt;value N&gt;</p>

<p style="margin-top: 0pt;
			margin-bottom: 0pt;
			font-family: 'Courier New', monospace;">end ind</p>

<p>&nbsp;</p>

<p style="margin-top: 0pt; margin-bottom: 0pt;">&nbsp;</p>

<p style="margin-top: 0pt; margin-bottom: 0pt;">Additional batch commands 
 exist, but the most important ones have been mentioned here.</p>

<p>&nbsp;</p>

</body>

</html>
