Comprehend
General design
The Comprehend stage in the pipeline takes sentences or partial sentences as strings from the listen stage, and delivers them as semantic structures to the distribute stage (not part of speechio
).
NOTE THAT where a speech act from the user cannot be comprehended into anything useful, we do not throw an exception from this stage; rather we pass on a special semantic structure explaining what could not be understood. It is for either the distribute or the search phase to short-circuit and deliver a request for clarification back to the user if that’s needed.
State
The comprehension stage must hold onto some state. This must include, but is not limited to
- The most recent person mentioned, of each gender;
- The most recent group of people mentioned;
- The most recent object mentioned;
- The most recent place mentioned;
And so on. This allows us to substitute in for ‘him’, ‘her’, ‘them’, ‘it’, ‘there’.
The state cache needs to be cleared down at the beginning of a new conversation with an NPC who was not within listening range of the previous conversation.