SWAT troubles

It’s time to grasp the bull by the horns: I need to start looking at how to change the Storytron technology to meet Siboot’s needs. This is a terrifying prospect for me because I wrote only a small fraction of the code. Although I did write much of the original code, Facundo and Louis both had to rewrite my clumsy code to get something that would work in the larger environment of SWAT. This is professional code, and while I can read it, comprehending how the pieces fit together daunts me. 


The greatest change I shall have to make is revising the sentence structure to handle clauses: recursion. Now, I already have 16 word sockets to play with, and I could probably cook up some software contraption that would work within in the existing structure. But the right solution is to implement recursion based on verbs. That is, each verb has its own set of word sockets; when one verb takes a second verb in its word sockets, the second verb supplies its own word sockets. For example, let’s consider the use of the verb ‘command’ with two possible object-clauses:



The upper sentence has a second clause with the verb ‘reveal’; the lower sentence uses ‘give’. There are many other variations the could be used with the verb ‘command’. There is no single flat structure that could handle all those structures.

The obvious solution is to provide that any verb in a sentence structure other than the main verb must provide its own clause structure. Currently the sentence structure is defined by a flat array of 15 word sockets; in the new system, a sentence structure would consist of a smaller flat array, and any clause in that array would have its own flat array of word sockets. Thus, the verb ‘command’ would have only four word sockets: Subject, Verb, DirObject, Clause. Or is the new element a Verb or a Clause?

I think it will have to be a clause – which means that I’ll be needing a new word type. That in turn will entail alls sorts of changes in the code. This is going to be painful.