convlab2.nlg.sclstm.crosswoz package¶
Submodules¶
convlab2.nlg.sclstm.crosswoz.evaluate module¶
Evaluate NLG models on utterances of Multiwoz_zh test dataset Metric: dataset level BLEU-4, slot error rate Usage: python evaluate.py [usr|sys|all]
-
convlab2.nlg.sclstm.crosswoz.evaluate.
get_bleu4
(dialog_acts, golden_utts, gen_utts, data_key)¶
-
convlab2.nlg.sclstm.crosswoz.evaluate.
get_err_slot
(dialog_acts, gen_slots)¶
-
convlab2.nlg.sclstm.crosswoz.evaluate.
split_delex_sentence
(sen)¶
-
convlab2.nlg.sclstm.crosswoz.evaluate.
value_replace
(sentences, dialog_act)¶
convlab2.nlg.sclstm.crosswoz.generate_resources module¶
-
convlab2.nlg.sclstm.crosswoz.generate_resources.
main
()¶
-
convlab2.nlg.sclstm.crosswoz.generate_resources.
read_json
(filename)¶
convlab2.nlg.sclstm.crosswoz.sc_lstm module¶
-
class
convlab2.nlg.sclstm.crosswoz.sc_lstm.
SCLSTM
(archive_file='/home/travis/build/thu-coai/ConvLab-2/convlab2/nlg/sclstm/crosswoz/models/nlg_sclstm_crosswoz.zip', use_cuda=False, is_user=False, model_file='https://convlab.blob.core.windows.net/convlab-2/nlg_sclstm_crosswoz.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
(meta)¶ - meta = [
- [
“General”, “greet”, “none”, “none”
], [
“Request”, “景点”, “名称”, “”
], [
“Inform”, “景点”, “门票”, “免费”
]
]
-
generate_slots
(meta)¶
-
-
convlab2.nlg.sclstm.crosswoz.sc_lstm.
parse
(is_user)¶
convlab2.nlg.sclstm.crosswoz.train module¶
-
convlab2.nlg.sclstm.crosswoz.train.
evaluate
(config, dataset, model, data_type, beam_search, beam_size, batch_size)¶
-
convlab2.nlg.sclstm.crosswoz.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.crosswoz.train.
interact
(config, args)¶
-
convlab2.nlg.sclstm.crosswoz.train.
parse
()¶
-
convlab2.nlg.sclstm.crosswoz.train.
read
(config, args, mode)¶
-
convlab2.nlg.sclstm.crosswoz.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.crosswoz.train.
str2bool
(v)¶
-
convlab2.nlg.sclstm.crosswoz.train.
test
(config, args)¶
-
convlab2.nlg.sclstm.crosswoz.train.
train
(config, args)¶
-
convlab2.nlg.sclstm.crosswoz.train.
train_epoch
(config, dataset, model)¶