예제 #1
0
 def test_open_envelope(self):
     name = 'Jerome'
     intent = IntentBuilder(name).require('Keyword')
     intent.name = name
     m = Message("register_intent", intent.__dict__)
     unpacked_intent = open_intent_envelope(m)
     self.assertEqual(intent.__dict__, unpacked_intent.__dict__)
예제 #2
0
 def handle_register_intent(self, message):
     intent = open_intent_envelope(message)
     self.engine.register_intent_parser(intent)
     skill_id, intent = message.data.get("name", "None:None").split(":")
     LOG.info("Registered: " + intent)
     if skill_id not in self.intent_map.keys():
         self.intent_map[skill_id] = []
     self.intent_map[skill_id].append(intent)