Implementing ChatGPT's Parser

People seem to be stuck on this idea that the point of a machine learning-enhanced parser is to understand more complex commands.

It is as if they never got frustrated with a game where they know exactly what to do but just can’t phrase it in a way that the game will accept. Or they never tried to introduce parser games to somebody who dismisses it after a couple of seconds saying ”It doesn’t understand anything I type!”

2 Likes

Only times I’ve personally had issues with getting a text parser game to understand me were quite specifically games with “different” expected syntaxes. Bunch of Adrift AIF, some old one-off engines, and basically mostly non-Infocom, non-Sierra games. The one outlier: telling another character something, no matter the parser. Do you have to phrase it as ask Ford about my house or Ford, what about my house, or are there other ways to do it?

3 Likes

As to what problems we’d like to solve with a better parser, I have a personal answer: to better maintain the illusion that I (the player) am in the story.

When I get drawn into a good IF experience, I have a tendency to start writing commands that are almost as rich as the prose the program presents to me. Eventually, I step outside Informese and–boom–I’m now out of the reverie.

An example, I’m told “There’s a pitchfork leaning against the wall of the barn.” I do some things with the pitchfork and later realize I should have left it right where it was. So I type “Lean the pitchfork against the wall of the barn.” It’s not inconceivable that the parser would handle such a command, but it’s unlikely.

This problem (which I’m sure bothers few people other than myself) is not the parser but the gap between the canned prose and the world model. One possible solution is to magically [insert AI here] improve the parser to understand that all those details in the command are irrelevant and distill my overly verbose command down to “drop pitchfork.” Another is to extend the model to better align with the prose and to integrate the parser with the world model more deeply. My experiments (toys) have pursued the latter approach, but I could see how machine learning might enable the former.

Given: “The gravel driveway leads north to the barn and south the edge of the highway.” Most players choose “n” or “s”. But when I’m immersed, I’ll very naturally type something like, “follow the driveway to the barn” or “go toward the highway.” Parser failure here breaks me out of the game. It’s interactive fiction; I want to co-author the the story.

So one takeaway is that a more flexible parser need not extend the game mechanics in order to be valuable to me. One that better matches the world model (or appears to) would help keep me in the story.

That said, I love seeing new concepts in games that don’t exist in others. If I can experience the entire story with just the verbs and actions provided by the stock Inform library, that’s less interesting to me than one that incorporates a new type of action. (That’s not impossible with current parsers, but I think authors are sometimes discouraged by the difficulties they encounter attempting to do so.)

That said, nobody wants to guess the verb, not even me. But if the parser is good enough to understand almost anything the game says (“lean the pitchfork…”), then the verbs are right there in the text begging to be used.

6 Likes

I think of this as the “Lost Pig Model.” When the prose, setting, and premise all come together to make the parser interaction seem plausible. You often see it with robot or AI player characters as well.