Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000162Core InformUnderstandingpublic2010-07-02 16:412010-10-28 00:31
Reportermattweiner 
Assigned Tograham 
PrioritynormalSeveritymildReproducibilityalways
StatusclosedResolutionfixed 
Platformx86OSMac OS XOS Version10.6
Product Version6E59 
Target VersionFixed in Version6F95 
Summary0000162: names that should be understood sometimes aren't, especially in disambiguation requests
DescriptionSometimes when using "understand" commands, a disambiguation request will yield a command that is not understood. The exact form of the "understand" command matters in a way that it shouldn't.

This can also occur when understood terms are entered in an unusual order, even when it isn't a disambiguation request (but disambiguation requests are likely to produce it, because of how they are processed, and it seems particularly bad when they fail).
Minimal Source Text To Reproduce
"Hats"

A hat is a kind of thing. Understand "chapeau" as a hat. Understand "hat" as a hat.


Lab is a room. The Stetson is a hat in lab. The fedora is a hat in lab.

Color is a kind of value. The colors are brown, red, and purple. A hat has a color. A hat is usually 
brown. 

Understand the color property as describing a hat. 
	
Test me with "take brown chapeau/stetson/take brown hat/stetson".

Additional InformationI've only tested this myself in 5Z71, but others have confirmed it with 6E59.


Compare also:

<code>
"Hats"

A hat is a kind of thing. Understand "chapeau/hat" as a hat.

Lab is a room. The Stetson is a hat in lab. The fedora is a hat in lab.

Color is a kind of value. The colors are brown, red, and purple. A hat has a color. A hat is usually brown.

Understand the color property as describing a hat.

Test me with "take brown stetson hat".
</code>

Each example's test works with the other code.

Another case that produced a problem was:

<code>
After reading a command:
   let X be indexed text;
   let X be the player's command;
   replace the text "'s" in X with " [']s";
   change the text of the player's command to X.
Understand "[something related by reversed possession] 's" as a thing.

Starter is a room. Chris is a person in Starter. Chris carries a red hat. Chris carries a blue hat.

Test me with "x chris's hat/red".
</code>
TagsNo tags attached.
Effect(serious/mild) Game compiles but misbehaves
Attached Files

- Relationships
related to 0000280closedgraham Using multiple synonym words not parsed when they're slash-separated in Understand rule 
related to 0000389closedgraham Word ordering problems when objects have multi-word names 

-  Notes
(0000522)
PDMargrave (reporter)
2010-09-07 12:14

I had a look at this myself. The reason the disambiguation fails is due to the way the parser inserts your clarification back into your original input. e.g.

  >x chris's hat
  Players Command: x chris 's hat

  Which...do you mean?
  >red
  Players Command: x red chris 's hat

Which then fails as a valid command.

I have had much better success after changing a couple of lines in Parser.i6t

Change Line 2250 and 2257 from:
  k = WordAddress(match_from) - buffer; l=buffer2->1+1;
  k = WordAddress(match_from) - buffer;
To:
  k = WordAddress(match_from+match_length-1) - buffer; l=buffer2->1+1;
  k = WordAddress(match_from+match_length-1) - buffer;

This fixes Z-machine and Glulx. What this does in the case of multiple nouns already present in the match is to insert your clarification before the last noun instead of before the first noun. This gives the following:

  >x chris's hat
  Players Command: x chris 's hat

  Which...do you mean?
  >red
  Players Command: x chris 's red hat

Which is then parsed correctly. If there is only one noun in the match then the clarification is inserted infront of it as normal. Now I'm sure this may have subtle after effects, but with the other understand statements mentioned in various threads this seems to give a major boost to the understanding of these types of commands. e.g.

<code>
Ownership relates one person to various things. The verb to own (he owns, they own, he owned, it is owned, he is owning) implies the ownership relation.

After reading a command:
let X be indexed text;
let X be the player's command;
replace the text "[']s" in X with " -s"; [ we do it this way so when it reparses after disambiguation, it remains exactly the same ]
change the text of the player's command to X.

