One of the main aims of PyDial is to provide a common statistical dialogue system framework where people are able to create and evaluate dialogues about their own domain. Therefore, adding a new domain has been made very easy. All you need is the respective data base, e.g., about restaurants in Cambridge.
If your data is quite simple (like, eg. CamRestaurants) you might be able to use the ontology creation script explaine din the following section. If you have a more complex domain with custom queries, custom user gal selection, or custom simulator environment, you can learn to load your own implementations in the final section of this part of the tutorials.
The data base should contain one table containing all necessary information and meet the following requirements:
To create a new domain, all you need to do is to execute the following python tool:
python scripts/ontologyTool.py -n -d NEW_DOMAIN_NAME -db PATH_TO_DB_FILE --type ENTITY_TYPE
The type is the type of the entity contained in your data base. It may be used to distinguish between different domains. As an example, the call to the python script to create CamRestaurants would look like this:
python scripts/ontologyTool.py -n -d CamRestaurants -db ontology/ontologies/CamRestaurants-dbase.db --type restaurant
Doing this will lead you though a step-wise process where you have to select which columns of your data base table are part of which functional set of slots of the dialogue (informable, system requestable, requestable, binary).
First, the script asks for the informable slots. By pressing the number of a slot and confirming it with ENTER, the respective slot gets marked with a star. Once all slots have been chosen, simply press ENTER without a number and you can continue to selecting the next type of slots.
A screen shot showing the selection of all informable slots of CamRestaurants is shown in the following:
The slot types explained:
In this section, we describe how to customize domain behaviour and what to do if your database is not organised in one single table.
If you are able to create ontology rules in a flat format (like ontology/ontologies/CamRestaurants-rules.json) for your domain, you can still use pydial without major changes even if you r table structure is more complex. The Python module which handles each domain may be dynamically loaded using the config file. The respective config entries are in a new section called [ontology_<domainname>], e.g.:
[ontology_CamRestaurants]
handler=ontology.FlatOntologyManager.FlatDomainOntology
The module referenced above also provides the interface description to be used. Please refer to the tutorial "How to add your own module" for a general description on how to add new modules.
If you need custom user simulator behaviour, you can dynamically load own module implementations as well for the goal generator (which generates the user goals) and the user simulator model which is the core module describing the simulator behaviour. For the latter, there is currently only an implementation available using probabilistic rules but by loading a dyniamic module, this can easily be changed. The config settings are
[usermodel_CamRestaurants]
goalgenerator = usersimulator.UserModel.GoalGenerator
usersimulator = usersimulator.UMHdcSim.UMHdcSim
For the interface definition of the goal generator, the above stated class is used. For the user simulator, all classes inherit from usersimulator.UMSimulator.UMSimulator.