convlab2.policy.vector package

Submodules

convlab2.policy.vector.dataset module

class convlab2.policy.vector.dataset.ActDataset(s_s, a_s)

Bases: torch.utils.data.dataset.Dataset

class convlab2.policy.vector.dataset.ActStateDataset(s_s, a_s, next_s)

Bases: torch.utils.data.dataset.Dataset

convlab2.policy.vector.vector_camrest module

class convlab2.policy.vector.vector_camrest.CamrestVector(voc_file, voc_opp_file, character='sys', intent_file='/home/travis/build/thu-coai/ConvLab-2/data/camrest/trackable_intent.json')

Bases: convlab2.policy.vec.Vector

action_devectorize(action_vec)

recover an action

Args:
action_vec (np.array):

Dialog act vector

Returns:

action (tuple): Dialog act

action_vectorize(action)
generate_dict()

init the dict for mapping state/action into vector

one_hot_vector(num)

Return number of available entities for particular domain.

pointer(turn)
state_vectorize(state)

vectorize a state

Args:
state (dict):

Dialog state

action (tuple):

Dialog act

Returns:

state_vec (np.array): Dialog state vector

convlab2.policy.vector.vector_crosswoz module

class convlab2.policy.vector.vector_crosswoz.CrossWozVector(sys_da_voc_json, usr_da_voc_json)

Bases: convlab2.policy.vec.Vector

action_devectorize(action_vec)

must call state_vectorize func before :param action_vec: :return:

action_vectorize(da)
generate_dict()

init the dict for mapping state/action into vector

state_vectorize(state)

vectorize a state

Args:
state (tuple):

Dialog state

Returns:
state_vec (np.array):

Dialog state vector

convlab2.policy.vector.vector_multiwoz module

class convlab2.policy.vector.vector_multiwoz.MultiWozVector(voc_file, voc_opp_file, character='sys', intent_file='/home/travis/build/thu-coai/ConvLab-2/data/multiwoz/trackable_intent.json', composite_actions=False, vocab_size=500)

Bases: convlab2.policy.vec.Vector

action_devectorize(action_vec)

recover an action Args:

action_vec (np.array):

Dialog act vector

Returns:
action (tuple):

Dialog act

action_vectorize(action)
dbquery_domain(domain)

query entities of specified domain Args:

domain string:

domain to query

Returns:
entities list:

list of entities of the specified domain

generate_dict()

init the dict for mapping state/action into vector

load_composite_actions()

load the composite actions to self.da_voc

one_hot_vector(num, domain, vector)

Return number of available entities for particular domain.

pointer(turn)
state_vectorize(state)

vectorize a state

Args:
state (dict):

Dialog state

action (tuple):

Dialog act

Returns:
state_vec (np.array):

Dialog state vector

Module contents