convlab2.nlg.sclstm.camrest package

Submodules

convlab2.nlg.sclstm.camrest.evaluate module

Evaluate NLG models on utterances of Camrest test dataset Metric: dataset level BLEU-4, slot error rate Usage: python evaluate.py [usr|sys|all]

convlab2.nlg.sclstm.camrest.evaluate.get_bleu4(dialog_acts, golden_utts, gen_utts)
convlab2.nlg.sclstm.camrest.evaluate.get_err_slot(dialog_acts, gen_slots)

convlab2.nlg.sclstm.camrest.sc_lstm module

class convlab2.nlg.sclstm.camrest.sc_lstm.SCLSTM(archive_file='/home/travis/build/thu-coai/ConvLab-2/convlab2/nlg/sclstm/camrest/models/nlg-sclstm-camrest.zip', use_cuda=False, is_user=False, model_file='https://convlab.blob.core.windows.net/convlab-2/nlg_sclstm_camrest.zip')

Bases: convlab2.nlg.nlg.NLG

generate(meta)

Generate a natural language utterance conditioned on the dialog act.

Args:
action (list of list):

The dialog action produced by dialog policy module, which is in dialog act format.

Returns:
utterance (str):

A natural langauge utterance.

generate_delex(dialog_acts)

dialog_acts = [[intent, slot, value],…]] => meta = {“inform”: [[“area”,”centre of town”]]}

generate_slots(meta)
convlab2.nlg.sclstm.camrest.sc_lstm.parse(is_user)

convlab2.nlg.sclstm.camrest.train module

convlab2.nlg.sclstm.camrest.train.evaluate(config, dataset, model, data_type, beam_search, beam_size, batch_size)
convlab2.nlg.sclstm.camrest.train.get_slot_error(dataset, gens, refs, sv_indexes)
Args:

gens: (batch_size, beam_size) refs: (batch_size,) sv: (batch_size,)

Returns:

count: accumulative slot error of a batch countPerGen: slot error for each sample

convlab2.nlg.sclstm.camrest.train.interact(config, args)
convlab2.nlg.sclstm.camrest.train.parse()
convlab2.nlg.sclstm.camrest.train.read(config, args, mode)
convlab2.nlg.sclstm.camrest.train.score(feat, gen, template)

feat = [‘d-a-s-v:Booking-Book-Day-1’, ‘d-a-s-v:Booking-Book-Name-1’, ‘d-a-s-v:Booking-Book-Name-2’] gen = ‘xxx slot-booking-book-name xxx slot-booking-book-time’

convlab2.nlg.sclstm.camrest.train.str2bool(v)
convlab2.nlg.sclstm.camrest.train.test(config, args)
convlab2.nlg.sclstm.camrest.train.train(config, args)
convlab2.nlg.sclstm.camrest.train.train_epoch(config, dataset, model)

Module contents