Skip to content

Commit c6cc895

Browse files
committed
CS 7.5 release
1 parent 7cea734 commit c6cc895

File tree

110 files changed

+1232
-592
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+1232
-592
lines changed

BINARIES/LinuxChatScript64

4.56 KB
Binary file not shown.

BINARIES/chatscript.exe

5 KB
Binary file not shown.

BINARIES/chatscriptpg.exe

5 KB
Binary file not shown.

BINARIES/counter.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5

DICT/ENGLISH/dict.bin

0 Bytes
Binary file not shown.

DICT/ENGLISH/facts.bin

-16 Bytes
Binary file not shown.

DICT/GERMAN/facts.bin

3.34 KB
Binary file not shown.

HTMLDOCUMENTATION/CLIENTS-AND-SERVERS/ChatScript-External-Communications.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ <h3 id="popen-commandstring-function"><code>^popen</code>( commandstring <code>'
2424
<p>The command string is a string to pass the os shell to execute. That will return output strings that will be sent to the declared function, which must be an output macro or system function name. The function can do whatever it wants.</p>
2525
<h3 id="jsonopen-kind-url-postdata-header"><code>^jsonopen</code>( kind url postdata header )</h3>
2626
<p>this function queries a website and returns a JSON datastructure as facts.</p>
27-
<h3 id="jsonprint-name"><code>^jsonprint</code>( name )</h3>
27+
<h3 id="jsontree-name"><code>^jsontree</code>( name )</h3>
2828
<p>It prints out a tree of elements, one per line, where depth is represented as more deeply indented.</p>
2929
<h3 id="jsonparse-string"><code>^jsonparse</code>( string )</h3>
3030
<p>this parses into facts exactly as ^JSONOPEN would do, just not retrieving the string from the web.</p>

HTMLDOCUMENTATION/ChatScript-Advanced-User-Manual.html

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</head>
1010
<body>
1111
<h1 id="chatscript-advanced-users-manual">ChatScript Advanced User's Manual</h1>
12-
<p>© Bruce Wilcox, [email protected] www.brilligunderstanding.com<br> <br>Revision 5/28/2017 cs7.43</p>
12+
<p>© Bruce Wilcox, [email protected] www.brilligunderstanding.com<br> <br>Revision 5/7/2017 cs7.42</p>
1313
<ul>
1414
<li><a href="ChatScript-Advanced-User-Manual.html#review-overview-of-how-cs-works">Review</a></li>
1515
<li><a href="ChatScript-Advanced-User-Manual.html#advanced-concepts">Advanced Concepts</a></li>
@@ -550,7 +550,7 @@ <h2 id="committed-output">Committed Output</h2>
550550
<p>If somewhere along the way that rule fails (in this case by the call at the end), the stream is discarded. If the rule completes and this is a top level rule, the stream is converted into a line of output and stored in the responses list.</p>
551551
<p>When the system is finished processing all rules, it will display the responses list to the user, in the order they were generated (unless you used <code>^preprint</code> or <code>^insertprint</code> to generate responses in a different order). If the output was destined for storing on a variable or becoming the argument to a function or macro, then the output stream is stored in the appropriate place instead.</p>
552552
<p>I also didn't tell you that the system monitors what it says, and won't repeat itself (even if from a different rule) within the last 20 outputs. So if, when converting the output stream into a response to go in the responses list, the system finds it already had such a response sent to the user in some recently earlier volley, the output is also discarded and the rule &quot;fails&quot;.</p>
553-
<p>Actually, it's a bit more complicated than that. Let's imagine a stream is being built up. And then suddenly the rule calls another rule (<code>^reuse</code>, <code>^gambit</code>, <code>^repond</code>). What happens? E.g.</p>
553+
<p>Actually, it's a bit more complicated than that. Let's imagine a stream is being built up. And then suddenly the rule calls another rule (<code>^reuse</code>, <code>^gambit</code>, <code>^respond</code>). What happens? E.g.</p>
554554
<pre><code>u: ( some test ) I like fruit and vegetables. ^reuse(COMMON) And so do you.</code></pre>
555555
<p>What happens is this- when the system detects the transfer of control (the <code>^reuse</code> call), if there is output pending it is finished off (committed) and packaged for the user. The current stream is cleared, and the rule is erased (if allowed to be). Then the <code>^reuse()</code> happens. Even if it fails, this rule has produced output and been erased.</p>
556556
<p>Assuming the reuse doesn't fail, it will have sent whatever it wants into the stream and been packaged up for the user. The rest of the message for this rule now goes into the output stream <em>and so do you</em> and then that too is finished off and packaged for the user. The rule is erased because it has output in the stream when it ends (but it was already erased so it doesn't matter).</p>
@@ -856,13 +856,8 @@ <h2 id="fact-dotted-notation-for-variables">Fact dotted notation for variables</
856856
$$f.object</code></pre>
857857
<p>will return those components. You may NOT, however, assign into them.</p>
858858
<h1 id="out-of-band-communication">Out of band Communication</h1>
859-
<p>ChatScript can neither see nor act, but it can interact with systems that do. The convention is that out-of-band information occurs at the start of input or output, and is encased in <code>[ ]</code>. OOB data is split off from the input and treated as a separate sentence, so</p>
860-
<pre><code>[{ state: &quot;ready&quot;}] I am good</code></pre>
861-
<p>becomes two sentences:</p>
862-
<pre><code>[{ state: &quot;ready&quot;}]
863-
I am good</code></pre>
864-
<p>This is similar to interjection processing which splits a leading interjection from the remaining input, except you can set controls to prevent that but you cannot prevent OOB data from being split off.</p>
865-
<p>ChatScript does not attempt to postag and parse any input sentence which begins with OOB. It will automatically not try to spellcheck that part or perform any kind of merge (date, number, propername). You can use normal CS rules to detect and react to incoming oob messaging. E.g, input like this</p>
859+
<p>ChatScript can neither see nor act, but it can interact with systems that do. The convention is that out-of-band information occurs at the start of input or output, and is encased in <code>[ ]</code>.</p>
860+
<p>ChatScript does not attempt to postag and parse any input sentence which begins with <code>[</code> and has a closing <code>]</code>. It will automatically not try to spellcheck that part or perform any kind of merge (date, number, propername). In fact, the <code>[...]</code> will be split off into its own sentence. You can use normal CS rules to detect and react to incoming oob messaging. E.g, input like this</p>
866861
<pre><code>[ speed=10 rate: 50 ] User said this</code></pre>
867862
<p>could be processed by your script. Although the 2 data oob items are inconsistently shown, the protocol you use is entirely up to you within the <code>[]</code> area.</p>
868863
<p>Here is a sample pattern to catch oob data.</p>
@@ -1176,10 +1171,10 @@ <h2 id="prefix-labeling-in-stand-alone-mode">Prefix labeling in stand-alone mode
11761171
<p>First you have to decide the topic it is in and insure the topic has appropriate keywords if needed.</p>
11771172
<p>Second, you need to create a sample sentence the rule is intended to match. You should make a <code>#!</code> comment of it. Then, the best thing is to type <code>:prepare</code> followed by your sentence. This will tell you how the system will tokenize it and what concepts it will trigger. This will help you decide what the structure of the pattern should be and how general you can make important keywords.</p>
11781173
<p><strong><em>What really happens with rule erasure?</em></strong></p>
1179-
<p>The system's default behavior is to erase top-level rules that put output into the output stream, so they won't repeat themselves later. You can explicitly make a rule erase with <code>^erase()</code> and not erase with <code>^keep()</code> and you can make the topic not allow responders to erase with keep as a topic flag.</p>
1174+
<p>The system's default behavior is to erase rules that put output into the output stream, so they won't repeat themselves later. You can explicitly make a rule erase with <code>^erase()</code> and not erase with <code>^keep()</code> and you can make the topic not allow responders to erase with keep as a topic flag.</p>
11801175
<p>So, if a rule generates output, it will try to erase itself. If a rule uses <code>^reuse()</code>, then the rule that actually generated the output will be the called rule. If for some reason it cannot erase itself, then the erasure will rebound to the caller, who will try to erase himself.</p>
1181-
<p>Similarly, if a rule uses <code>^refine()</code>, the actual output will come from a <code>rejoinder()</code>. These can never erase themselves directly, so the erasure will again rebound to the top level gambit.</p>
1182-
<p>Note that a topic declared system NEVER erases its rules, neither gambits nor responders, even if you put ^erase() on a rule. A topic merely declared KEEP will erase responders if they explicitly request it.</p>
1176+
<p>Similarly, if a rule uses <code>^refine()</code>, the actual output will come from a <code>rejoinder()</code>. These can never erase themselves directly, so the erasure will again rebound to the caller.</p>
1177+
<p>Note that a topic declared system NEVER erases its rules, neither gambits nor responders, even if you put ^erase() on a rule.</p>
11831178
<pre><code>u: (~emogoodbye)</code></pre>
11841179
<p><strong><em>How can I get the original input when I have a pattern like <code>u: (~emogoodbye)</code> ?</em></strong></p>
11851180
<p>To get the original input, you need to do the following:</p>

