Ejemplo n.º 1
0
    def test_get_platform_res_da(self):
        hdc_policy = self._build_policy()

        state = DeterministicDiscriminativeDialogueState(self.cfg, self.ontology)

        system_input = DialogueActConfusionNetwork()

        res = hdc_policy.get_da(state)

        user_input = DialogueActConfusionNetwork()
        user_input.add(1.0, DialogueActItem(dai='info(task=find_platform)'))
        user_input.add(1.0, DialogueActItem(dai='inform(from_stop=Praha)'))
        user_input.add(1.0, DialogueActItem(dai='inform(to_stop=Brno)'))

        state.update(user_input, system_input)
        res = hdc_policy.get_da(state)

        self.assert_('inform(not_supported)' in res)
Ejemplo n.º 2
0
    def test_switching_tasks(self):
        hdc_policy = self._build_policy()
        self.mox.StubOutWithMock(hdc_policy.weather, 'get_weather')
        self.mox.StubOutWithMock(hdc_policy, 'get_directions')

        hdc_policy.weather.get_weather(city=u'Praha',
                                       daily=False,
                                       lat=u'50.0755381',
                                       lon=u'14.4378005',
                                       time=None).AndReturn(None)
        hdc_policy.get_directions(mox.IgnoreArg(),
                                  check_conflict=True).AndReturn([DialogueActItem(dai="inform(time=10:00)")])

        self.mox.ReplayAll()

        state = DeterministicDiscriminativeDialogueState(self.cfg, self.ontology)

        system_input = DialogueActConfusionNetwork()

        res = hdc_policy.get_da(state)

        # User says she wants weather so the task should be weather.
        user_input = self._build_user_input("inform(task=weather)")
        state.update(user_input, system_input)
        res = hdc_policy.get_da(state)
        self.assertEqual(state['lta_task'].mpv(), 'weather')

        # User wants to find a connection so the task should be find_connection.
        user_input = self._build_user_input(u"inform(task=find_connection)",
                                            u"inform(to_stop=Malostranská)",
                                            u"inform(from_stop=Anděl)")
        state.update(user_input, system_input)
        res = hdc_policy.get_da(state)
        self.assertEqual(state['lta_task'].mpv(), 'find_connection')

        self.mox.VerifyAll()