-
Notifications
You must be signed in to change notification settings - Fork 154
Expand file tree
/
Copy pathREADME.html
More file actions
455 lines (443 loc) · 18.1 KB
/
README.html
File metadata and controls
455 lines (443 loc) · 18.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>README</title>
<style>
html {
color: #1a1a1a;
background-color: #fdfdfd;
}
body {
margin: 0 auto;
max-width: 36em;
padding-left: 50px;
padding-right: 50px;
padding-top: 50px;
padding-bottom: 50px;
hyphens: auto;
overflow-wrap: break-word;
text-rendering: optimizeLegibility;
font-kerning: normal;
}
@media (max-width: 600px) {
body {
font-size: 0.9em;
padding: 12px;
}
h1 {
font-size: 1.8em;
}
}
@media print {
html {
background-color: white;
}
body {
background-color: transparent;
color: black;
font-size: 12pt;
}
p, h2, h3 {
orphans: 3;
widows: 3;
}
h2, h3, h4 {
page-break-after: avoid;
}
}
p {
margin: 1em 0;
}
a {
color: #1a1a1a;
}
a:visited {
color: #1a1a1a;
}
img {
max-width: 100%;
}
svg {
height; auto;
max-width: 100%;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 1.4em;
}
h5, h6 {
font-size: 1em;
font-style: italic;
}
h6 {
font-weight: normal;
}
ol, ul {
padding-left: 1.7em;
margin-top: 1em;
}
li > ol, li > ul {
margin-top: 0;
}
blockquote {
margin: 1em 0 1em 1.7em;
padding-left: 1em;
border-left: 2px solid #e6e6e6;
color: #606060;
}
code {
font-family: Menlo, Monaco, Consolas, 'Lucida Console', monospace;
font-size: 85%;
margin: 0;
hyphens: manual;
}
pre {
margin: 1em 0;
overflow: auto;
}
pre code {
padding: 0;
overflow: visible;
overflow-wrap: normal;
}
.sourceCode {
background-color: transparent;
overflow: visible;
}
hr {
background-color: #1a1a1a;
border: none;
height: 1px;
margin: 1em 0;
}
table {
margin: 1em 0;
border-collapse: collapse;
width: 100%;
overflow-x: auto;
display: block;
font-variant-numeric: lining-nums tabular-nums;
}
table caption {
margin-bottom: 0.75em;
}
tbody {
margin-top: 0.5em;
border-top: 1px solid #1a1a1a;
border-bottom: 1px solid #1a1a1a;
}
th {
border-top: 1px solid #1a1a1a;
padding: 0.25em 0.5em 0.25em 0.5em;
}
td {
padding: 0.125em 0.5em 0.25em 0.5em;
}
header {
margin-bottom: 4em;
text-align: center;
}
#TOC li {
list-style: none;
}
#TOC ul {
padding-left: 1.3em;
}
#TOC > ul {
padding-left: 0;
}
#TOC a:not(:hover) {
text-decoration: none;
}
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
/* The extra [class] is a hack that increases specificity enough to
override a similar rule in reveal.js */
ul.task-list[class]{list-style: none;}
ul.task-list li input[type="checkbox"] {
font-size: inherit;
width: 0.8em;
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
/* CSS for syntax highlighting */
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { color: #008000; } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { color: #008000; font-weight: bold; } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<h1 id="status">Status</h1>
<p>The former repository of ChatScript was at
https://github.com/bwilcox-1234/ChatScript, however, I lost access to
this repository (2 factor authentication lost that I didn’t want in the
first place and I could not convince github to restore my access). So it
is no longer maintained. But the global user ChatScript became
available, and is a better name anyway.</p>
<h1 id="chatscript">ChatScript</h1>
<p>Natural Language tool/dialog manager</p>
<p>ChatScript is the next generation chatbot engine that has won the
Loebner’s 4 times and is the basis for natural language company for a
variety of tech startups.</p>
<p>ChatScript is a rule-based engine, where rules are created by humans
writers in program scripts through a process called dialog flow
scripting. These use a scripting metalanguage (simply called a “script”)
as their source code. Here what a ChatScript script file looks like:</p>
<pre><code>#
# file: food.top
#
topic: ~food []
#! I like spinach
s: ( I like spinach ) Are you a fan of the Popeye cartoons?
a: ( ~yes ) I used to watch him as a child. Did you lust after Olive Oyl?
b: ( ~no ) Me neither. She was too skinny.
b: ( yes ) You probably like skinny models.
a: ( ~no ) What cartoons do you watch?
b: ( none ) You lead a deprived life.
b: ( Mickey Mouse ) The Disney icon.
#! I often eat chicken
u: ( ![ not never rarely ] I * ~ingest * ~meat ) You eat meat.
#! I really love chicken
u: ( !~negativeWords I * ~like * ~meat ) You like meat.
#! do you eat bacon?
?: ( do you eat _ [ ham eggs bacon] ) I eat '_0
#! do you like eggs or sushi?
?: ( do you like _* or _* ) I don't like '_0 so I guess that means I prefer '_1.
#! I adore kiwi.
s: ( ~like ~fruit ![~animal _bear] ) Vegan, you too...
#! do you eat steak?
?: ( do you eat _~meat ) No, I hate _0.
#! I eat fish.
s: ( I eat _*1 > )
$food = '_0
I eat oysters.</code></pre>
<p>Above example mentioned in article <a
href="https://medium.freecodecamp.com/chatscript-for-beginners-chatbots-developers-c58bb591da8#.2qdxjuyvs">How
to build your first chatbot using ChatScript</a>.</p>
<h2 id="basic-features">Basic Features</h2>
<ul>
<li>Powerful pattern matching aimed at detecting meaning.</li>
<li>Simple rule layout combined with C-style general scripting.</li>
<li>Built-in WordNet dictionary for ontology and spell-checking.</li>
<li>Extensive extensible ontology of nouns, verbs, adjectives,
adverbs.</li>
<li>Data as fact triples enables inferencing and supports JSON
representation.</li>
<li>Rules can examine and alter engine and script behavior.</li>
<li>Remembers user interactions across conversations.</li>
<li>Document mode allows you to scan documents for content.</li>
<li>Ability to control local machines via popen/tcpopen/jsonopen.</li>
<li>Ability to read structured JSON data from websites.</li>
<li>Built in english pos-tagging and parsing</li>
<li><a href="https://www.postgresql.org/">Postgres</a> and <a
href="https://www.mongodb.com/">Mongo</a> databases support for big data
or large-user-volume chatbots.</li>
</ul>
<h2 id="os-features">OS Features</h2>
<ul>
<li>Runs on Windows or Linux or Mac or iOS or Android</li>
<li>Fast server performance supports a thousand simultaneous users.</li>
<li>Multiple bots can cohabit on the same server.</li>
</ul>
<h2 id="support-features">Support Features</h2>
<ul>
<li>Mature technology in use by various parties around the world.</li>
<li>Integrated tools to support maintaining and testing large
systems.</li>
<li>UTF8 support allows scripts written in any language</li>
<li>User support forum on <a
href="https://www.chatbots.org/ai_zone/viewforum/44/">chatbots.org</a></li>
<li>Issues or bugs on this <a
href="https://github.com/bwilcox-1234/ChatScript/issues">repo</a></li>
</ul>
<h1 id="getting-started">Getting started</h1>
<h2 id="installation">Installation</h2>
<p>Take this project and put it into some directory on your machine
(typically we call the directory ChatScript, but you can name it
whatever). That takes care of installation.</p>
<pre><code>git clone https://github.com/ChatScript/ChatScript</code></pre>
<h2
id="standalone-mode---run-locally-on-a-console-for-developementtest">Standalone
mode - run locally on a console (for developement/test)</h2>
<p>From your ChatScript home directory, go to the BINARIES
directory:</p>
<div class="sourceCode" id="cb3"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> BINARIES</span></code></pre></div>
<p>And run the ChatScript engine</p>
<h3 id="windows">Windows</h3>
<div class="sourceCode" id="cb4"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">ChatScript</span></span></code></pre></div>
<h3 id="linux">Linux</h3>
<div class="sourceCode" id="cb5"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./LinuxChatScript64</span> local</span></code></pre></div>
<p>Note: to set the file executable:
<code>chmod a+x ./LinuxChatScript64</code></p>
<h3 id="macos">MacOS</h3>
<div class="sourceCode" id="cb6"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./MacChatScript</span> local</span></code></pre></div>
<p>This will cause ChatScript to load and ask you for a username. Enter
whatever you want. You are then talking to the default demo bot
<code>Harry</code>.</p>
<h2 id="server-mode-for-production">Server Mode (for production)</h2>
<p>From your ChatScript home directory, go to the BINARIES directory and
run the ChatScript engine as server ### Run the server on Windows</p>
<div class="sourceCode" id="cb7"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="ex">ChatScript</span> port=1024</span></code></pre></div>
<h3 id="run-the-server-on-linux">Run the server on Linux</h3>
<div class="sourceCode" id="cb8"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./LinuxChatScript64</span></span></code></pre></div>
<h3 id="run-the-server-on-macos">Run the server on MacOS</h3>
<div class="sourceCode" id="cb9"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./MacChatScript</span></span></code></pre></div>
<p>This will cause ChatScript to load as a server.<br />
But you also need a client (to test client-server communication). You
can run a separate command window and go to the BINARIES directory and
type</p>
<h3 id="run-a-client-test-on-windows">Run a client (test) on
Windows</h3>
<div class="sourceCode" id="cb10"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="ex">ChatScript</span> client=localhost:1024 </span></code></pre></div>
<h3 id="run-a-client-test-on-linux">Run a client (test) on Linux</h3>
<div class="sourceCode" id="cb11"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./LinuxChatScript64</span> client=localhost:1024</span></code></pre></div>
<h3 id="run-a-client-test-on-macos">Run a client (test) on MacOS</h3>
<div class="sourceCode" id="cb12"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./MacChatScript</span> client=localhost:1024</span></code></pre></div>
<p>This will cause ChatScript to load as a client and you can talk to
the server.</p>
<h2 id="how-to-build-a-bot">How to build a bot</h2>
<p>Run ChatScript locally. From the ChatScript command prompt, type</p>
<pre><code>:build Harry</code></pre>
<p>or whatever other preinstalled bot exists. If you have revised basic
data, you can first:</p>
<pre><code>:build 0</code></pre>
<h2 id="how-to-compile-the-engine.">How to compile the engine.</h2>
<p>On windows if you have Visual Studio installed, launch
<code>VS2010/chatscript.sln</code> or <code>VS2015/chatscript.sln</code>
and do a build. The result will go in the <code>BINARIES</code>
directory.</p>
<p>On Linux, go stand in the SRC directory and type
<code>make server</code> (assuming you have make and g++ installed).
This creates BINARIES/ChatScript, which can run as a server or locally.
There are other make choices for installing PostGres or Mongo.</p>
<h2 id="docker-image">Docker image</h2>
<h3 id="building-the-base-docker-image">Building the base Docker
image</h3>
<p>The <code>Dockerfile</code> in this repository provides a ChatScript
server with no bots. To build and run it, run the following
commands:</p>
<pre><code>docker build -t chatscript .
docker run -it -p 1024:1024 chatscript</code></pre>
<p>Note: You will probably want to replace the image tag
<code>chatscript</code> with a more meaningful one for your
purposes.</p>
<h3 id="building-a-docker-image-containing-bot-data">Building a Docker
image containing bot data</h3>
<p>Adding bot data to the base image above is as simple as writing a
<code>Dockerfile</code> like the following one, which builds the
<code>Harry</code> bot:</p>
<pre><code>FROM chatscript
# Copy raw data needed for Harry
COPY ./RAWDATA/filesHarry.txt
COPY ./RAWDATA/HARRY /opt/ChatScript/RAWDATA/HARRY
COPY ./RAWDATA/QUIBBLE /opt/ChatScript/RAWDATA/QUIBBLE
# Build Harry
RUN /opt/ChatScript/BINARIES/LinuxChatScript64 local build1=filesHarry.txt</code></pre>
<p>This <code>Dockerfile</code> can then be built and run in the same
manner as the base <code>chatscript</code> image:</p>
<pre><code>docker build -t chatscript-harry .
docker run -it chatscript-harry local</code></pre>
<h1 id="full-documentation">Full Documentation</h1>
<p><a href="/WIKI/README.md">ChatScript Wiki (user guides, tutorials,
papers)</a></p>
<h1 id="contributing">Contributing</h1>
<ol type="1">
<li>Fork it</li>
<li>Create your feature branch (git checkout -b my-new-feature)</li>
<li>Commit your changes (git commit -am ‘Add some feature’)</li>
<li>Push to the branch (git push origin my-new-feature)</li>
<li>Create new Pull Request</li>
</ol>
<h1 id="last-releases">Last releases</h1>
<p><a href="/changes.md">changes.md</a></p>
<h1 id="author">Author</h1>
<ul>
<li>Bruce Wilcox
<ul>
<li>home website: <a
href="http://www.brilligunderstanding.com">BrilligUnderstanding.com</a></li>
<li>mail: <a
href="mailto:gowilcox@gmail.com">gowilcox@gmail.com</a></li>
</ul></li>
</ul>
</body>
</html>