Пример #1
0
    # prompt being None means all parameters satisfied, perform the intent action
    if prompt is None:
      if self.context.name != 'IntentComplete':
        prompt, self.context = check_actions(self.current_intent, self.attributes, self.context)

    # Resets the state after the Intent is complete
    if self.context.name == 'IntentComplete':
      self.attributes = {}
      self.context = FirstGreeting()
      self.current_intent = None

    if DEBUG_LEVEL >= DEBUG_LEVEL_DBG:
      print('Context: ', self.context.name)
      print('Attributes: ', self.attributes)

    return prompt


Actions.CabsInit()
Actions.RestaurantsInit()

session = Session()

while True:
  if session.context.name == 'FirstGreeting':
    print('=========')
    print('BOT: Hi! How may I assist you? (Say \'restart\' at anytime to start over or \'bye\' to quit)')

  inp = input('User: '******'BOT:', session.reply(inp))