I’m an amateur programmer interested on how old school games like Zork had such good natural language processing. Are there any open source IF games I should take a look at? Has parsing progressed much over the past 20 years? Is there a well known parsing strategy most IF use?
If you’re looking for a complete OSS IF system, JACL is free and open source:
Inform6 should be free and open source too (but I think Inform7 is more sexy even if it’s not completely OSS at the moment)
You can find some open source games on the Inform7 homepage: inform7.com/learn/complete-examples/
The parsing library of Inform 6 has source code you can look at. As does Inform 7, actually, but that’s considerably harder to read. A cleaner reimplementation is at inform7.com/extensions/Ron%20New … index.html
None of this is particularly complex, theoretically – nor was Zork. It’s not “natural language processing” as the subject is approached today. The IF standard approach – and no, it hasn’t changed in twenty years – is to look at the first word, classify it as a verb, and then match the rest of the line to a set of patterns like “put OBJECT in OBJECT” or “put on OBJECT”.
All the polish is (1) a good, flexible set of hooks for recognizing noun phrases as OBJECTs; (2) good support for disambiguation questions and assumptions; (3) some ability to backtrack or pick the best of a set of partial matches.
This is why a basic IF parser takes two weeks to write, and a good one takes three to five years.
The TADS 3 parser is quite good as well, and well commented from what I remember.
Over the years I’ve collected a list of parsing links that is IMO a very good introduction to the ‘state of the art’, in IF at least.
groups.google.com/group/rec.arts … ode=source
tads.org/t3doc/doc/libref/so … ser.t.html
groups.google.com/forum/?fromgr … f5y25xk7MJ
groups.google.com/forum/?fromgr … 5CEQvZCGsJ
ifwiki.org/index.php/Past_raif_t … _2#Parsing
groups.google.com/forum/?fromgr … JPrqQ8l9u0
kotancode.com/2012/02/15/sca … -java-nlp/
groups.google.com/forum/?fromgr … o4Ut4r_qCs
discworld.starturtle.net/lpc/pla … pts/parser
A good smooth IF experience is often thought to arise from an intelligent parser, but I believe that it actually arises from a thorough connection between author and player. The author wants to subtly hint at the options available to the player, ideally in a way the player doesn’t really notice, while also anticipating what options the player will try outside the main plan of the author. Doing that well is probably considerably harder than doing NLP.
I agree with that. (Because IF got smoother over the years, without the parser getting significantly smarter!)
Although a good default world model is a big part of that connection. It’s not all on the author’s head.