-
Notifications
You must be signed in to change notification settings - Fork 0
/
Babel_Guide.html
356 lines (356 loc) · 18.1 KB
/
Babel_Guide.html
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
<TITLE></TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice.org 2.0 (Win32)">
<META NAME="CREATED" CONTENT="20061001;13184800">
<META NAME="CHANGED" CONTENT="20061101;17204700">
<META NAME="SDFOOTNOTE" CONTENT=";;;;P">
<META NAME="SDENDNOTE" CONTENT="ARABIC">
<STYLE>
<!--
@page { size: 8.5in 11in; margin-left: 0.85in; margin-right: 0.88in; margin-top: 0.62in; margin-bottom: 0.66in }
P { margin-bottom: 0in; font-family: "Times New Roman"; font-size: 12pt }
H1 { margin-left: 0.06in; margin-right: 0.06in; font-family: "Times New Roman"; font-size: 16pt }
H2 { margin-left: 0.06in; margin-right: 0.06in; font-family: "Times New Roman"; font-size: 14pt; font-style: italic }
H3 { margin-left: 0.06in; margin-right: 0.06in; font-family: "Times New Roman"; font-size: 13pt }
BLOCKQUOTE { margin-top: 0.06in; border: 1px solid #dddddd; padding: 0.1in; font-family: "Times New Roman"; font-size: 12pt }
BLOCKQUOTE.code-western { margin-top: 0in; margin-bottom: 0in; background: transparent; font-family: "Courier New", monospace; font-size: 12pt }
BLOCKQUOTE.code-cjk { margin-top: 0in; margin-bottom: 0in; background: transparent; font-family: "Times New Roman"; font-size: 12pt }
BLOCKQUOTE.code-ctl { margin-top: 0in; margin-bottom: 0in; background: transparent; font-family: "Times New Roman"; font-size: 12pt }
-->
</STYLE>
</HEAD>
<BODY LANG="en-US" BGCOLOR="#ffffff" DIR="LTR" STYLE="border: none; padding: 0in">
<H3 ALIGN=CENTER><FONT SIZE=6>Babel Guide</FONT></H3>
<P ALIGN=CENTER><BR>
</P>
<P ALIGN=CENTER><BR>
</P>
<H1>Introducing Babel</H1>
<H2>What is Babel?
</H2>
<P STYLE="margin-bottom: 0.2in">Babel is a knowledge representation
language that aims to be as expressive as most natural language.</P>
<P STYLE="margin-bottom: 0.2in">Babel is modeled after the C family
of computer programming languages which have syntax that provide
terse, human readable and easy to write code.
</P>
<P STYLE="margin-bottom: 0.2in">Parsing natural language is a hard
problem, but it can be avoided by writing Babel. By using this
format natural language processing (NLP) can be separated from the
real artificial intelligence work.
</P>
<P STYLE="margin-bottom: 0.2in">Babel is not a representation of
parsed natural language. It is designed to represent specific
meaning and does not include many of the subtleties of natural
language. Babel does not try to model natural language completely.
The aim is simply to be able to represent the meaning of most natural
language.</P>
<H2>Uses of Babel</H2>
<P STYLE="margin-bottom: 0.2in">The primary use of Babel is a format
for talking to computers. Babel could allow for an easier Turing
Test to be attempted and may help move beyond the current crude chat
bot designs.
</P>
<P STYLE="margin-bottom: 0.2in">Babel could be used as a generalized
goal definition system to define objectives for an intelligent agent.
It could describe problems, potential solutions and actions to be
performed by an agent. In this regard it could be used for knowledge
representation.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0.2in"><FONT SIZE=3>Babel
could be of use in translating between natural languages or in other
areas of linguistics. Learning and using Babel might improve your
grammar since it makes you think about the structure of what you are
saying.</FONT></P>
<H2>Current State of Babel</H2>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0.2in">This is the first
release of Babel. The language is capable of representing simple
sentences. More complex sentences may have to be broken into
multiple sentences. There are still many areas where the language
can be expanded to make it more expressive and easier to use.</P>
<P>The Babel grammar is written in a BNF variant that is used by the
Gold Parsing System (see <A HREF="http://www.devincook.com/goldparser/">http://www.devincook.com/goldparser/</A>).
The Gold Parser compiles the grammar into tables which can then be
used be loaded by an parsing engine, which have been created for a
variety of different development platforms. This will help enable
the language to be used on a variety of platforms. The reference
implementation is written in C# and requires the .Net Framework 2.0
or later to run.</P>
<P><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0.2in">Babel to English
translation is not a hard problem. Included in the project is a
translator that gives a reasonably understandable equivalent in
English (see <A HREF="http://translator.babelproject.com/">http://translator.babelproject.com/</A>).
Getting the translation to a point where it could pass for human for
Turing Test scenarios may be much more difficult. The English
translator is very handy for finding mistakes in Babel code and acts
as a check to make sure you said what you meant to.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0.2in">A parser and the
translator is built into a program imaginatively called Babel Editor.
The Babel Editor environment provides a view of the parsed result
that shows how Babel is represented as objects in the reference
implementation. Great care has been taken to keep the parsed object
structures simple.</P>
<P>Babel was created by me, Bryan Livingston. I also own and operate
<A HREF="http://cooltext.com/">http://cooltext.com</A>. I'm more of
a computer programmer than a linguist. I searched long and hard for
a language such as this but found none, so I created Babel over
several years as a side project.</P>
<P><BR>
</P>
<P>Comments and suggestions are welcome on the mailing list at
<A HREF="http://groups.google.com/group/babelproject">http://groups.google.com/group/babelproject</A>.
The web site for the project is at <A HREF="http://babelproject.com/">http://babelproject.com</A>.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0.2in"><BR><BR>
</P>
<H1 ALIGN=JUSTIFY STYLE="margin-top: 0in">Learn Babel by Example
</H1>
<H2>Subject Verb Object Pattern</H2>
<BLOCKQUOTE CLASS="code-western"><SAMP><FONT FACE="Courier New">//
Joe saw Jane. </FONT></SAMP>
</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western"><SAMP><FONT FACE="Courier New">Joe.see-(Jane);</FONT></SAMP>
</BLOCKQUOTE>
<P STYLE="background: transparent; page-break-before: auto"><BR>
</P>
<P STYLE="background: transparent">Babel is composed of sentences.
Each sentence ends with a semi-colon. The "//" mark
indicates a line comment, which means that the text following it will
be ignored by the parser. Whitespace is ignored by the parser which
means that you could put spaces or line breaks anywhere and it will
still parse the same.</P>
<P STYLE="background: transparent"><BR>
</P>
<P STYLE="background: transparent">Sentences follow a
Subject-Verb-Object pattern. The subject of the sentence is usually
first. This is followed by a dot to separate the verb. Then the
object of the sentence is enclosed in parenthesis. This follows a
C++, C# or Java pattern of object.method(argument).
</P>
<P STYLE="background: transparent"><BR>
</P>
<P STYLE="margin-bottom: 0.2in">In natural language we use morphology
to change the sound and spelling of words to indicate things like
plurals and tensing . In Babel this information is pulled out of the
words and added as special characters. The past tensing of the verb
"saw" in the example is done with a minus sign attached in
a suffix like manner. A plus sign is used for future tense words
and if no suffix is present then present tense is assumed for the
verb.
</P>
<P STYLE="margin-bottom: 0.2in">Nouns are always capitalized.
Currently there is no way to indicate that a noun a proper noun. In
spoken English this is specified by the absence of an article (e.g.
"the", "a" or "an".)</P>
<H2>Implicit Subjects and Sentence as an Object</H2>
<BLOCKQUOTE CLASS="code-western"><SAMP><FONT FACE="Courier New">//
See Jane run.</FONT></SAMP></BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western"><SAMP><FONT FACE="Courier New">You.see(Jane.run());
</FONT></SAMP>
</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western"><SAMP><FONT FACE="Courier New">see(Jane.run());</FONT></SAMP>
</BLOCKQUOTE>
<P STYLE="margin-bottom: 0.2in"><BR><BR>
</P>
<P STYLE="margin-bottom: 0.2in">Whenever the initial subject is left
off, an implicit noun "You" is used as the subject. The
above sentences are logical equivalents. In English we often drop
and make implicit the subject of a sentence when it is the person we
are speaking to.
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0.2in">The object of the
sentence is another sentence. The object of a sentence can be empty,
a noun, a set of nouns, another sentence, or just an adjective.
Unlike computer programming languages there is max of only one object
of a sentence. Information that you would think would be used for
multiple arguments would probably be attached directly to the verb as
a prepositional phrase.</P>
<H2>Adjectives and Adverbs</H2>
<BLOCKQUOTE CLASS="code-western"><SAMP><FONT FACE="Courier New">//
The tall man walked slowly.</FONT></SAMP></BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western"><SAMP><FONT FACE="Courier New">Man
tall.walk- slow();</FONT></SAMP></BLOCKQUOTE>
<P STYLE="margin-bottom: 0.2in"><BR><BR>
</P>
<P STYLE="margin-bottom: 0.2in">In this sentence the adjective "tall"
is attached to the noun "Man" and adverb "slow"
is attached to the verb "Walk".</P>
<P STYLE="margin-bottom: 0.2in">The suffix "-ly" is dropped
from “slowly”. When English is spoken the suffix is used
to indicate that it's an adverb, but in Babel that is made explicit
by the formatting.</P>
<P STYLE="margin-bottom: 0.2in">There is no object of this particular
sentence so the parentheses are left empty.</P>
<H2>Prepositional Phrases and Restrictive Clauses</H2>
<BLOCKQUOTE CLASS="code-western"><SAMP><FONT FACE="Courier New">//
The quick brown fox jumped over the lazy dog.</FONT></SAMP></BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western"><SAMP><FONT FACE="Courier New">Fox
quick brown.jump- over[Dog lazy]();</FONT></SAMP></BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western"><BR>
</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western"><SAMP><FONT FACE="Courier New">//
The horse that I rode died.</FONT></SAMP></BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western"><SAMP><FONT FACE="Courier New">Horse
that[I.ride-()].die-();</FONT></SAMP></BLOCKQUOTE>
<P STYLE="margin-bottom: 0.2in">
</P>
<P STYLE="margin-bottom: 0.2in">The prepositional phrase "over
the lazy dog" is attached to the verb "jump".
Prepositions are attached as if they were adverbs followed by the
object of the proposition contained in square brackets.</P>
<P STYLE="margin-bottom: 0.2in">Restrictive clauses are handled much
like a prepositional phrase, but they are instead attached to a noun.
</P>
<P STYLE="margin-bottom: 0.2in">In the reference implementation when
these prepositional phrases and restrictive clauses are parsed they
are created as adverb and adjective objects but have the contents of
the brackets attached.</P>
<H2>Declarations</H2>
<BLOCKQUOTE CLASS="code-western">// Joe is tall.</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">Joe.is(tall);</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">Joe.tall;</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western"><BR>
</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">// Joe was tall.</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">Joe.is-(tall);</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western"><BR>
</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">// Joe is a human.</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">Joe.Human;</BLOCKQUOTE>
<P STYLE="margin-bottom: 0.2in"><BR><BR>
</P>
<P STYLE="margin-bottom: 0.2in">The top two statements are logically
identical. When the verb is left off the verb is assumed to be “is”.</P>
<P STYLE="margin-bottom: 0.2in">Unfortunately there is no shorthand
for was, so in order to express the past tense you have to explicitly
use the “is” verb with a past tense suffix.</P>
<P STYLE="margin-bottom: 0.2in">When the object in a declaration is a
noun then the sentence is saying that the subject is a subclass of
the object.</P>
<H2>Noun Sets</H2>
<BLOCKQUOTE CLASS="code-western">// Tashonda sent e-mail, cards, and
letters.</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">Tashonda.send-(Email & Card* &
Letter*);</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western"><BR>
</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">// Tashonda sent e-mail, cards, or
letters.</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">Tashonda.send-(Email | Card* |
Letter*);</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western"><BR>
</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">// Mrs. Doubtfire gave Tabitha and
Samantha quizzes.</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">MrsDoubtfire.give- to[Tabitha &
Samantha](Quiz*);</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western"><BR>
</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">// Juanita and Celso worked hard.</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">Juanita & Celso.work- hard();</BLOCKQUOTE>
<P STYLE="margin-bottom: 0.2in"><BR><BR>
</P>
<P STYLE="margin-bottom: 0.2in">Anywhere that a noun can be used a
set of nouns can be used instead. Simply chain them together with
ampersands for an and set and using pipes for or set. You can not
mix and and or in a single set.</P>
<P STYLE="margin-bottom: 0.2in">Also note that the asterisk is used
as a suffix to specify a plural.</P>
<H2>Gerunds</H2>
<BLOCKQUOTE CLASS="code-western">// I love running.</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">I.love(Run=);</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western"><BR>
</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">// Charles is working in the garden.
</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">Charles.Work= in[Garden];</BLOCKQUOTE>
<P><BR>
</P>
<P>A gerund is a noun that is built from a verb by attaching an
“-ing” suffix. Note that the gerund words are
capitalized since they are nouns.</P>
<P><BR>
</P>
<P>The “-ing” suffix is also attached to present tense
participles, which are verbs that are used as adjectives, but there
is no support in Babel yet for participles.</P>
<H2>Questions</H2>
<BLOCKQUOTE CLASS="code-western">// Where are you going?</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">where(You.are(Go=));</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western"><BR>
</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">// What were you reading this
morning?</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">what(You.read- this[Morning]());</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western"><BR>
</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">// May I postpone this assignment?</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">may(I.postpone(Assignment));</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western"><BR>
</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">// Is Joe tall?</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">is tall(Joe);</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western"><BR>
</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">// Where is Joe?</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">where(Joe);</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western"><BR>
</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">// What is the color of horse that I
am riding?</BLOCKQUOTE>
<BLOCKQUOTE CLASS="code-western">what color(Horse
that[I.is-(Ride=)]);</BLOCKQUOTE>
<P STYLE="margin-left: 0.06in; margin-right: 0.06in; margin-top: 0.06in; margin-bottom: 0.06in">
Questions are written with the interrogative word as a verb.</P>
<P STYLE="margin-left: 0.06in; margin-right: 0.06in; margin-top: 0.06in; margin-bottom: 0.06in">
Questions usually use an implicit subject, so a subject of “You”
is attached to the question when parsed. Asking a question is
technically giving an order since an answer is being demanded.</P>
<P STYLE="margin-left: 0.06in; margin-right: 0.06in; margin-top: 0.06in; margin-bottom: 0.06in">
Currently the parser is hard coded to recognize specific
interrogatives. This is less than ideal since it makes the parser
English specific and in the future a symbol may be introduced to
indicate that a statement is a question.</P>
<P STYLE="margin-bottom: 0.2in"><BR><BR>
</P>
<H1>Babel Limitations</H1>
<P>Babel is very much a work in progress. Below are some of the
areas that may be improved upon.</P>
<H2>Conjunctions</H2>
<P>Most conjunctions are not currently available in the language.
Complex sentences can not easily be expressed without them.</P>
<H2>Articles</H2>
<P>The language does not support articles (a, an, and the) right now.
In natural language these are used to indicate that a noun is
proper. It's questionable whether this information is important
enough be included in the language.</P>
<P><BR>
</P>
<P>If support for articles was added it might take the form of adding
an underscore before or after the noun. Or the articles could be
added as adjectives, something which could be done right now.</P>
<H2>Questions</H2>
<P STYLE="margin-right: 0.06in; margin-top: 0.06in; margin-bottom: 0.06in">
Currently the parser is hard coded to recognize specific
interrogatives. This is less than ideal since it makes the parser
English specific and in the future a symbol may be introduced to
indicate that a statement is a question.</P>
<H2>Modifiers</H2>
<P STYLE="margin-bottom: 0.2in">Words that modify an adjective or
adverb (e.g. very, slightly, rather, quite) can not be expressed
properly. For instance, it is not really possible to say "the
very black dog" since the modifier "very" needs to be
attached to the adjective "black" and not the noun "dog".</P>
<P STYLE="margin-bottom: 0.2in">Negatives (e.g. The dog that is not
running.) would also need to be attached as a modifier.</P>
<H2>Babel Emitter</H2>
<P STYLE="margin-bottom: 0.2in">If computers are going to be working
with Babel they will need to be able to generate it in object form
and then save it as written Babel code. This is not a seriously
difficult task and will be part of the reference implementation
someday.</P>
</BODY>
</HTML>