core.fbdialog_teacher

This module provides access to data in the Facebook Dialog format.

The way FB Dialog data is set up is as follows:

1 Sam went to the kitchen.
2 Pat gave Sam the milk.
3 Where is the milk?<TAB>kitchen<TAB>1<TAB>hallway|kitchen|bathroom
4 Sam went to the hallway
5 Pat went to the bathroom
6 Where is the milk?<TAB>hallway<TAB>1<TAB>hallway|kitchen|bathroom

Lines 1-6 represent a single episode, with two different examples: the first example is lines 1-3, and the second is lines 4-6.

Lines 1,2,4, and 5 represent contextual information.

Lines 3 and 6 contain a query, a label, a reward for getting the question correct, and three label candidates.

Since both of these examples are part of the same episode, the information provided in the first example is relevant to the query in the second example and therefore the agent must remember the first example in order to do well.

In general dialog in this format can be any speech, not just QA pairs:

1 Hi how's it going?<TAB>It's going great. What's new?
2 Well I'm working on a new project at work.<TAB>Oh me too!
3 Oh cool!<TAB>Tell me about yours.

etc.

class parlai.core.fbdialog_teacher.FbDialogTeacher(opt, shared=None)

Subclasses DialogTeacher for functionality and provides an implementation of setup_data() which iterates over datasets in the “fbdialog” format.

load_cands(path)

Load global fixed set of candidate labels that the teacher provides every example (the true labels for a specific example are also added to this set, so that it’s possible to get the right answer).

setup_data(path)

Reads data in the fbdialog format.

Returns ((x,y,r,c), new_episode?) tuples.

x represents a query, y represents the labels, r represents any reward, and c represents any label_candidates.

The example above will be translated into the following tuples:

x: 'Sam went to the kitchen\nPat gave Sam the milk\nWhere is the milk?'
y: ['kitchen']
r: '1'
c: ['hallway', 'kitchen', 'bathroom']
new_episode = True (this is the first example in the episode)
x: 'Sam went to the hallway\nPat went to the bathroom\nWhere is the
    milk?'
y: ['hallway']
r: '1'
c: ['hallway', 'kitchen', 'bathroom']
new_episode = False (this is the second example in the episode)