tatk.policy.rule.camrest package

Submodules

tatk.policy.rule.camrest.policy_agenda_camrest module

class tatk.policy.rule.camrest.policy_agenda_camrest.Agenda(goal: tatk.policy.rule.camrest.policy_agenda_camrest.Goal)

Bases: object

__init__(goal: tatk.policy.rule.camrest.policy_agenda_camrest.Goal)

Build a new agenda from goal Args:

goal (Goal): User goal.

close_session()

Clear up all actions

get_action(initiative=1)

get multiple acts based on initiative Args:

initiative (int): number of slots , just for ‘inform’

Returns:

action (dict): user diaact

is_empty()

Is the agenda already empty Returns:

(boolean): True for empty, False for not.

update(sys_action, goal: tatk.policy.rule.camrest.policy_agenda_camrest.Goal)

update Goal by current agent action and current goal. { A’ + G” + sys_action -> A” } Args:

sys_action (tuple): Preorder system action.s goal (Goal): User Goal

update_domain(diaact, slot_vals, goal: tatk.policy.rule.camrest.policy_agenda_camrest.Goal)

Handel Domain-XXX :param diaact: Dial-Act :param slot_vals: slot value pairs :param goal: Goal :return: True:user want to close the session. False:session is continue

class tatk.policy.rule.camrest.policy_agenda_camrest.Goal(goal_generator: tatk.task.camrest.goal_generator.GoalGenerator)

Bases: object

User Goal Model Class.

__init__(goal_generator: tatk.task.camrest.goal_generator.GoalGenerator)

create new Goal by random Args:

goal_generator (GoalGenerator): Goal Gernerator.

next_domain_incomplete()
task_complete()

Check that all requests have been met Returns:

(boolean): True to accomplish.

class tatk.policy.rule.camrest.policy_agenda_camrest.UserPolicyAgendaCamrest

Bases: tatk.policy.policy.Policy

The rule-based user policy model by agenda. Derived from the UserPolicy class

__init__()

Constructor for User_Policy_Agenda class.

get_goal()
get_reward()
init_session()

Build new Goal and Agenda for next session

is_terminated()
predict(state)

Predict an user act based on state and preorder system action. Args:

state (tuple): Dialog state.

Returns:

action (tuple): User act. session_over (boolean): True to terminate session, otherwise session continues. reward (float): Reward given by user.

tatk.policy.rule.camrest.policy_agenda_camrest.test()
tatk.policy.rule.camrest.policy_agenda_camrest.test_turn(user_simulator, sys_action)
tatk.policy.rule.camrest.policy_agenda_camrest.test_with_system()

tatk.policy.rule.camrest.rule module

class tatk.policy.rule.camrest.rule.Rule(is_train=False, character='sys')

Bases: tatk.policy.policy.Policy

__init__(is_train=False, character='sys')

Initialize self. See help(type(self)) for accurate signature.

get_goal()
get_reward()
init_session()

Restore after one session

is_terminated()
predict(state)

Predict an system action given state. Args:

state (dict): Dialog state. Please refer to util/state.py

Returns:

action : System act, with the form of (act_type, {slot_name_1: value_1, slot_name_2, value_2, …})

tatk.policy.rule.camrest.rule_based_camrest_bot module

class tatk.policy.rule.camrest.rule_based_camrest_bot.RuleBasedCamrestBot

Bases: tatk.policy.policy.Policy

Rule-based bot. Implemented for Camrest dataset.

__init__()

Initialize self. See help(type(self)) for accurate signature.

choice = ''
init_session()

Init the class variables for a new session.

predict(state)
Args:

State, please refer to util/state.py

Output:

DA(Dialog Act), in the form of {act_type1: [[slot_name_1, value_1], [slot_name_2, value_2], …], …}

tatk.policy.rule.camrest.rule_based_camrest_bot.check_diff(last_state, state)
tatk.policy.rule.camrest.rule_based_camrest_bot.deduplicate(lst)
tatk.policy.rule.camrest.rule_based_camrest_bot.fake_state()
tatk.policy.rule.camrest.rule_based_camrest_bot.generate_ref_num(length)

Generate a ref num for booking.

tatk.policy.rule.camrest.rule_based_camrest_bot.test_init_state()
tatk.policy.rule.camrest.rule_based_camrest_bot.test_run()