HTMLDOCUMENTATION/ChatScript-Command-Line-Parameters.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</head>
1010
<body>
1111
<h1 id="chatscript-command-line-parameters">ChatScript Command Line Parameters</h1>
12-
<p>Copyright Bruce Wilcox, [email protected] www.brilligunderstanding.com<br> Revision 5/28/2017 cs7.43</p>
12+
<p>Copyright Bruce Wilcox, [email protected] www.brilligunderstanding.com<br> Revision 6/18/2017 cs7.5</p>
1313
<h1 id="command-line-parameters">Command Line Parameters</h1>
1414
<p>You can give parameters on the run command or in a config file. The default config file is <code>cs_init.txt</code> at the top level of CS (if the file exists). Or you can name where the file is on a command line parameter <code>config=xxx</code>. Config file data are command line parameters, 1 per line, like below:</p>
1515
<pre><code>noboot
@@ -70,7 +70,7 @@ <h2 id="memory-options">Memory options</h2>
7070
<td>use this hash size for finding dictionary words (bigger = faster access)</td>
7171
</tr>
7272
<tr class="odd">
73-
<td><code>cache=1x50</code></td>
73+
<td><code>cache=50x1</code></td>
7474
<td>allocate a 50K buffer for handling 1 user file at a time. A server might want to cache multiple users at a time.</td>
7575
</tr>
7676
</tbody>
@@ -353,6 +353,8 @@ <h2 id="logging-or-not">Logging or Not</h2>
353353
<p>Write a server log. Server default if unspecified. The server log will be put into the LOGS directory under serverlogxxx.txt where xxx is the port.</p>
354354
<pre><code>Noserverprelog</code></pre>
355355
<p>Normally CS writes of a copy of input before server begins work on it to server log. Helps see what crashed the server (since if it crashes you get no log entry). This turns it off to improve performance.</p>
356+
<pre><code>hidefromlog=&quot;label label2 label3&quot;</code></pre>
357+
<p>If there is data you don't want reflected into either server or user log files, this is the parameter. Maybe you don't want an authorization code recorded, or whatever. This presumes the data is part of some JSON object. You name one or more labels and when those are found in data outbound to a log file, the label and its value will be omitted.</p>
356358
<pre><code>Serverctrlz</code></pre>
357359
<p>Have server terminate its output with 0x00 0xfe 0xff as a verification the client received the entire message, since without sending to server, client cannot be positive the connection wasn't broken somewhere and await more input forever.</p>
358360
<pre><code>Noserverlog</code></pre>

