1999Q2/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: [MUD&#45;Dev] Re: Re: [MUD&#45;Dev] Text Parsing -->
<!--X-From-R13: Oyoreg <gurpurrmrznaNrneguyvax.arg> -->
<!--X-Date: Fri, 28 May 1999 18:24:57 &#45;0700 -->
<!--X-Message-Id: 199905290052.RAA00147#snipe,prod.itd.earthlink.net -->
<!--X-Content-Type: text/plain -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, [MUD-Dev] Re: Re: [MUD-Dev] Text Parsing</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:thecheezeman#earthlink,net">
</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="msg00343.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00345.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00349.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00360.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00344">Author</A>
&nbsp;|&nbsp;<A HREF="#00344">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00344">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>[MUD-Dev] Re: Re: [MUD-Dev] Text Parsing</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: "<A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A>" &lt;<A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A>&gt;</LI>
<LI><em>Subject</em>: [MUD-Dev] Re: Re: [MUD-Dev] Text Parsing</LI>
<LI><em>From</em>: Albert &lt;<A HREF="mailto:thecheezeman#earthlink,net">thecheezeman#earthlink,net</A>&gt;</LI>
<LI><em>Date</em>: Fri, 28 May 1999 20:52:6 -0500</LI>
<LI><em>Reply-To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
<LI><em>Sender</em>: <A HREF="mailto:mud-dev-admin#kanga,nu">mud-dev-admin#kanga,nu</A></LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
At 5/28/99 10:03:00 PM, you wrote:
&gt;Albert wrote:
&gt;(details snipped...)
&gt;&gt;
&gt;&gt; Then say the player enter a command like: buy the biggest ball from the
&gt;3rd shopkeeper
&gt;&gt; The convoluted pseudocode would be:
&gt;&gt;
&gt;&gt; void Parse(string &amp; rhs) {
&gt;&gt;         ParsedCommand pc;
&gt;&gt;         string word;
&gt;&gt; while (1) {
&gt;&gt; word = GetNextWord(rhs); // Would magically keep pointer position
&gt;&gt; if (word.empty()) break;
&gt;&gt; switch (GetKind(word)) {
&gt;&gt; case VERB:
&gt;&gt; if (pc.IsNewClause)
&gt;&gt; pc.verb = word;
&gt;&gt; else
&gt;&gt; SendToQueue(pc);
&gt;&gt; break;
&gt;&gt; case DIRECT_OBJECT:
&gt;&gt; if (pc.IsNewClause) {
&gt;&gt; pc.direct_object = word;
&gt;&gt; pc.IsNewClause = false;
&gt;&gt; } else
&gt;&gt; pc.direct_object += " " += word;
&gt;&gt; break;
&gt;&gt; case INDIRECT_OBJECT:
&gt;&gt; case ADJECTIVE:
&gt;&gt; // Pretty much the same code for direct_object
&gt;&gt; case CONJUNCTION:
&gt;&gt; SendToQueue(pc); // Would send a copy to the queue, but pc still exists
&gt;&gt; pc.IsNewClause = true; // Not technically true, but...
&gt;&gt; break;
&gt;&gt; }
&gt;&gt; }
&gt;&gt; }
&gt;
&gt;How can you tell, out of context, whether a noun is the direct object or the
&gt;indirect object? (eg. in "get the bag" and "put the ball in the bag" the
&gt;word "bag" is direct in the first instance, and indirect in the second.) I
&gt;would think you'd need to be looking for other clues, such as
&gt;prepositions/prepositional phrases to indicate that you are now expecting an
&gt;indirect object.

Well, the parser could assume initially that the first verb is the direct
object. For special case commands like "sell me the ball", GetKind would
evaluate "me" as indirect. Or, since commands like those are uncommon, the
parser could go into in-depth analysis if the verb is "tell" or "order".

&gt;If you make it so that all noun phrases contain X adjectives and 1 noun,
&gt;that is easy - If this is a noun, and if we have no direct object, this word
&gt;is (probably) the direct object. If we have a direct object already, this is
&gt;the indirect object instead. However, it looks like you were allowing for
&gt;multiple-word nouns...

You mean something like "kill the ugly green troll warrior", with troll warrior
being the mob's actual name? Hmm, I suppose I see the potential for ambiguity
in GetKind, since "troll" could be interpreted either as a noun or an adjective.
I guess the brute-strength method is forcing builders to refrain from attatching
words that could be adjectives to the names of mobs. Or, perhaps make the parser
interpret by context, so that depending on the structure and wording of the command,
the parser would obtain different results. But this seems excessive to me...

&gt;A simple (but by no means totally sufficient) way to represent this would
&gt;obviously be a variable to say whether you are expecting direct or indirect
&gt;next, initialised to direct. This could change when you come across a
&gt;preposition/prepositional phrase. If you want prepositions to be optional
&gt;(so that "get axe bag" works), it would also have to be changed when the
&gt;noun you read in doesn't resolve to the same object as the noun you have
&gt;already.
&gt;
&gt;Also, bear in mind the order of the two objects is not always fixed
&gt;(contrast "give the guard 10 coins" with "give 10 coins to the guard").
&gt;However, given that you know the verb/command, it is probably trivial to be
&gt;able to swap your objects when necessary.
&gt;
&gt;(By the way, feel free to correct any misuse of linguistic terms - it's been
&gt;a while.)
&gt;
&gt;Kylotan.

Hmm, thanks for the reply. I now see some glaring errors in my thinking.
I guess it's back to the drawing board...

Author: Albert Yi (TheCheeseMan)  ICQ: 14617788
home.earthlink.net/~thecheezeman




_______________________________________________
MUD-Dev maillist  -  MUD-Dev#kanga,nu
<A  HREF="http://www.kanga.nu/lists/listinfo/mud-dev">http://www.kanga.nu/lists/listinfo/mud-dev</A>


</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00343.html">Re: [MUD-Dev] Text Parsing</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00345.html">Re: [MUD-Dev] [TECHNICAL]  How to generate pre-processor output (template problem).</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00349.html">[MUD-Dev] Re: Re: [MUD-Dev] [TECHNICAL]  How to generate pre-processor output (template problem).</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00360.html">[MUD-Dev] Re: Re: [MUD-Dev] Text Parsing</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00344"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00344"><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><A NAME="00354" HREF="msg00354.html">[MUD-Dev] Ultimate Universe Documentation</A></strong>, 
Caliban Tiresias Darklock <a href="mailto:caliban#darklock,com">caliban#darklock,com</a>, Sun 30 May 1999, 10:48 GMT
<LI><strong><A NAME="00350" HREF="msg00350.html">[MUD-Dev] Dylan Programming Language</A></strong>, 
Ling <a href="mailto:K.L.Lo-94#student,lboro.ac.uk">K.L.Lo-94#student,lboro.ac.uk</a>, Sun 30 May 1999, 00:10 GMT
<UL>
<LI><strong><A NAME="00353" HREF="msg00353.html">Re: [MUD-Dev] Dylan Programming Language</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Sun 30 May 1999, 05:42 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00349" HREF="msg00349.html">[MUD-Dev] Re: Re: [MUD-Dev] [TECHNICAL]  How to generate pre-processor output (template problem).</A></strong>, 
Albert <a href="mailto:thecheezeman#earthlink,net">thecheezeman#earthlink,net</a>, Sat 29 May 1999, 21:14 GMT
<LI><strong><A NAME="00344" HREF="msg00344.html">[MUD-Dev] Re: Re: [MUD-Dev] Text Parsing</A></strong>, 
Albert <a href="mailto:thecheezeman#earthlink,net">thecheezeman#earthlink,net</a>, Sat 29 May 1999, 01:24 GMT
<UL>
<li>&lt;Possible follow-up(s)&gt;<br>
<LI><strong><A NAME="00360" HREF="msg00360.html">[MUD-Dev] Re: Re: [MUD-Dev] Text Parsing</A></strong>, 
Albert <a href="mailto:thecheezeman#earthlink,net">thecheezeman#earthlink,net</a>, Mon 31 May 1999, 21:37 GMT
<UL>
<LI><strong><A NAME="00367" HREF="msg00367.html">Re: [MUD-Dev] Re: Re: [MUD-Dev] Text Parsing</A></strong>, 
Travis Casey <a href="mailto:efindel#io,com">efindel#io,com</a>, Tue 01 Jun 1999, 02:21 GMT
</LI>
<LI><strong><A NAME="00370" HREF="msg00370.html">Re: [MUD-Dev] Re: Re: [MUD-Dev] Text Parsing</A></strong>, 
Mik Clarke <a href="mailto:mikclrk#ibm,net">mikclrk#ibm,net</a>, Tue 01 Jun 1999, 05:48 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
<LI><strong><A NAME="00336" HREF="msg00336.html">[MUD-Dev] Text Parsing</A></strong>, 
Albert <a href="mailto:thecheezeman#earthlink,net">thecheezeman#earthlink,net</a>, Fri 28 May 1999, 18:51 GMT
</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>