At this point in the development of the texai dialog system, it is neccessary to create the bootstrap grammar constructions. These will enable the system to acquire the remainder of the grammar via dialog interactions. I investigated a couple of alternatives before settling on a user-editable construction grammar serialization. The first was to hard-code the construction object creation in the ConstructionInitializer class. This alternative was both tedious and opaque. The second alternative was to represent the construction entities in RDF directly in TriG format, which includes context. This approach is less opaque, but still tedious because RDF entity persistence requires bookkeeping statements.

 

Here are the grammar constructions for the greeting use case as expressed in the user-editable serialization:

# Constructions for the greeting use case.
group named "greeting use case" {
SequenceConstruction named "SomeoneStartingAConversationWithMe" {
constituents are {
SimpleConstruction named "NewConversation" {
constituents are {
XMLTagWord named "
}
semantic operations are {
add :CONVERSATION rdf:type cyc:MultiDirectionalCommunication .
add :CONVERSATION cyc:deliberateActors texai:Texai .
add :CONVERSATION cyc:startingDate :NOW .
}
}
SequenceConstruction named “UtteranceToMe” {
constituents are {
SequenceConstruction named “FromUser” {
constituents are {
XMLTagWord named “
RegularExpression named “UserId_RegularExpressionConstruction” {
regular expression is “([a-zA-Z_\\-0-9]+)@([a-zA-Z_\\-0-9\\.]+)” .
substitution expression is “” .
group variables are [:USER-NAME :JABBER-HOST] .
}
XMLTagWord named “

}
semantic operations are {
add :DIALOG-USER rdf:type texai:DialogUser .
add :DIALOG-USER properNameStrings :USER-NAME .
add :CONVERSATION deliberateActors :DIALOG-USER .
add :CONVERSATION initiator :DIALOG-USER .
}
}
XMLTagWord named “”
SimpleConstruction named “FormalGreetingToMe” {
constituents are {
WordFormConstruction named “hello_Interjection-SpeechPart_hello_Interjection-SpeechPart_2″
}
semantic operations are {
add :GREETING-SOMEONE rdf:type cyc:GreetingSomeone ;
dateOfEvent :NOW ;
initiator :DIALOG-USER ;
deliberateActors :DIALOG-USER ;
senderOfInfo :DIALOG-USER ;
deliberateActors Texai ;
recipientOfInfo Texai .
add :CONVERSATION subProcesses :GREETING-SOMEONE .
}
}
XMLTagWord named “”
}
}
}
}
}

 

Given that I installed javacc at /home/reed/more/javacc-4.0, and that the location of the javacc grammar specification file is /home/reed/svn/Dialog/src/org/texai/grammar/parser/ConstructionParser.jj, here are the commands to generate the java parser:

 


> cd ~/svn/Dialog/src
> /home/reed/more/javacc-4.0/bin/javacc -OUTPUT_DIRECTORY="org/texai/grammar/parser/" org/texai/grammar/parser/ConstructionParser.jj