HTMLDOCUMENTATION/ChatScript-Debugging-Manual.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</head>
1010
<body>
1111
<h1 id="chatscript-debugging-manual">ChatScript Debugging Manual</h1>
12-
<p>© Bruce Wilcox, mailto:[email protected] www.brilligunderstanding.com<br> <br>Revision 4/24/2017 cs7.4</p>
12+
<p>© Bruce Wilcox, mailto:[email protected] www.brilligunderstanding.com<br> <br>Revision 6/18/2017 cs7.5</p>
1313
<p>You've written script. It doesn't work. Now what? Now you need to debug it, fix it, and recompile it. Debugging is mostly a matter of tracing what the system does testpaand finding out where it doesn't do what you expected. Debugging mostly done by issuing commands to the engine, as opposed to chatting.</p>
1414
<p>If the system detects bugs during execution, they go into <code>TMP/bugs.txt</code> You can erase the entire contents of the TMP directory any time you want to. But odds are this is not your problem.</p>
1515
<p>Debugging generally requires use of some :xxxx commands. I don't always remember them all, so at times I might simply say</p>
@@ -78,6 +78,7 @@ <h2 id="commands"><code>:commands</code></h2>
7878
:overlap - Direct members of set x that are also in set y somehow
7979
:up - Display concept structure above a word
8080
:word - Display information about given word
81+
:dualupper - Display words that have multiple upper-case forms
8182

