Closed DavidGriffith closed 8 years ago
This only exhibits when the word to be corrected is at particular positions.
Correcting the first noun (the one from noun
) works fine:
> search nii
You see no nii here.
> oops niche
In the niche is a dusty journal.
When attempting to correct the word in second
, the bug is demonstrated:
> put matchbox in nii
You see no nii here.
> oops nii
You see no nii here.
Also when the word to correct is the verb:
> thrrr knife
That's not a verb I recognise.
> oops throw
That's not a verb I recognise.
> throw knife
What do you want to throw the chef knife at?
I've tried with the demos/toyshop.inf
story file (in my case, compiled to Z-code version 5).
[Replaying commands.]
>get string
You take the balloon by its string. It's buoyant!
>put ball in car
You can't see any such thing.
>oops balloon
You put the helium balloon into the little red car.
>take balloon
You take the balloon by its string. It's buoyant!
>put balloon in truck
You can't see any such thing.
>oops car
You put the helium balloon into the little red car.
>vault car
That's not a verb I recognise.
>oops enter
Sorry, that can't be corrected.
>get balloon
You take the balloon by its string. It's buoyant!
>put balloon under car
I didn't understand that sentence.
>oops in
I only understood you as far as wanting to in.
>put balloon xyzzy car
I didn't understand that sentence.
>oops in
I only understood you as far as wanting to in.
>quit
Are you sure you want to quit? yes
What is the expected behaviour for the OOPS command? Which of the above are not behaving as expected?
This is the Toyshop command record I used for the above. toyshop.rec.txt
noun
value) corrected by OOPS:
second
value) corrected by OOPS:
second
) was typed again: “You see no nii here.”.second
value corrected. This is ideal, I think.Having read through this issue, I have a question:
The version of Uninvited in the ifarchive was compiled in 2012. Is this the version that you guys are talking about? If so, I'm not sure how its behavior is relevant to the current state of OOPS.
I compiled the test program for issue #30 against 6.12.1pre today and ran a few tests. I see the same behavior correcting verbs, nouns, prepositions, and second nouns that @bignose-debian reports for Toyshop. Here's my assessment of this behavior:
Verbs: "Sorry, that can't be corrected" is better than "That's not a verb I recognise", but even better would be to actually correct the verb. We should look at changing this. It might be as simple as a well-placed "oops_from = verb_wordnum;" when etype == VERB_PE.
Nouns: Ok.
Prepositions: Broken. See the "put balloon xyzzy car" example above.
Second nouns: Generally ok, but I did notice this:
Somewhere
You're not sure where you are.
You can see four rocks, a stone and a girl here.
>give stone to girl
(first taking the stone)
The girl doesn't seem interested.
>give stone to grl
You can't see any such thing.
>oops girl
You can only do that to something animate.
>show stone to girl
The girl is unimpressed.
>show stone to grl
You can't see any such thing.
>oops girl
The girl is unimpressed.
I think we can safely use just #30's test program. Uninvited is just where I first noticed the problem.
Working on the second noun problem. With trace set to 2, we run the above tests again. First the SHOW
sequence because it produces the correct response.
>TRACE 2
[Parser tracing set to level 2.]
>SHOW STONE TO GIRL
[ "show" show / "stone" stone / "to" to / "girl" girl ]
The girl is unimpressed.
>SHOW STONE TO FOO
[ "show" show / "stone" stone / "to" to / "foo" ? ]
>OOPS GIRL
[ "show" show / "stone" stone / "to" to / "girl" girl ]
For the first line of input, we see that all tokens match up with the names of objects. For the second line, the "foo" token doesn't match up and so we see a question mark. After the OOPS
command is given, we see that the tokenized line sent to the parser is identical to the first line of input. This is as it should be. Now look at how GIVE
happens:
>GIVE STONE TO GIRL
[ "give" give / "stone" stone / "to" to / "girl" girl ]
>GIVE STONE TO FOO
[ "give" give / "stone" stone / "to" to / "foo" ? ]
[Parsing for the verb 'give' (3 lines)]
[line 0 * held 'to' creature -> Give]
[line 0 token 1 word 2 : held]
[line 0 token 2 word 3 : 'to']
[line 0 token 3 word 4 : creature]
[line 1 * creature held -> Give reverse]
[line 1 token 1 word 2 : creature]
[line 1 token 2 word 3 : held]
[line 2 * 'over' held 'to' creature -> Give]
[line 2 token 1 word 2 : 'over']
You can't see any such thing.
oops_from == 3
saved_oops == 3
>OOPS GIRL
[ "give" give / "stone" stone / "girl" girl / "foo" ? ]
Notice how the OOPS-handling code wrote "girl" over the "to" token instead of "foo". This appears to be the cause of the problem. Something is going wrong with GIVE such that the wrong token is pointed to when a GIVE
fails. If we do GIVE FOO TO GIRL
, then saved_oops will point to the third token, one greater than it should be. If we do GIVE ROCK TO FOO
, then saved_oops will also point to the third token, but it is one lesser than it should be.
From grammar.h:
Verb 'give' 'feed' 'offer' 'pay'
* held 'to' creature -> Give
* creature held -> Give reverse
* 'over' held 'to' creature -> Give;
...
Verb 'show' 'display' 'present'
* creature held -> Show reverse
* held 'to' creature -> Show;
Notice that for these two * creature held
and * held 'to' creature
are in opposite orders. I reordered the give
verb like this:
Verb 'give' 'feed' 'offer' 'pay'
* creature held -> Give reverse
* held 'to' creature -> Give
* 'over' held 'to' creature -> Give;
This seems to fix the second noun problem. I've also checked to make sure both forms work -- GIVE GRRL STONE
as well as GIVE STONE TO GRRL
followed by OOPS GIRL
works.
Why did this work?
This partial fix is the best we can do for now. A more correct fix will have to wait for 6.12.2. I'm going to close this issue now and open a new one that better describes the problem.
There might be some new trouble with the OOPS verb. Playing around with Uninvited, I found this:
However, misspelling the first noun and then doing OOPS works correctly.