First does the player mean: say “DPM [the current action]?”;
test me with “rules/put red in box”[/code]
The output is:
Obviously, this is a problem if your DPMR refer to inserting something into another thing. Should I just write DPMR for wearing, or is there a better solution?
I am approaching the conclusion that the Does the Player Mean rulebook is a wretchedly inadequate means of resolving actions that take two objects.
The parser tries to match the command against grammar lines word by word.
The first grammar line the parser tries to match the command “put red in box” against is ‘put on [something preferably held]’ (which triggers the wearing action); but ‘on’ doesn’t match so it tries the second grammar line.
The second grammar line beginning with ‘put’ is ‘put [something preferably held] on’ (which also triggers the wearing action); here it first disambiguates the ‘[something preferably held]’ token, before it gives up on the ‘on’.
The third grammar line it tries is ‘put down [things held]’ (which triggers the dropping action); that one of course fails already by ‘down’.
The fourth grammar line it tries is ‘put [things held] down’ (which triggers the dropping action, too); here it first disambiguates the ‘[things held]’ token, before it detects the mismatch with the word ‘down’.
The fifth grammar line tried is 'put [other things] in [something] (which triggers the inserting it into action); and here every word and token matches – and actually here the parser has no need of the DTPM rules at all! You can confirm that by typing “insert red into box”.
The parser doesn’t have to disambiguate this last grammar line, because there are only two things in the game word whose names include the word ‘red’ and one of them is the box, which it knows is the second noun (for in this case the parser tries to identify the second noun before identifying the noun), and thanks to the ‘[other things]’ token, the parser will know that the noun cannot be the same as the second noun.
I also still don’t understand why these rules apply. They are both being matched against actions that have no second noun, and yet their preamble specifies a value for the second noun. Shouldn’t the second noun be ‘nothing’ when wearing or dropping?
I guess the parser first checks if the first noun matches before it even cares whether the second noun does (internally perhaps there is always a value for the second noun variable to match, even if it is just the default ‘nothing’).