Beispiel #1
0
    def __init__(self,
                 opt,
                 datatype: str = 'train',
                 seed: Optional[int] = None):
        """
        Initalize the context generator.

        opt: only a 'datapath' key is required, to specify the ParlAI data folder
        """

        if seed is not None:
            self.rng = random.Random(seed)
        else:
            self.rng = random.Random()

        convai2_opt = Opt({'datapath': opt['datapath'], 'datatype': datatype})
        self.convai2_teacher = BothTeacher(convai2_opt)

        ed_opt = Opt({
            'datapath': opt['datapath'],
            'datatype': datatype,
            'train_experiencer_only': True,
        })
        # Specify train_experiencer_only = True because we want to ensure that the text
        # will correspond to a Speaker utterance and the label to a Listener response
        self.ed_teacher = EmpatheticDialoguesTeacher(ed_opt)

        wow_opt = Opt({'datapath': opt['datapath'], 'datatype': datatype})
        self.wow_teacher = WizardDialogKnowledgeTeacher(wow_opt)

        self.topic_to_persona_path = _topic_to_persona_path(opt)
        self.wow_topics_to_episode_idxes = self._setup_topics_to_episodes()
        self.persona_strings_to_wow_topics = self._setup_personas_to_topics()
Beispiel #2
0
 def add_cmdline_args(cls, argparser):
     EmpatheticDialoguesTeacher.add_cmdline_args(argparser)
     agent = argparser.add_argument_group('EDPersonaTopicifierTeacher arguments')
     agent.add_argument(
         '--recompile-persona-topic-data',
         type='bool',
         default=cls.RECOMPILE_DEFAULT,
         help='Re-compile data with ConvAI2 personas and WoW topics added. Only useful for demonstrating how data was produced.',
     )
Beispiel #3
0
    def __init__(self, opt, shared=None):
        super().__init__(opt, shared)
        self.opt = opt

        self.datatype = opt['datatype']
        base_datatype = self.datatype.split(':')[0]
        self.datapath = os.path.join(
            self.opt['datapath'],
            'empatheticdialoguesru',
            'empatheticdialoguesru',
            base_datatype + '.csv',
        )
        suffix = 'train' if opt['datatype'].startswith('train') else 'dev'
        
        self.id = 'empathetic_dialogues_ru'

        self.experiencer_side_only = (
            opt.get('train_experiencer_only', DEFAULT_TRAIN_EXPERIENCER_ONLY)
            and base_datatype == 'train'
        ) or base_datatype != 'train'
        if not shared:
            print(
                f'[EmpatheticDialoguesRUTeacher] Only use experiencer side? '
                f'{self.experiencer_side_only}, datatype: {self.datatype}'
            )
        self.remove_political_convos = opt.get(
            'remove_political_convos', DEFAULT_REMOVE_POLITICAL_CONVOS
        )
        self.batch_size = opt.get(
            'batch_size', DEFAULT_BATCH_SIZE
        )
        
        if shared:
            self.data = shared['data']
        else:
            # Actual non-boilerplate code
            build(opt)
            EmpatheticDialoguesTeacher._setup_data(self, base_datatype)

        self.num_exs = sum([len(d) for d in self.data])
        self.num_eps = len(self.data)
        self.reset()
