convlab2.policy.rule.camrest package

Submodules

convlab2.policy.rule.camrest.policy_agenda_camrest module

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

Bases: object

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: convlab2.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: convlab2.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 convlab2.policy.rule.camrest.policy_agenda_camrest.Goal(goal_generator: convlab2.task.camrest.goal_generator.GoalGenerator)

Bases: object

User Goal Model Class.

next_domain_incomplete()
task_complete()

Check that all requests have been met Returns:

(boolean): True to accomplish.

class convlab2.policy.rule.camrest.policy_agenda_camrest.UserPolicyAgendaCamrest

Bases: convlab2.policy.policy.Policy

The rule-based user policy model by agenda. Derived from the UserPolicy 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.

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

convlab2.policy.rule.camrest.rule module

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

Bases: convlab2.policy.policy.Policy

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, …})

convlab2.policy.rule.camrest.rule_based_camrest_bot module

class convlab2.policy.rule.camrest.rule_based_camrest_bot.RuleBasedCamrestBot

Bases: convlab2.policy.policy.Policy

Rule-based bot. Implemented for Camrest dataset.

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], …], …}

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

Generate a ref num for booking.

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

Module contents