Definition: a person is other if it is not the player.
Understand "my" as a thing when (the item described is enclosed by the player or the player owns item described) and the player can see an other person.
Understand "her" as a thing when the item described is enclosed by an other woman.
Understand "his" as a thing when the item described is enclosed by an other man.
Understand "its" and "it -s" as a thing when the item described is enclosed by a neuter thing.
Understand "its" and "it -s" as a thing when the item described is part of a thing.
Understand "your" as a thing when (the item described is enclosed by the person asked or the person asked owns the item described) and the person asked is not the player.
Understand "[something related by reversed enclosure] -s" as a thing.
Understand "[something related by reversed ownership] -s" as a thing.

The block giving rule is not listed in the check giving it to rules.
Persuasion rule for asking someone (called the holder) to try giving something (called the item) to someone (called the individual):
persuasion succeeds;

The Lab is a room.
The straw hat is in the lab.
The machine is a device in the lab. The speed dial is a part of the machine. The frequency dial is part of the machine.
A nose is a kind of thing. A nose is part of every person.
Alice is a woman in the lab. The player is Alice. Alice carries a blue hat. Alice owns the blue hat.
Bob is a man in the lab. Bob carries a small red hat. Bob wears a large red hat. Bob owns the small red hat. Bob owns the large red hat. Bob owns the machine.
Caitlin is a woman in the lab. Caitlin carries a small yellow hat. Caitlin wears a large yellow hat. Caitlin owns the small yellow hat. Caitlin owns the large yellow hat. Caitlin owns the straw hat.

test me with "x bob's hat/small/x bob's machine/x it's dial/speed/bob, give me your hat/small/x nose/my/x nose/his/x nose/caitlin's/take caitlin's hat/give it to caitlin/x hat/caitlin's/yellow/large"
</code>

Which gives:

Welcome
An Interactive Fiction
Release 1 / Serial number 100907 / Inform 7 build 6E72 (I6/v6.31 lib 6/12N) SD

Lab
You can see a straw hat, a machine, Bob and Caitlin here.

>test me
(Testing.)

>[1] x bob's hat
Which do you mean, the small red hat or the large red hat?

>[2] small
You see nothing special about the small red hat.

>[3] x bob's machine
The machine is currently switched off.

>[4] x it's dial
Which do you mean, the speed dial or the frequency dial?

>[5] speed
You see nothing special about the speed dial.

>[6] bob, give me your hat
Which do you mean, the small red hat or the large red hat?

>[7] small
Bob gives the small red hat to you.

>[8] x nose
Which do you mean, Alice's nose, Bob's nose or Caitlin's nose?

>[9] my
You see nothing special about Alice's nose.

>[10] x nose
Which do you mean, Alice's nose, Bob's nose or Caitlin's nose?

>[11] his
You see nothing special about Bob's nose.

>[12] x nose
Which do you mean, Alice's nose, Bob's nose or Caitlin's nose?

>[13] caitlin's
You see nothing special about Caitlin's nose.

>[14] take caitlin's hat
(the straw hat)
Taken.

>[15] give it to caitlin
You give the straw hat to Caitlin.

>[16] x hat
Which do you mean, the large red hat, the straw hat, the small yellow hat, the large yellow hat, the small red hat or the blue hat?

>[17] caitlin's
Which do you mean, the straw hat, the small yellow hat or the large yellow hat?

>[18] yellow
Which do you mean, the small yellow hat or the large yellow hat?

>[19] large
You see nothing special about the large yellow hat.

>

Instead of, without the parser change and just the After reading a command:

Welcome
An Interactive Fiction
Release 1 / Serial number 100907 / Inform 7 build 6E72 (I6/v6.31 lib 6/12N) SD

Lab
You can see a straw hat, a machine, Bob and Caitlin here.

>test me
(Testing.)

>[1] x bob's hat
Which do you mean, the small red hat or the large red hat?

>[2] small
I only understood you as far as wanting to examine the small red hat.