Beispiel #4
0
class ContextGenerator:
    """
    Generates contexts shown to crowdsourced workers when collecting BST conversations.

    This generator was used to generate the context information shown to workers at the
    beginning of a conversation, when crowdsourcing the conversations that make up the
    BST dataset.
    """
    def __init__(self,
                 opt,
                 datatype: str = 'train',
                 seed: Optional[int] = None):
        """
        Initalize the context generator.

        opt: only a 'datapath' key is required, to specify the ParlAI data folder
        """

        if seed is not None:
            self.rng = random.Random(seed)
        else:
            self.rng = random.Random()

        convai2_opt = Opt({'datapath': opt['datapath'], 'datatype': datatype})
        self.convai2_teacher = BothTeacher(convai2_opt)

        ed_opt = Opt({
            'datapath': opt['datapath'],
            'datatype': datatype,
            'train_experiencer_only': True,
        })
        # Specify train_experiencer_only = True because we want to ensure that the text
        # will correspond to a Speaker utterance and the label to a Listener response
        self.ed_teacher = EmpatheticDialoguesTeacher(ed_opt)

        wow_opt = Opt({'datapath': opt['datapath'], 'datatype': datatype})
        self.wow_teacher = WizardDialogKnowledgeTeacher(wow_opt)

        self.topic_to_persona_path = _topic_to_persona_path(opt)
        self.wow_topics_to_episode_idxes = self._setup_topics_to_episodes()
        self.persona_strings_to_wow_topics = self._setup_personas_to_topics()

    def get_context(self) -> dict:
        """
        Get context information to be shown at the beginning of one conversation.

        Values in return dict:
        - context_dataset: the dataset (ConvAI2, EmpatheticDialogues, or Wizard of
            Wikipedia) used to generate the context information.
        - persona_1_strings, persona_2_strings: 2 persona strings each for the two
            speakers, chosen randomly from the ConvAI2 dataset. If context_dataset ==
            "wizard_of_wikipedia", these persona strings will be matched to the WoW
            topic returned in the "additional_context" field.
        - additional_context: provides additional bits of information to give context
            for the speakers. If context_dataset == "empathetic_dialogues", this is a
            situation from the start of an ED conversation. If context_dataset ==
            "wizard_of_wikipedia", this is a topic from the WoW dataset that matches the
            persona strings. If context_dataset == "convai2", this is None.
        - person1_seed_utterance, person2_seed_utterance: two lines of a conversation
            from the dataset specified by "context_dataset". They will be shown to the
            speakers to "seed" the conversation, and the speakers continue from where
            the lines left off.
        """

        # Determine which dataset we will show context for
        rand_value = self.rng.random()
        if rand_value < 1 / 3:
            context_dataset = 'convai2'
        elif rand_value < 2 / 3:
            context_dataset = 'empathetic_dialogues'
        else:
            context_dataset = 'wizard_of_wikipedia'

        if context_dataset == 'convai2':

            # Select episode
            episode_idx = self.rng.randrange(
                self.convai2_teacher.num_episodes())

            # Extract personas
            persona_1_strings, persona_2_strings = self._extract_personas(
                episode_idx)

            # Sample persona strings
            selected_persona_1_strings = self.rng.sample(persona_1_strings, 2)
            selected_persona_2_strings = self.rng.sample(persona_2_strings, 2)

            # Select previous utterances
            num_entries = len(self.convai2_teacher.data.data[episode_idx])
            entry_idx = self.rng.randrange(1, num_entries)
            # Don't select the first entry, which often doesn't include an apprentice
            # utterance
            chosen_entry = self.convai2_teacher.get(episode_idx,
                                                    entry_idx=entry_idx)
            person1_seed_utterance = chosen_entry['text']
            assert len(chosen_entry['labels']) == 1
            person2_seed_utterance = chosen_entry['labels'][0]

            return {
                'context_dataset': context_dataset,
                'persona_1_strings': selected_persona_1_strings,
                'persona_2_strings': selected_persona_2_strings,
                'additional_context': None,
                'person1_seed_utterance': person1_seed_utterance,
                'person2_seed_utterance': person2_seed_utterance,
            }

        elif context_dataset == 'empathetic_dialogues':

            # Select episode
            persona_episode_idx = self.rng.randrange(
                self.convai2_teacher.num_episodes())

            # Extract personas
            persona_1_strings, persona_2_strings = self._extract_personas(
                persona_episode_idx)

            # Sample persona strings
            selected_persona_1_strings = self.rng.sample(persona_1_strings, 2)
            selected_persona_2_strings = self.rng.sample(persona_2_strings, 2)

            # Select previous utterances
            episode_idx = self.rng.randrange(self.ed_teacher.num_episodes())
            entry_idx = 0  # We'll only use the first pair of utterances
            entry = self.ed_teacher.get(episode_idx, entry_idx=entry_idx)
            situation = entry['situation']
            speaker_utterance = entry['text']
            assert len(entry['labels']) == 1
            listener_response = entry['labels'][0]

            return {
                'context_dataset': context_dataset,
                'persona_1_strings': selected_persona_1_strings,
                'persona_2_strings': selected_persona_2_strings,
                'additional_context': situation,
                'person1_seed_utterance': speaker_utterance,
                'person2_seed_utterance': listener_response,
            }

        elif context_dataset == 'wizard_of_wikipedia':

            # Pull different personas until you get a pair for which at least one
            # sentence has a WoW topic bound to it
            num_tries = 0
            while True:

                num_tries += 1

                # Extract a random (matched) pair of personas
                persona_episode_idx = self.rng.randrange(
                    self.convai2_teacher.num_episodes())
                all_persona_strings = dict()
                all_persona_strings[1], all_persona_strings[
                    2] = self._extract_personas(persona_episode_idx)

                # See if any of the persona strings have a matching WoW topic
                matching_persona_string_idxes = []
                for persona_idx, persona_strings in all_persona_strings.items(
                ):
                    for str_idx, str_ in enumerate(persona_strings):
                        wow_topics = self.persona_strings_to_wow_topics[str_]
                        if len(wow_topics) > 0:
                            matching_persona_string_idxes.append(
                                (persona_idx, str_idx))
                if len(matching_persona_string_idxes) > 0:
                    break

            print(
                f'{num_tries:d} try/tries needed to find a pair of personas with an '
                f'associated WoW topic.')

            # Pick out the WoW topic and matching persona string
            matching_persona_idx, matching_persona_string_idx = self.rng.sample(
                matching_persona_string_idxes, k=1)[0]
            matching_persona_string = all_persona_strings[
                matching_persona_idx][matching_persona_string_idx]
            wow_topic = self.rng.sample(
                self.persona_strings_to_wow_topics[matching_persona_string],
                k=1)[0]

            # Sample persona strings, making sure that we keep the one connected to the
            # WoW topic
            if matching_persona_idx == 1:
                remaining_persona_1_strings = [
                    str_ for str_ in all_persona_strings[1]
                    if str_ != matching_persona_string
                ]
                selected_persona_1_strings = [
                    matching_persona_string,
                    self.rng.sample(remaining_persona_1_strings, k=1)[0],
                ]
                self.rng.shuffle(selected_persona_1_strings)
                selected_persona_2_strings = self.rng.sample(
                    all_persona_strings[2], 2)
            else:
                selected_persona_1_strings = self.rng.sample(
                    all_persona_strings[1], 2)
                remaining_persona_2_strings = [
                    str_ for str_ in all_persona_strings[2]
                    if str_ != matching_persona_string
                ]
                selected_persona_2_strings = [
                    matching_persona_string,
                    self.rng.sample(remaining_persona_2_strings, k=1)[0],
                ]
                self.rng.shuffle(selected_persona_2_strings)

            # Sample WoW previous utterances, given the topic
            episode_idx = self.rng.sample(
                self.wow_topics_to_episode_idxes[wow_topic], k=1)[0]
            entry_idx = 1
            # Select the second entry, which (unlike the first entry) will always have
            # two valid utterances and which will not usually be so far along in the
            # conversation that the new Turkers will be confused
            entry = self.wow_teacher.get(episode_idx, entry_idx=entry_idx)
            apprentice_utterance = entry['text']
            assert len(entry['labels']) == 1
            wizard_utterance = entry['labels'][0]

            return {
                'context_dataset': context_dataset,
                'persona_1_strings': selected_persona_1_strings,
                'persona_2_strings': selected_persona_2_strings,
                'additional_context': wow_topic,
                'person1_seed_utterance': apprentice_utterance,
                'person2_seed_utterance': wizard_utterance,
            }

    def _setup_personas_to_topics(self) -> Dict[str, List[str]]:
        """
        Create a map from ConvAI2 personas to WoW topics that they correspond to.
        """

        print('Starting to map personas to topics.')

        persona_strings_to_topics = defaultdict(list)
        with PathManager.open(self.topic_to_persona_path, 'r') as f:
            for line in f:
                match = re.fullmatch(r'([^[]+): (\[.+\])\n', line)
                topic = match.group(1)
                if topic not in self.wow_topics_to_episode_idxes:
                    continue
                persona_strings = eval(match.group(2))
                assert isinstance(persona_strings, list)
                for str_ in persona_strings:
                    persona_strings_to_topics[str_].append(topic)

        print('Finished mapping personas to topics.')

        return persona_strings_to_topics

    def _setup_topics_to_episodes(self) -> Dict[str, List[int]]:
        """
        Create a map from WoW topics to the indices of the WoW episodes that use them.
        """

        print('Starting to map topics to episodes.')

        topics_to_episodes = defaultdict(list)
        for episode_idx in range(self.wow_teacher.num_episodes()):
            topic = self.wow_teacher.get(episode_idx,
                                         entry_idx=0)['chosen_topic']
            topics_to_episodes[topic].append(episode_idx)

        print('Finished mapping topics to episodes.')

        return topics_to_episodes

    def _extract_personas(self,
                          episode_idx: str) -> Tuple[List[str], List[str]]:
        """
        For the given ConvAI2 conversation, return strings of both speakers' personas.
        """
        first_entry = self.convai2_teacher.get(episode_idx, entry_idx=0)
        first_text_strings = first_entry['text'].split('\n')
        persona_1_strings = []
        persona_2_strings = []
        for str_ in first_text_strings[:
                                       -1]:  # The last string is the first utterance
            if str_.startswith('your persona: '):  # Here, "you" are Person 2
                persona_2_strings.append(str_[len('your persona: '):])
            elif str_.startswith("partner's persona: "):
                persona_1_strings.append(str_[len("partner's persona: "):])
            else:
                raise ValueError('Persona string cannot be parsed!')
        return persona_1_strings, persona_2_strings
    def test_check_examples(self):

        with testing_utils.tempdir() as tmpdir:
            data_path = tmpdir

            # Check EmpatheticDialoguesTeacher
            opts_and_examples = [
                (
                    {
                        'datatype': 'train',
                        'train_experiencer_only': True
                    },
                    {
                        'situation':
                        ' i used to scare for darkness',
                        'emotion':
                        'afraid',
                        'text':
                        'dont you feel so.. its a wonder ',
                        'labels': [
                            'I do actually hit blank walls a lot of times but i get by'
                        ],
                        'episode_done':
                        False,
                    },
                ),
                (
                    {
                        'datatype': 'train',
                        'train_experiencer_only': False
                    },
                    {
                        'situation':
                        'I remember going to the fireworks with my best friend. There was a lot of people, but it only felt like us in the world.',
                        'emotion': 'sentimental',
                        'text': 'Where has she gone?',
                        'labels': ['We no longer talk.'],
                        'episode_done': True,
                    },
                ),
                (
                    {
                        'datatype': 'valid'
                    },
                    {
                        'situation':
                        'I was walking through my hallway a few week ago, and my son was hiding under the table and grabbed my ankle. I thought i was got. ',
                        'emotion':
                        'surprised',
                        'text':
                        'I may have let out a scream that will have him question my manhood for the rest of our lives, lol. ',
                        'labels': ['I would probably scream also.'],
                        'episode_done':
                        True,
                        'label_candidates': [
                            "That really does make it special. I'm glad you have that. ",
                            "It must've have been. Glad they are okay now.",
                            "Well sometimes companies make mistakes. I doubt it's anything you did.",
                            "Oh no, I'm so so sorry. I've always had at least one pet throughout my life, and they're truly part of the family.",
                            'Wow. That must suck. Do you like the band incubus? I missed them a couple of times but I saw them this year',
                            "I can't play those kinds of games. Too spooky for me.",
                            'I think your boss should give you more recognition in that case!',
                            "That's always a good thing. It means you should get on great with your neighbors.",
                            "Yeah, I had my Commodore 64 and Amiga in the late 80's. Still, the games were great when they worked!",
                            "That's ok, you did the right thing. It probably happens to lots of people.",
                            "That's good. Now you don't have to worry about it.",
                            'Hopefully one day you will be willing to explore a relationship in a serious way.',
                            "I'm sorry, things will get better.",
                            'Oh, okay. Maybe you should ask your teacher for some extra help or find a study buddy. i hope you do better next time.',
                            'Why? What did she do?',
                            'I do enjoy the zoo and the animals. I think they could be just as good.',
                            'Well at least you managed to save him!',
                            'That sucks, how much is it?',
                            'Yeah, that is a hard one to deal with.  Maybe you should give it back so you will not feel bad about yourself.',
                            'HAve you been practicing? Do you have note cards?',
                            "That's good news at least. I hope you are feeling better now. And don't be hard on yourself, accidents happen.",
                            'Oops. I hate when that happens. Did they say anything to you?',
                            'no its not',
                            'Yes, my friends are coming with me. :)',
                            "Oh my gosh! I'm sorry! haha Thats funny. Atleast you have them a story to always remember.;)",
                            'I am so happy for you! All of your hard work paid off!',
                            'Wow, thats a nice car',
                            "Does it make you feel like you're living in an alternate reality?",
                            'glade all was well',
                            'ah, crisis averted! that could have been a lot worse',
                            "Maybe if we weren't so attached to being creatures of comfort. Some things we just can't let go of, wouldn't exist without some poor shmuck having to do the dirty work. I guess we're all that shmuck to someone, someway or another.",
                            "That's awesome! You're going to be rolling in the dough with those skills",
                            "Don't worry, from what you said it doesn't sound like you almost ruined it. It wasn't something on purpose at least.",
                            'Have you tried yoga? It can help in the meanwhile till you get a proper vacation.',
                            "I wish my insurance would give me something like that! It's good to go anyways.",
                            'I bet you are pretty anxious and excited at the same time.',
                            'Do you honk at them?',
                            "That's a bad supervisor. Did you call him/her out on it?",
                            "Geniuses don't do chores my friend.",
                            'Which country? that sounds fun, are you guys doing anything fun there?',
                            'oh that is so exciting!!! good for you man!',
                            'Wow! Any way they can get out? Did they call someone?',
                            'I love that nostalgic feeling. ',
                            'Congratulations. You have done great!',
                            'hahaha I definitely admire your courage to have done that.',
                            'wait til she leaves and continue',
                            'I do too.  I am so sorry you are going through this',
                            'That is awesome. Congratulations. Im sure you earned every penny.',
                            'I want some of whatever you had for breakfast. You seem very happy.',
                            'Oh wow! I am so sorry that happened to you.',
                            'Well, hopefully there will be nothing but great things for him in his future.',
                            'Oh that was so nice of them! I bet you were relieved!',
                            'how was it ?',
                            "Nice! Why do you like it more than other places you've lived?",
                            'It must be difficult, do you think she will come back ever?',
                            "That's so messed up! Why was he doing that?",
                            'Did you try therapy at all or counseling?',
                            'Did you reconnect and promise to keep in touch?',
                            'I am so sorry for you. Perhaps you can hang with her after your workdays?',
                            "That's good that you found happiness. That's what were all in the pursuit of right?",
                            'I hope these feelings last for you!',
                            'you have eyes too',
                            "Wow, that's rude! He won't last long...",
                            "Hopefully the person learned what they had to do so they don't hold the line up in the future.",
                            'Oh no that must have been a terrible experience, I hope no one got hurt from the shattered glass.',
                            "Congrats!, I'm sure you must be very happy!",
                            "That's good to know!  You all have a lot to be thankful for!",
                            'It depends, if you love her, you could try to work it out.  Or you could cheat on her too',
                            "I'm sorry to hear that, I'm pretty terrified of the dentist myself. Ask for gas! Good luck, I'm sure everything will be just fine.",
                            'That makes sense, you are a good older sibling!',
                            'They say dogs are mans best friend. ',
                            'I would probably scream also.',
                            'Well I hope he gets to felling better.',
                            "If I had a bag of M&M's right now I would eat them for sure!",
                            'Yep. Happy and healthy is a blessing',
                            'Wow was it a scam or was it legit?',
                            'that is good to hear, it was a motivation to succeed, a great character building ',
                            'Its not time to get over it, you arent doing any wrong its okay to "feel" things. I hope people around you give you a lot of love! ',
                            'Awww. Did you keep it?',
                            "Oh I see.. Well that's a pretty positive talent then, huh? Maybe you should encourage him to keep doing it. Maybe he misses it. You could get him a present for his birthday or Christmas that was related to drawing tools/pencils and all that.",
                            "You learn a lot about someone when you move in with them, so if you feel comfortable in your relationship I think that's actually rather prudent.",
                            'That is terrible. How long have you had this pet?',
                            'Oh that sucks...did she explain herself yet',
                            "8 Miles!? That's very impressive.  I bet I could barely make it a mile!",
                            'That stuff is pretty expensive. Maybe you can sell it on eBay or something.',
                            'Its horrible to have to got through things like thaty',
                            'Oh god.. so sorry to hear that.. May i ask how did Tom pass?',
                            'Like a paranormal type fear or a human with intent to harm type fear?',
                            'I bet you cant wait.  WHere are going for your vacation?',
                            'Aw, that sucks. Did you give her a proper burial?',
                            'Awesome! What are you going to see?',
                            'What kind of food does it serve? Sounds wonderful!',
                            "Oh no! What's wrong with your dad?",
                            'oh god yes i know what you mean, any ideas what you wanna do ?',
                            "Hopefully you'll able to get it all sorted out soon.  I'm sure when it's done it'll be a beautiful house.",
                            'That would be bad you should double check before you leave',
                            'I hope he continues to do well.',
                            "You can only do so much.  Next time I'd just let him drink on his own.",
                            'I am sure you will meet them',
                            'Wow thats nice.  What do you drive?',
                        ],
                    },
                ),
                (
                    {
                        'datatype': 'test'
                    },
                    {
                        'situation':
                        'My mother stopped by my house one day and said she saw 3 dogs on the road, down from our house. They were starving, with ribs showing, and it was a mother dog and her two small puppies. Of course, my daughter wanted to bring them to our house, so we could feed and help them. We did, and my heart went out to them, as they were so sweet, but really were in a bad shape.',
                        'emotion':
                        'caring',
                        'text':
                        "Oh my goodness, that's very scary! I hope you are okay now and the drunk driver was punished for his actions?",
                        'labels': ['Yeah he was punished hes in jail still'],
                        'episode_done':
                        True,
                        'label_candidates': [
                            "Are you really able to work from home? Finding a gig is so difficult, I'm glad that it is working for you.",
                            "Oh no. That's quite unfortunate for the deer. Did you just drive past it?",
                            'Wow, you must have felt jealous',
                            'I can only imagine! How is he now?',
                            'Oh goodness, what happened for the past 3 weeks?',
                            'LOL i hate that',
                            'I love a warm fire outside while camping! Sounds like a great time.',
                            'Yeah he was punished hes in jail still',
                            'Was he upset?',
                            "Wow that's awesome! Are you on a team?",
                            'Oh man that is just crazy! Feel bad for the person who has to clean it.',
                            'im sorry, thats awful. its a shame his parents arent being more supportive',
                            'I bet that was scary. Did he surprise you with something?',
                            'That sounds pretty stressful. Are you moving soon?',
                            "Well, if I were you, I'd keep it up, whether or not my spouse laughed at me, or a new girlfriend/boyfriend, whatever. It's not childish to me. Life is stressful enough. Let us snuggle what we want.",
                            "That's hilarious! Is he usually down for a good prank?",
                            'Oh I love seeing kids achieve things! Adorable. Good for her! :) ',
                            'that makes two of us! i am terrified of all snakes',
                            'that is dangerous, glad that both of your are okay',
                            "That's good to hear. I hope I meet someone that will do that for me.",
                            "Well that's good.",
                            'We need more people like you in the world.  Theres always someone out there who needs a helping hand and could use a friend.',
                            'How ever so exciting! is this your first cruise?',
                            'Do you feel any less nervous?  Job interviews are always nerve-wracking ',
                            'Maybe you could try to better that?',
                            "That's what matters most, that you had a good time and made memories!",
                            'Oh man! I hear you. I rescue animals and it is VERY hard to potty train them!',
                            'Hopefully they will give him a better shift.',
                            "That's a big step. I hope it works out for you.",
                            "Hiking is probably a tough environment to meet people! LA is real nice, but I hear the people there aren't/",
                            'I hope things turn out better for you. Keep fighting.',
                            "please don't lol i'm a man, I appreciate what you women go through when you're pregnant or on your period but i'm okay with not knowing details",
                            'I wish refrigerators would have a warranty that replaced food when they went bad. ',
                            'Seeing old friends that you have not contacted in so long is a nice feeling. ',
                            'Cool. Will you leave it there forever?',
                            'Oh wow. How far away did you move??',
                            'So inconsiderate! It reminds me of my neighbours doing building work one morning at 6AM!',
                            'Oh no, did they do something embarrasing?',
                            'That is awesome!  Is there a particular reason you are so happy?',
                            'Did you buy all the essential items the dog will need? ',
                            'Fantastic, now do you have a job lined up?',
                            'Better luck next time!  I love to scratch!',
                            'Thats neat. Do you guys make a lot of money?',
                            'I would be furious.  What did you do?',
                            "Well hopefully you're able to familiarize yourself quickly. Good luck!",
                            'Oh thats good for your friend, but it sounds like you really would like to live there! I can imagine feeling jealous',
                            "That's unfortunate.  What are you doing now?",
                            'Oh no. I rent also so I know your pain. My last landlord was awful.  How did your landlord react?',
                            'Im sorry to hear that, how long did you have him?',
                            'Lovely.  What did you do together?',
                            'Have you thought about getting another dog? ',
                            'Oh yeah?  Do you still look awesome like you did back then?',
                            'Do you dress up when the new movies come out also?',
                            "That's a shame. I hate it when a place doesn't live up to the hype.",
                            "Sometimes life isn't very fair. I like to think of it as motivation to get a better job.",
                            'Well at least you have a plan. Are you planning to start the renovation soon?',
                            "Kids pick those things up quickly.  And it'll help with her hand-eye coordination, reading - all sorts of things!  ",
                            'did you enjoy yourself ',
                            'Haha, how did she feel when she found out?',
                            'that would really help if it was a permanent solution',
                            "Wow that must have been frustrating.  I hope it didn't cost too much.",
                            'How nice of her. You must have been so happy to see her.',
                            "I know it's hard, but practice makes perfect! Keep trying and I am sure you will get it!",
                            'Do they live in a different state than you?',
                            "It reallyi s the best way to do things. That way even if you forget something you've got time to remember and remedy the situation",
                            'Wow, must have been rather frightening. Glad you are ok!',
                            'That was really nice!  What a wonderful surprise!  This act of kindness helps to restore my faith in humanity.',
                            "It's located in a small farming town in Vermont. I went on a tour of their factory once and it was interesting to see the cheese being made.",
                            "Poor guy was just nervous, I'm sure the more you take him the more he will venture away from you and have some fun!",
                            'How did he scare you?',
                            "Isn't that what sisters are for?  What were you guys upset about?",
                            'That is a long time to be in the car for sure.',
                            "I'm glad to hear... Weddings can be stressful",
                            "That sounds amazing! How'd you guys meet?",
                            "Getting out of town and way from all of everday life's struggles always sounds like a great time.  Did you leave you cell phone at home while you weer away to 'really' get away from everything for a minute?",
                            'Man that is scary! Granted i like to hear things about that. ',
                            'Yikes! Was anything damaged? ',
                            'Ouch, I would try and wear something on your neck next time you go in there.',
                            'awesome! was it hold em?',
                            'Not me! haha I love them all!',
                            "Oh that's nice, I love doing that. Did the cat seem happy?",
                            "Yeah, I can imagine. At least it's only one week!",
                            'Ew, I hate spiders. We are in the process of getting them out of our garage.',
                            "That's great news. I don't know what I would do if my mom passed.",
                            'Is that like the child equivalent of under the bed?',
                            "That's really fantastic!  I'm glad to hear you turned your life around.  ",
                            'What kind of work do you do?',
                            'Ah ok I undestand.',
                            'Very sad to hear. You have a good heart and are very caring, that is something to atleast be proud of!',
                            'Man that sounds really stressful...',
                            'You are so strong!  Please thank your husband for his service and thank you for being his support, no matter the miles between you.  Take care of yourself and get out with friends when you can!',
                            'I see. Is it your favorite food now? :p',
                            'YAY! good job! He/she is going to be beautiful',
                            'Nothing went wrong, we just have different lives in different places. I go visit every now and then.',
                            "A spelling bee - what fun! I'm sure you will win - I bet you've worked hard toward your goal.",
                            'You should install security cameras outside your house.',
                            'Border collie. She was great!',
                            'Oh dear me.. So sorry to hear that! what did you do?',
                            'Praise God man! He really is amazing and we should always be grateful for we have ',
                            'Oh no.. Did he pass away?',
                        ],
                    },
                ),
            ]
            for opt, example in opts_and_examples:
                full_opt = Opt({**opt, 'datapath': data_path})
                teacher = EmpatheticDialoguesTeacher(full_opt)
                self.assertEqual(teacher.get(episode_idx=1, entry_idx=1),
                                 example)