Skip to content

Instantly share code, notes, and snippets.

View Darshan2104's full-sized avatar
🤔
Hmmm!

Darshan Tank Darshan2104

🤔
Hmmm!
View GitHub Profile
@Darshan2104
Darshan2104 / json2nlu_md.py
Created November 16, 2022 05:51
To create nlu.md file from json formated input used in rasa
import json
f = open('final.json')
data = json.load(f)
# data = {"intent : byebye": ["bye bye", "aav jo", "tata", "gaya"]}
file = open('nlu.md',"w")
for key,val in data.items():
file.write(f"## {key}\n")
val = list(set(val))
@Darshan2104
Darshan2104 / paraphrase.py
Created November 16, 2022 05:54
get paraphrased output in json format from nlu.md file
import pandas as pd
import json
# read nlu.md
# create a list of intent and it's nlus
# for each intent
# each nlu call api
# get result and store it
# store it into the new db
import pandas as pd
input_file_name = 'Tamil_NLU_Collation.xls'
# update it based on your xl file.
sheets = ['Generic NLU', 'Generic FAQs', 'Collection_Response+FAQ Intent']
output_file = open('result/nlu.md',"w")
list_intents = open('result/list_intent.txt',"w")
for sheet in sheets: