Closed mnskim closed 2 years ago
We don't currently have any ways to peek into the parser as it is parsing a command. A couple of resources that may be helpful are an abbreviation dictionary for common abbreviations: https://github.com/microsoft/jericho/blob/8a31783edc1d4a0a484d1393d6d1cb4a71e6a8dd/jericho/defines.py#L57
and the unabbreviate function which will attempt to convert abbreviated commands (like 'w') into their unabbreviated versions: https://github.com/microsoft/jericho/blob/8a31783edc1d4a0a484d1393d6d1cb4a71e6a8dd/jericho/util.py#L66
Ah I see - I was trying to parse the commands that are recorded in human walkthroughs, and it seems that unabbreviating helps to normalize most of the commands.
Thank you for your help!
Actually, there is a way. You can compare the resulting world_state_hash
against the hash of each valid action.
See an example here: https://github.com/microsoft/jericho/pull/54/files#diff-881270f445531672f226f31af00a0128d457b5445e3c897cea84f41ff9e496c6R17
NB: I wouldn't suggest this for anything other than parsing commands for a walkthrough, though. The resulting action might look completely different from the walkthrough command but is "guaranteed" to lead to the same state (so could be considered equivalent). For instance, take jewel from garbage
vs. examine garbage
(where the latter triggers the "take jewel" action automatically).
Hello, thanks for a great code release.
Is there a way to see what the engine parses the command as? For example when I enter env.step('w'), the game seems to parse it as env.step('west'). Here, I'd like to be able to get the parsed command, 'west', if possible.
Thank you!