Facebook
From Crimson Ibis, 3 Years ago, written in YAML.
Embed
Download Paste or View Raw
Hits: 57
  1.         bot_section = ''
  2.         with open(bot) as f:
  3.                 data = yaml.load(f, Loader=yaml.FullLoader)
  4.  
  5.                 slotList = []
  6.                 # Print switch turn utterance buttons
  7.                 for intent in data['intents']:
  8.                         intentName = intent['name']
  9.                         intents_contains = f"        {{% if intents contains '{intentName}' %}}" #print
  10.                         print(intents_contains)
  11.                         #bot_section += intents_contains
  12.                         if 'slots' in intent:
  13.                                 for slot in intent['slots']:
  14.                                         slotName = slot['name']
  15.                                         slotList.append(slotName)
  16.                                         button_class = f"        <button class="btn" style="color:lightcoral" data-training="{slotName}">{slotName}</button>" #print
  17.                                         print(button_class)
  18.                                         #bot_section += button_class
  19.                         end_if = f"        {{% endif %}}n" #print
  20.                         print(end_if)