def update_intent_utterance(id, intent_utterance): condition = {'intent_id': id} _delete_item_using_condition('INTENT_UTTERANCE', condition) for utterance in intent_utterance: utterance_condition = {'intent_id': id, 'text': utterance} _insert_item('INTENT_UTTERANCE', utterance_condition)
def update_entity_synonym(id, synonym): condition = {'entity_id': id} _delete_item_using_condition('SYNONYM', condition) for query in synonym: query_condition = {'entity_id': id, 'text': query} _insert_item('SYNONYM', query_condition)
def update_reaction(id, reaction_type=[], reaction_response=[]): condition = {'reaction_id': id} _delete_item_using_condition('REACTION_TYPE', condition) _delete_item_using_condition('REACTION_RESPONSE', condition) for type in reaction_type: type_condition = {'reaction_id': id, 'text': type} _insert_item('REACTION_TYPE', type_condition) for query in reaction_response: query_condition = {'reaction_id': id, 'text': query} _insert_item('REACTION_RESPONSE', query_condition)
def update_scenario(id, scenario_query=[], scenario_response=[]): condition = {'scenario_id': id} _delete_item_using_condition('SCENARIO_QUERY', condition) _delete_item_using_condition('SCENARIO_RESPONSE', condition) for query in scenario_query: query_condition = {'scenario_id': id, 'text': query} _insert_item('SCENARIO_QUERY', query_condition) for query in scenario_response: query_condition = {'scenario_id': id, 'text': query} _insert_item('SCENARIO_RESPONSE', query_condition)
def update_blacklist(id, blacklist_query=[], blacklist_response=[]): condition = {'blacklist_id': id} _delete_item_using_condition('BLACKLIST_QUERY', condition) _delete_item_using_condition('BLACKLIST_RESPONSE', condition) for query in blacklist_query: query_condition = {'blacklist_id': id, 'text': query} _insert_item('BLACKLIST_QUERY', query_condition) for query in blacklist_response: query_condition = {'blacklist_id': id, 'text': query} _insert_item('BLACKLIST_RESPONSE', query_condition)
def createNodeRecursive(nodeList, parentId=0): for node in nodeList: parentNode = {} for key, value in node.items(): if node[key] != None: parentNode[key] = value if 'children' in node.keys(): del parentNode['children'] parentNode['parentId'] =parentId parent_id = _insert_item('DIALOG', parentNode) createNodeRecursive(node['children'], parent_id) else: parentNode['parentId'] = parentId print (parentNode) _insert_item('DIALOG', parentNode)
def create_entity(name, value): condition = {'name': name, 'value': value} entity_id = _insert_item('ENTITY', condition) return entity_id
def create_reaction_group(reaction_group_name): condition = {'name': reaction_group_name} reaction_group_id = _insert_item('REACTION_GROUP', condition) return reaction_group_id
def create_reaction(reaction_group_id): condition = {'reaction_group_id': reaction_group_id} reaction_id = _insert_item('reaction', condition) return reaction_id
def create_scenario_group(scenario_group_name): condition = {'name': scenario_group_name} scenario_group_id = _insert_item('SCENARIO_GROUP', condition) return scenario_group_id
def create_scenario(scenario_group_id): condition = {'scenario_group_id': scenario_group_id} scenario_id = _insert_item('SCENARIO', condition) return scenario_id
def create_blacklist_group(blacklist_group_name): condition = {'name': blacklist_group_name} blacklist_group_id = _insert_item('BLACKLIST_GROUP', condition) return blacklist_group_id
def create_blacklist(blacklist_group_id): condition = {'blacklist_group_id': blacklist_group_id} blacklist_id = _insert_item('BLACKLIST', condition) return blacklist_id
def create_intent(name, description): condition = {'name': name, 'description': description} intent_id = _insert_item('INTENT', condition) return intent_id