Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Codes for the paper "A Weakly Supervised Method for Topic Segmentation and Labeling in Goal-oriented Dialogues via Reinforcement Learning", and you can find our paper at here

Cite this paper:

  title={A Weakly Supervised Method for Topic Segmentation and Labeling in Goal-oriented Dialogues via Reinforcement Learning},
  author={Takanobu, Ryuichi and Huang, Minlie and Zhao, Zhongzhou and Li, Fenglin and Chen, Haiqing and Nie, Liqiang and Zhu, Xiaoyan},

Data Format

Note: Since the dialogue datasets used in the paper derive from an E-commerce services platform, to protect users' privacy concerns, we are sorry that the datasets will not be published at present. So, we provide the data format instead here for others to use our codes with their own corpus.

As can be seen in the directory ./code/example, the data required for the model are separated into 7 files:


This file contains the word embedding vector for the datasets. Each row consists of a floating point array of length embed_units, and there are symbols rows in all .


The main data. The file contains multiple dialogue sessions in the following format:

label_1, data_1
label_2, data_2
label_N, data_N

where label_i is the topic category for the ith sentence data_i (The labels of training/validation data are obtained according to 3.1 Noisy Labeling with Prior Knowledge in the paper, which are noisy)

The words of ith sentence (i.e. data_i) is in the form of string, which are concatenated with / signs, and each word is replaced by its index in my_vector file.


The file contains the related keywords information for each dialogue sessions:

key_1, value_1
key_2, value_2
key_N, value_N

where key_i is the topic category assigned by keyword matching but without nearest neighboring (see 3.1 Noisy Labeling with Prior Knowledge for details), and value_i for the corresponding frequency value (i.e. The keywords of topic key_ihave appeared value_i times in the sentence data_i.)

If a sentence contains no keyword, or there are two topic categories that both's keywords appear most times in a sentence, key_iwill be set to -1. In this case, the value_i is also set to -1.



cd code
python {--[option1]=[value1] --[option2]=[value2] ... }

Change the corresponding options to set hyperparameters:"symbols", 12210, "vocabulary size.")"labels", 7, "Number of topic labels.")"epoch_pre", 2, "Number of epoch on pretrain.")"epoch_max", 15, "Maximum of epoch in iterative training.")"embed_units", 100, "Size of word embedding.")"hidden_units", 100, "Size of hidden layer.")"sample_round", 4, "Sample round in RL.")"keyword", 3.0, "Coefficient of keyword reward.")"continuity", 1.0, "Coefficient of continuity reward.")"learning_rate_srn", 0.0001, "SRN Learning rate.")"learning_rate_pn", 0.00001, "PN Learning rate.")"keep_prob", 0.5, "Drop out rate.")"softmax_smooth", 0.5, "Discount rate in softmax.")"threshold", 0.005, "Threshold to judge the convergence.")"log_parameters", True, "Set to True to show the parameters.")"is_train", True, "Set to False to inference.")"data_dir", "./data", "Data directory.")"train_filename", "train", "Filename for training set.")"valid_filename", "valid", "Filename for validation set.")"test_filename", "test", "Filename for test set.")"word_vector_filename", "my_vector", "Filename for word embedding vector.")"train_dir_srn", "./train_srn", "SRN Training directory.")"train_dir_pn", "./train_pn", "PN Training directory.")

The states of SRN are saved at FLAGS.train_dir_srn + '/states_' + FLAGS.XXX_filename

The labels of PN are saved at FLAGS.train_dir_pn + '/labels_' + FLAGS.XXX_filename


tensorflow >= 1.0


Weakly Supervised Topic Segmentation and Labeling







No releases published


No packages published