Lines of Communication
version 1 by Aaron Reed
Example: * Smarter Smarter Parser - Send unrecognized commands to an external text parser.
One could imagine doing much more sophisticated text processing on commands not recognized by the Inform parser, perhaps involving external libraries like WordNet or ConceptNet. Here's how you could set this up on the Inform side. To simulate the external recognizer, try typing in an invalid command and then putting a valid one in the "recognizerInput.glkdata" file.
"Smarter Smarter Parser"
Include Lines of Communication by Aaron Reed.
The File of recognizer-input is called "recognizerInput". The File of recognizer-output is called "recognizerOutput".
The recognizer is a real-time file channel. The input file is File of recognizer-input. The output file is File of recognizer-output.
Before printing a parser error:
inform the recognizer that "[the player's command]";
now the recognizer is switched on.
For printing a parser error when recognizer is switched on: do nothing.
Before doing anything when the recognizer is switched on:
say "[line break](reparsed that as '[the player's command]')";
now the recognizer is switched off.
The Forest is a room. A tree and a boulder are fixed in place in forest. A deer is an animal in forest.