>[3] x bob's machine
You can't see any such thing.

>[4] x it's dial
Which do you mean, the speed dial or the frequency dial?

>[5] speed
I only understood you as far as wanting to examine the speed dial.

>[6] bob, give me your hat
There is no reply.

>[7] small
That's not a verb I recognise.

>[8] x nose
Which do you mean, Alice's nose, Bob's nose or Caitlin's nose?

>[9] my
You can't see any such thing.

>[10] x nose
Which do you mean, Alice's nose, Bob's nose or Caitlin's nose?

>[11] his
You can't see any such thing.

>[12] x nose
Which do you mean, Alice's nose, Bob's nose or Caitlin's nose?

>[13] caitlin's
You see nothing special about Caitlin's nose.

>[14] take caitlin's hat
Which do you mean, the small yellow hat or the large yellow hat?

>[15] give it to caitlin
(first taking Caitlin's nose)
That seems to be a part of Caitlin.

>[16] x hat
(the blue hat)
You see nothing special about the blue hat.

>[17] caitlin's
That's not a verb I recognise.

>[18] yellow
That's not a verb I recognise.

>[19] large
That's not a verb I recognise.

>

I hope this helps someone.
(0000533)
mattweiner (reporter)
2010-09-07 18:26

Does that fix the Stetson/fedora example too? Also, I think "x red chris 's hat" is *supposed* to work as a valid command; certainly a lot of other disambiguations lead to commands being parsed as weird word salad, and they work.
(0000534)
jmcgrew (administrator)
2010-09-07 18:35

I believe the underlying problem is that I7's generated parsing routine makes some (undocumented and sometimes unintuitive) assumptions about the ordering of the various parts that make up the name.

The Stetson has three parts to its name: "stetson" from the instance name, "chapeau/hat" from an explicit Understand statement, and "brown" from a property-based Understand statement. But the parse routine only accepts certain orderings of those parts, so "brown stetson hat" fails to match. However, if "chapeau/hat" is split up using "or" (Understand "chapeau" or "hat" as a hat), it works as expected.

PDMargrave's patch changes the ordering of the noun phrase that's assembled by disambiguation, so it fixes one case, but presumably it would break other cases (where a different part of the name is ambiguous), and it doesn't help the parser failure that happens when the entire name is given in an unexpected order.
(0000540)
PDMargrave (reporter)
2010-09-08 05:40

I agree that it's an 'Understanding' problem, and I didn't mean my tweak as a solution, only a stop-gap. Folks have the choice of making the tweak in the meantime, if they believe it improves the hit rate in their story, until a new release with a proper fix is forthcoming. I'm just plugging a hole in the boat until rescue arrives.
(0000685)
graham (administrator)
2010-10-10 12:47

I have improved the range of possibilities parsed, and this causes disambiguation cases like this one to work much better.

- Issue History
Date Modified Username Field Change
2010-07-02 16:41 mattweiner New Issue
2010-07-02 16:56 jmcgrew Status new => confirmed
2010-07-02 16:56 jmcgrew Additional Information Updated View Revisions
2010-09-06 23:27 jmcgrew Relationship added related to 0000280
2010-09-07 11:28 PDMargrave Issue Monitored: PDMargrave
2010-09-07 12:14 PDMargrave Note Added: 0000522
2010-09-07 18:26 mattweiner Note Added: 0000533
2010-09-07 18:35 jmcgrew Note Added: 0000534
2010-09-08 03:05 dchapes Issue Monitored: dchapes
2010-09-08 05:40 PDMargrave Note Added: 0000540
2010-10-10 12:47 graham Note Added: 0000685
2010-10-10 12:47 graham Status confirmed => resolved
2010-10-10 12:47 graham Resolution open => fixed
2010-10-10 12:47 graham Assigned To => graham
2010-10-25 21:14 jmcgrew Fixed in Version => 6F95
2010-10-28 00:31 jmcgrew Status resolved => closed
2010-11-05 20:27 jmcgrew Relationship added related to 0000389


Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker