alex.components.dm package¶
Submodules¶
alex.components.dm.autopath module¶
self cloning, automatic path configuration
copy this into any subdirectory of pypy from which scripts need to be run, typically all of the test subdirs. The idea is that any such script simply issues
import autopath
and this will make sure that the parent directory containing “pypy” is in sys.path.
If you modify the master “autopath.py” version (in pypy/tool/autopath.py) you can directly run it which will copy itself on all autopath.py files it finds under the pypy root directory.
This module always provides these attributes:
pypydir pypy root directory path this_dir directory where this autopath.py resides
alex.components.dm.base module¶
- class alex.components.dm.base.DialogueManager(cfg)[source]¶
Bases: object
This is a base class for a dialogue manager. The purpose of a dialogue manager is to accept input in the form dialogue acts and respond again in the form of dialogue acts.
The dialogue manager should be able to accept multiple inputs without producing any output and be able to produce multiple outputs without any input.
- class alex.components.dm.base.DialoguePolicy(cfg, ontology)[source]¶
Bases: object
This is a base class policy.
- class alex.components.dm.base.DialogueState(cfg, ontology)[source]¶
Bases: object
This is a trivial implementation of a dialogue state and its update.
It uses only the best dialogue act from the input and based on this it updates its state.
- get_slots_being_confirmed()[source]¶
Returns all slots which are currently being confirmed by the user along with the value being confirmed.
- get_slots_being_noninformed()[source]¶
Returns all slots provided by the user and the system has not informed about them yet along with the value of the slot.
- get_slots_being_requested()[source]¶
Returns all slots which are currently being requested by the user along with the correct value.
- restart()[source]¶
Reinitialises the dialogue state so that the dialogue manager can start from scratch.
Nevertheless, remember the turn history.
- update(user_da, system_da)[source]¶
Interface for the dialogue act update.
It can process dialogue act, dialogue act N best lists, or dialogue act confusion networks.
Parameters: - user_da (DialogueAct, DialogueActNBList or DialogueActConfusionNetwork) – Dialogue act to process.
- system_da – Last system dialogue act.
- class alex.components.dm.base.DiscreteValue(values, name='', desc='')[source]¶
Bases: object
- explain(full=False, linear_prob=False)[source]¶
This function prints the values and their probabilities for this node.
alex.components.dm.common module¶
alex.components.dm.dddstate module¶
alex.components.dm.dstc_tracker module¶
alex.components.dm.dummypolicy module¶
alex.components.dm.exceptions module¶
- exception alex.components.dm.exceptions.DMException[source]¶
Bases: alex.AlexException
- exception alex.components.dm.exceptions.DialogueManagerException[source]¶
Bases: alex.AlexException
- exception alex.components.dm.exceptions.DialoguePolicyException[source]¶
Bases: alex.AlexException
- exception alex.components.dm.exceptions.DialogueStateException[source]¶
Bases: alex.AlexException
- exception alex.components.dm.exceptions.DummyDialoguePolicyException[source]¶
Bases: alex.components.dm.exceptions.DialoguePolicyException
alex.components.dm.ontology module¶
- class alex.components.dm.ontology.Ontology(file_name=None)[source]¶
Bases: object
Represents an ontology for a dialogue domain.
- get_compatible_vals(slot_pair, value)[source]¶
Given a slot pair (key to ‘compatible_values’ in ontology data), this returns the set of compatible values for the given key. If there is no information about the given pair, None is returned.
Parameters: - slot_pair – key to ‘compatible_values’ in ontology data
- value – the subkey to check compatible values for
Return type: set
- get_default_value(slot)[source]¶
Given a slot name, get its default value (if set in the ontology). Returns None if the default value is not set for the given slot.
Parameters: slot – the name of the desired slot Return type: unicode
- is_compatible(slot_pair, val1, val2)[source]¶
Given a slot pair and a pair of values, this tests whether the values are compatible. If there is no information about the slot pair or the first value, returns False. If the second value is None, returns always True (i.e. None is compatible with anything).
Parameters: - slot_pair – key to ‘compatible_values’ in ontology data
- val1 – value of the 1st slot
- val2 – value of the 2nd slot
Return type: Boolean
- last_talked_about(*args, **kwds)[source]¶
Returns a list of slots and values that should be used to for tracking about what was talked about recently, given the input dialogue acts.
Parameters: - da_type – the source dialogue act type
- name – the source slot name
- value – the source slot value
Returns: returns a list of target slot names and values used for tracking
alex.components.dm.pstate module¶
- class alex.components.dm.pstate.PDDiscrete(initial=None)[source]¶
Bases: alex.components.dm.pstate.PDDiscreteBase
Discrete probability distribution.
- NULL = None¶
- OTHER = '<other>'¶
- meta_slots = set([None, '<other>'])¶