Skip to content

Instantly share code, notes, and snippets.

@Darshan2104
Created November 16, 2022 11:44
Show Gist options
  • Save Darshan2104/eb4c30fbc068d54137e35ffcb37c5ce6 to your computer and use it in GitHub Desktop.
Save Darshan2104/eb4c30fbc068d54137e35ffcb37c5ce6 to your computer and use it in GitHub Desktop.
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:
df = pd.read_excel(input_file_name, sheet_name=sheet)
output_file.write(f"# {sheet}\n\n")
print(sheet)
# print(df.columns)
new_l = []
for i in df.columns:
if "Unnamed" in i:
pass
else:
new_l.append(i)
list_intents.write(f"- {i}\n")
for intent in new_l:
output_file.write(f"\n## {intent}\n")
for i in df[intent]:
# print(type(i))
if isinstance(i,float):
pass
else:
output_file.write(f"- {i}\n")
output_file.write("\n\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment