1997Q2/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: [MUD&#45;Dev]  Magnetic Scrolls' magical parser -->
<!--X-From-R13: Eunja Vnycraal <znynpunvNvanzr.pbz> -->
<!--X-Date: from tacitus.globecomm.net [207.51.48.7] by mx4.ibm.net id 862321777.56526&#45;1 Tue Apr 29 13:49:37 1997 -->
<!--X-Message-Id: 3365FDCF.41C67EA6#iname,com -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: Pine.LNX.3.91.970428213111.3055C&#45;100000@uni&#45;corn.demon.co.uk -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, Re: [MUD-Dev]  Magnetic Scrolls' magical parser</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:malachai#iname,com">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg00280.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00281.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00307.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00290.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00282">Author</A>
&nbsp;|&nbsp;<A HREF="#00282">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00282">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Re: [MUD-Dev]  Magnetic Scrolls' magical parser</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#null,net">mud-dev#null,net</A></LI>
<LI><em>Subject</em>: Re: [MUD-Dev]  Magnetic Scrolls' magical parser</LI>
<LI><em>From</em>: Shawn Halpenny &lt;<A HREF="mailto:malachai#iname,com">malachai#iname,com</A>&gt;</LI>
<LI><em>Date</em>: Tue, 29 Apr 1997 09:55:27 -0400</LI>
<LI><em>Sender</em>: <A HREF="mailto:rsh#iname,com">rsh#iname,com</A></LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
Greg Munt wrote:

&gt; On Sun, 27 Apr 1997, Chris Gray wrote:
&gt; 
&gt; &gt; [Raz]
&gt; &gt; :It even supported the command that Magnetic Scrolls made such a big deal
&gt; &gt; :about, namely:
&gt; &gt; :  &gt; put the pot plant in the plant pot
&gt; &gt; :
&gt; &gt; :Though, apparently, there's nothing very complicated about that syntax at
&gt; &gt; :all =3D)
&gt; &gt;
&gt; &gt; That's pretty straightforward. My 'putIn' verb just tells you that you
&gt; &gt; can't put something into itself.
&gt; 
&gt; A pot plant is not a plant pot :) Also, the whole 'big deal' about this
&gt; was that 'plant' was able to be used as a verb, a noun *and* an
&gt; adjective, IIRC the input was actually:
&gt; 
&gt;         &gt; plant pot plant in plant pot
&gt; 
&gt; This sort of complexity seems to be lacking from the current mud
&gt; 'mainstream' in its entirety. Most of which I have come across seems to
&gt; be parsing such as:
&gt; 
&gt;         *  First word of input is the command, look it up in our hash
&gt;            table of commands
&gt; 
&gt;         *  Call the function corresponding to the command, passing the
&gt;            rest of the input (ie everything after the first word) as
&gt;            parameters to the function
&gt; 
&gt; So, you might have function prototypes for your command functions as:
&gt; 
&gt;         void function (Player player, String parameters);
&gt; 
&gt; All command functions would have their own parameter parsing algorithms;
&gt; so, for the above example, function 'plant' would be passed 'pot plant in
&gt; plant pot' as its parameters.
&gt; 
&gt; This is utterly simplistic, and although quite easy to implement, does
&gt; not make me happy in any way! I've looked about the web for things on
&gt; NLP, but I think I'd need a PhD to understand it all :(

I had looked into the comp.ai.nat-lang FAQ for some pointers on natural
language processing, but a lot of the stuff in there seemed to center
around Prolog (ick).  I have no interest in complex natural lang parsing,
but rather just a small degree of improvement over what exists in the
stock muds now.  Since we're dealing with a fairly limited subset of
language, really, it's not too much work to bang out a simplistic parser
that will accept fairly natural syntax.  At the moment, I just break it
down into:
    verb object_construct [optional_object_construct]
for verbs that function that way (get, put, etc., though not say, shout,
etc.)

Basically, an object_construct can have a cardinal number (the quantity)
followed by an optional preposition, then alternating ordinal numbers
(specifying which numbered object in a set) and possessive nouns. 

So far, it seems to work.  So far.

&gt; The best I can come up with is to have hash tables of verbs, nouns,
&gt; adjectives, adverbs, etc - but beyond that I'm pretty much lost. Is
&gt; anyone able to give me a few pointers on this? One of my goals is to have
&gt; a parser of *at least* 'Infocom' complexity.

I parse complete commands into their component parts and pass an object
containing them to the appropriate function.  The function is responsible
for making sure the objects are in the correct places, have the correct
properties, etc. for the command to work, since the parser has already
resolved that the objects exist and the verb is valid. 

My verbs are always bound to an object, whether it is the character
executing the command, or the item(s) being used.  I maintain a global
mapping of object keywords to objects for global queries, as well as a
mapping of 2-space locations to objects for room queries (this second
mapping is also used for virtual space resolution).  Depending on ordering
of ordinal numbers and possessive nouns, the world's contents, the room's
contents, or the character's deep inv/equ could be searched when resolving
an object in a command.  Now I can write things like

    give 200 of my 2nd dog's bag's bread to room's 5th guard's 8th child's cat

(provided I've got at least 2 dogs, the second one's got a bag with bread
in it, there are at least 5 guards in the room I'm in and the 5th one has
8 children somewhere throughout the world and the 8th one owns a cat that
is also somewhere in the world.  I've also got to be an admin, if all of
those things are not in the same location as I am).  The parser will
resolve the 'bread' and the 'cat' to the proper objects and pass them to
the 'give' verb to be handled.	The verb will verify that the dog, his
bag, and the bread inside it are all in the room with me, as are the
guard, his 8th child and her cat.  (if I'm an admin, however, I can be on
the other side of the world and the necessary actions will be done to get
the bread from the dog's bag--this part might get interesting and I've not
thought it all out yet), and then do the action if the objects
are accessible to me.

As well, I can still write "give 200 bread cat" and that'll work just fine
(though it's not as pretty and perhaps I should direct the parser to
chastise the typist for poor and ambiguous grammar). 

Heh.  So far.

--
Shawn Halpenny

"Purgamentum init, exit purgamentum"
                            - Latin for All Occasions

</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00264" HREF="msg00264.html">Magnetic Scrolls' magical parser</A></STRONG>
<UL><LI><EM>From:</EM> Greg Munt &lt;greg#uni-corn,demon.co.uk&gt;</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00280.html">Re: [MUD-Dev]  Re: Issues from the digests and Wout's list</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00281.html">Re: [MUD-Dev]  Re: Issues from the digests and Wout's list</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00307.html">Re: [MUD-Dev]  Magnetic Scrolls' magical parser</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00290.html">Re: [MUD-Dev]  Magnetic Scrolls' magical parser</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00282"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00282"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><STRONG>Magnetic Scrolls' magical parser</STRONG>, <EM>(continued)</EM>
<ul compact>
<LI><strong><A NAME="00264" HREF="msg00264.html">Magnetic Scrolls' magical parser</A></strong>, 
Greg Munt <a href="mailto:greg#uni-corn,demon.co.uk">greg#uni-corn,demon.co.uk</a>, Tue 29 Apr 1997, 04:08 GMT
<UL>
<LI><strong><A NAME="00273" HREF="msg00273.html">Re: [MUD-Dev]  Magnetic Scrolls' magical parser</A></strong>, 
Adam Wiggins <a href="mailto:nightfall#inficad,com">nightfall#inficad,com</a>, Tue 29 Apr 1997, 11:46 GMT
<UL>
<LI><strong><A NAME="00286" HREF="msg00286.html">Re: [MUD-Dev]  Magnetic Scrolls' magical parser</A></strong>, 
Nathan Yospe <a href="mailto:yospe#hawaii,edu">yospe#hawaii,edu</a>, Wed 30 Apr 1997, 00:32 GMT
</LI>
<LI><strong><A NAME="00307" HREF="msg00307.html">Re: [MUD-Dev]  Magnetic Scrolls' magical parser</A></strong>, 
Ling <a href="mailto:K.L.Lo-94#student,lut.ac.uk">K.L.Lo-94#student,lut.ac.uk</a>, Fri 02 May 1997, 20:35 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00282" HREF="msg00282.html">Re: [MUD-Dev]  Magnetic Scrolls' magical parser</A></strong>, 
Shawn Halpenny <a href="mailto:malachai#iname,com">malachai#iname,com</a>, Tue 29 Apr 1997, 20:49 GMT
</LI>
<LI><strong><A NAME="00290" HREF="msg00290.html">Re: [MUD-Dev]  Magnetic Scrolls' magical parser</A></strong>, 
clawrenc <a href="mailto:clawrenc#cup,hp.com">clawrenc#cup,hp.com</a>, Wed 30 Apr 1997, 01:06 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00329" HREF="msg00329.html">Re: [MUD-Dev]	(fwd) Re: Issues from the digests and Wout's list</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Wed 07 May 1997, 21:49 GMT
<UL>
<LI><strong><A NAME="00346" HREF="msg00346.html">Re: [MUD-Dev] (fwd) Re: Issues from the digests and Wout's list</A></strong>, 
clawrenc <a href="mailto:clawrenc#cup,hp.com">clawrenc#cup,hp.com</a>, Sat 10 May 1997, 00:52 GMT
<UL>
<LI><strong><A NAME="00356" HREF="msg00356.html">(fwd) Re: Issues from the digests and Wout's list</A></strong>, 
Oliver Jowett <a href="mailto:oliver#sa-search,massey.ac.nz">oliver#sa-search,massey.ac.nz</a>, Sat 10 May 1997, 12:37 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</ul>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>