8283
---- System Control commands -
8384
:build - Compile a script - filename {nospell,outputspell,reset}
@@ -496,6 +497,8 @@ <h3 id="common-dog-cat"><code>:common dog cat</code></h3>
496497
<p>Given 2 or more words, this displays the concepts they share in common, most close first. This only applies to statically defined concepts, and not to dynamic engine concepts like parts-of-speech, role-in-sentence, <code>~number</code>, etc</p>
497498
<h3 id="word-apple"><code>:word apple</code></h3>
498499
<p>Given a word, this displays the dictionary entry for it as well some data up it's hierarchy. The word is case sensitive and if you want to check out a composite word, you need to use underscores instead of blanks. So <code>:word TV_star</code>.</p>
500+
<h3 id="dualupper"><code>:dualupper</code></h3>
501+
<p>Lists words that have multiple upper-case spellings. Ideally there would be only one such spelling.</p>
499502
<h3 id="userfacts"><code>:userfacts</code></h3>
500503
<p>This prints out the current facts stored with the user.</p>
501504
<h3 id="allfacts"><code>:allfacts</code></h3>

HTMLDOCUMENTATION/ChatScript-Json.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
</head>
4747
<body>
4848
<h1 id="chatscript-json-manual">ChatScript JSON Manual</h1>
49-
<p>© Bruce Wilcox, mailto:[email protected] www.brilligunderstanding.com <br>Revision 4/24/2017 cs7.4</p>
49+
<p>© Bruce Wilcox, mailto:[email protected] www.brilligunderstanding.com <br>Revision 6/18/2017 cs7.5</p>
5050
<h1 id="real-world-json">Real World JSON</h1>
5151
<p>JSON (JavaScript Object Notation) is an open standard format using human-readable text to transmit data objects over the web. It is a common standard largely replacing XML which is too wordy and hard to read. JSON has two datatypes that represents collections of values, the array and the object. A JSON array is a list of JSON entities separated by commas and placed within <code>[]</code>, e.g.,</p>
5252
<pre><code>[ A 2 [ help life] [] ]</code></pre>
@@ -124,6 +124,7 @@ <h3 id="jsonparse-jsonflags-string"><code>^jsonparse</code>( {JSONFLAGS} string
124124
<pre><code>[ {&quot;token&quot;: &quot;myid&quot;, &quot;accounts&quot;: [&quot;whatever&quot;]}] User message</code></pre>
125125
<p>and then have a pattern to grab the OOB data and call <code>jsonparse</code> with it (using SAFE as a parameter). OOB input is not subject to human tokenization behavior, spellchecking, etc.</p>
126126
<p>Note: There is a limit to how much JSON you can pass as OOB data nominally, because it is considered a single token. You can bypass this limit by asking the tokenizer to directly process OOB data, returning the JSON structure name instead of all the content. Just enable <code>#JSON_DIRECT_FROM_OOB</code> on the <code>$cs_token</code> value and if it finds OOB data that is entirely JSON, it will parse it and return something like <code>jo-t1</code> or <code>ja-t1</code> in its place. Eg. <code>[ { &quot;key&quot;: &quot;value} ]</code> will return tokenized as <code>[jo-t1]</code>.</p>
127+
<p>Note: <code>^jsonparse</code> autoconverts backslash-unnnn into corresponding the utf8 characters.</p>
127128
<h2 id="jsonformatstring"><code>jsonformat</code>(string)</h2>
128129
<p>Because technically JSON requires you put quotes around field names (though various places ignore that requirement) and because CS doesn't, the function takes in a slack json text string and outputs a strict one.</p>
129130
<h2 id="accessing-json-structures">Accessing JSON structures</h2>

0 commit comments

Comments
 (0)