.. warning:: Documentation not done. ************************ ''' import copy import Policy import DMUtils import SummaryMapping import Settings import ContextLogger logger = ContextLogger.getLogger(__name__) MAX_NUM_ACCEPTED = 10 """ Notes on proposed changes: this module only needs the list of system_requestable slots - perhaps rather than passing a whole instance of DomainUtils.DomainUtils() - we could just pass the list ? """ class HDCPolicy(Policy.Policy): """Handcrafted policy overrides Policy base class.
import :class:`DiaAct` |.| import :class:`DomainUtils` |.| import :class:`Settings` |.| import :class:`ContextLogger` ************************ ''' __author__='donghokim, davidvandyke' import copy import Settings import DiaAct import DomainUtils import ContextLogger logger = ContextLogger.getLogger('') class EMConfusionModel(object): '''Base class for EMRandomConfusionModel. .. Note:: Used through derived class only. ''' def create_wrong_hyp(self, a_u): '''Create a wrong hypothesis for a_u :param a_u: (instance) of :class:`DiaAct` :returns: (instance) of :class:`DiaAct` - modified input act ''' confact_is_same = True
######################################################### """ RegexSemI_TSBplayer.py - regular expression based TSBplayer SemI decoder ========================================================================= HELPFUL: http://regexr.com """ import RegexSemI import re, os parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) os.sys.path.insert(0, parentdir) import ContextLogger logger = ContextLogger.getLogger('') import DomainUtils import Settings class RegexSemI_TSBplayer(RegexSemI.RegexParser): """ """ def __init__(self, repoIn=None): RegexSemI.RegexParser.__init__( self, repoIn ) #better than super() here - wont need to be changed for other domains self.domainTag = "TSBplayer" #FIXME self.create_domain_dependent_regex() def create_domain_dependent_regex(self):
import numpy as np import random import math import copy from collections import deque from collections import OrderedDict from scipy import linalg, mat, dot import GPPolicy import DMUtils import DomainUtils import Policy import SummaryAction import Settings import ContextLogger logger = ContextLogger.getLogger(__name__) import itertools class DataPoint(object): def __init__(self, b, a): self.b = b # belief point self.a = a # action def __eq__(self, other): return (self.b == other.b and self.a == other.a) class DataPointValue(object): def __init__(self, Q, N): self.Q = Q # Q value
************************ ''' __author__ = "donghokim, davidvandyke" import argparse import ContextLogger import Settings import DomainUtils import DMan import TopicManager from semi import SemI from semo import SemO logger = ContextLogger.getLogger('') class ConsoleHub(): '''text based dialog system :param None: ''' def __init__(self): if not Settings.config.has_option("DEFAULT","domains"): logger.error("You must specify the domains under the DEFAULT section of the config") domains = Settings.config.get("DEFAULT",'domains') logger.info('--Dialogues over the domains: ', domains) configlist = []
.. warning:: Documentation not done. ************************ """ __author__ = "milicagasic" import SummaryMapping import Settings import DMUtils import ContextLogger logger = ContextLogger.getLogger("") MAX_NUM_ACCEPTED = 10 class SummaryAction: """ :param domainUtil: (instance) of :class:`DomainUtils.DomainUtils` """ def __init__(self, domainUtil): self.domainUtil = domainUtil self.action_names = [] for slot in self.domainUtil.ontology["system_requestable"]: self.action_names.append("request_" + slot) self.action_names.append("confirm_" + slot)
''' __author__="donghokim, davidvandyke" from collections import defaultdict import math import pprint import copy import Settings import SummaryMapping import dact import agentutils import ContextLogger from practical1_dst.scripts import baseline #module in belieftracking dir that actually implements the Baseline and Focus trackers (DSTC names) logger = ContextLogger.getLogger(__name__) #'belieftracking.BeliefTracker') class BeliefTracker(object): '''Belief Tracker base class that implements most of the functionality within the dialogue system. The actual inference problem of belief tracking (ASR/SLU --> belief state update) is implemented by individual trackers in baseline.py. Hence this class will never be instantiated, it just implements common functionality.''' def __init__(self, domainUtil): self.prevbelief = None self.informedVenueSinceNone = None self.turn = 0 self.domainUtil = domainUtil self.CONDITIONAL_BELIEF_PROB = 0.8 # give 0.8 prob mass to slot-vals that occured in prev domains. #TODO config? def str(self): return pprint.pformat(agentutils.simplify_belief(self.domainUtil.ontology, self.prevbelief))
import numpy as np import Settings import DMan import UserSimulator import ErrorSimulator from semo import SemO import TopicManager import DomainUtils import Evaluation import ContextLogger try: import cPickle as pickle except: import pickle logger = ContextLogger.getLogger(__name__) class SimulationSystem: """Semantic level simulated dialog system :param generate_prompts: (bool) semo output """ def __init__(self, generate_prompts): configs = [] if not Settings.config.has_option("DEFAULT", "domains"): logger.error("You must specify the domains under the DEFAULT section of the config") domains = Settings.config.get("DEFAULT", "domains")
import :class:`BeliefTracker` |.| from :class:`policy` import :meth:`SummaryAction` |.| import :class:`ContextLogger` ************************ ''' __author__ = "donghokim, davidvandyke" import Settings import BeliefTracker import DomainUtils from policy import SummaryAction import ContextLogger logger = ContextLogger.getLogger('') class DMan: '''Dialogue manager: controls all policy type/instance and policy learning choices. ''' def __init__(self, domainUtil): """ Constructor for Dialogue manager: has a belief state tracker and a policy. :param domainUtil: (instance) of :class:`DomainUtils` :return: """ configlist = ['policytype'] self.useconfreq = False self.actions = SummaryAction.SummaryAction(domainUtil) self.bcm = False
import :class:`BeliefTracker` |.| from :class:`policy` import :meth:`SummaryAction` |.| import :class:`ContextLogger` ************************ ''' __author__="donghokim, davidvandyke" import Settings import BeliefTracker import DomainUtils from policy import SummaryAction import ContextLogger logger = ContextLogger.getLogger('') class DMan: '''Dialogue manager: controls all policy type/instance and policy learning choices. ''' def __init__(self,domainUtil): """ Constructor for Dialogue manager: has a belief state tracker and a policy. :param domainUtil: (instance) of :class:`DomainUtils` :return: """ configlist = ['policytype'] self.useconfreq = False self.actions = SummaryAction.SummaryAction(domainUtil) self.bcm = False
__author__ = "donghokim, davidvandyke" from collections import defaultdict import math import pprint import copy import Settings import SummaryMapping import dact import agentutils import ContextLogger from practical1_dst.scripts import baseline #module in belieftracking dir that actually implements the Baseline and Focus trackers (DSTC names) logger = ContextLogger.getLogger(__name__) #'belieftracking.BeliefTracker') class BeliefTracker(object): '''Belief Tracker base class that implements most of the functionality within the dialogue system. The actual inference problem of belief tracking (ASR/SLU --> belief state update) is implemented by individual trackers in baseline.py. Hence this class will never be instantiated, it just implements common functionality.''' def __init__(self, domainUtil): self.prevbelief = None self.informedVenueSinceNone = None self.turn = 0 self.domainUtil = domainUtil self.CONDITIONAL_BELIEF_PROB = 0.8 # give 0.8 prob mass to slot-vals that occured in prev domains. #TODO config? def str(self): return pprint.pformat(
import argparse import numpy as np import Settings import DMan import UserSimulator import ErrorSimulator from semo import SemO import TopicManager import DomainUtils import Evaluation import ContextLogger try: import cPickle as pickle except: import pickle logger = ContextLogger.getLogger(__name__) class SimulationSystem: '''Semantic level simulated dialog system :param generate_prompts: (bool) semo output ''' def __init__(self, generate_prompts): configs = [] if not Settings.config.has_option("DEFAULT", "domains"): logger.error( "You must specify the domains under the DEFAULT section of the config" )