Spaces:
Sleeping
Sleeping
Aakash Goel
commited on
Commit
·
b7aba69
1
Parent(s):
b30dcf3
os change 3
Browse files- code/helper.py +3 -1
- code/helper.py.py +4 -2
- code/quiz_gen_new3.py +8 -5
code/helper.py
CHANGED
@@ -91,8 +91,10 @@ def get_keywords(originaltext,summarytext):
|
|
91 |
if keyword in keywords_found:
|
92 |
important_keywords.append(keyword)
|
93 |
## find keywords which don't have common word ..
|
|
|
|
|
94 |
imp_words = filter_overlap_words(important_keywords)
|
95 |
-
return imp_words[:
|
96 |
|
97 |
def get_question(context,answer,model,tokenizer):
|
98 |
text = "context: {} answer: {}".format(context,answer)
|
|
|
91 |
if keyword in keywords_found:
|
92 |
important_keywords.append(keyword)
|
93 |
## find keywords which don't have common word ..
|
94 |
+
from copy import deepcopy
|
95 |
+
imp_words = deepcopy(important_keywords)
|
96 |
imp_words = filter_overlap_words(important_keywords)
|
97 |
+
return imp_words[:5]
|
98 |
|
99 |
def get_question(context,answer,model,tokenizer):
|
100 |
text = "context: {} answer: {}".format(context,answer)
|
code/helper.py.py
CHANGED
@@ -91,8 +91,10 @@ def get_keywords(originaltext,summarytext):
|
|
91 |
if keyword in keywords_found:
|
92 |
important_keywords.append(keyword)
|
93 |
## find keywords which don't have common word ..
|
94 |
-
|
95 |
-
|
|
|
|
|
96 |
|
97 |
def get_question(context,answer,model,tokenizer):
|
98 |
text = "context: {} answer: {}".format(context,answer)
|
|
|
91 |
if keyword in keywords_found:
|
92 |
important_keywords.append(keyword)
|
93 |
## find keywords which don't have common word ..
|
94 |
+
from copy import deepcopy
|
95 |
+
imp_words = deepcopy(important_keywords)
|
96 |
+
#imp_words = filter_overlap_words(important_keywords)
|
97 |
+
return imp_words[:5]
|
98 |
|
99 |
def get_question(context,answer,model,tokenizer):
|
100 |
text = "context: {} answer: {}".format(context,answer)
|
code/quiz_gen_new3.py
CHANGED
@@ -91,8 +91,11 @@ if raw_text != None and raw_text != '':
|
|
91 |
other_options = get_related_word(ans)
|
92 |
final_options = get_final_option_list(ans,other_options)
|
93 |
final_options, ans_index = get_final_option_list(ans,other_options)
|
94 |
-
option1.append(final_options[0])
|
95 |
-
|
|
|
|
|
|
|
96 |
if ques not in questions:
|
97 |
# st.write(final_options)
|
98 |
html_str = f"""
|
@@ -110,10 +113,10 @@ if raw_text != None and raw_text != '':
|
|
110 |
"""
|
111 |
st.markdown(html_str , unsafe_allow_html=True)
|
112 |
st.markdown("-----")
|
113 |
-
questions.append(ques)
|
114 |
output_path = "results/df_quiz_log_file_v1.csv"
|
115 |
-
|
116 |
-
|
|
|
117 |
"Question":questions,"Option1":[option1],\
|
118 |
"Option2":[option2],\
|
119 |
"Option3":[option3],\
|
|
|
91 |
other_options = get_related_word(ans)
|
92 |
final_options = get_final_option_list(ans,other_options)
|
93 |
final_options, ans_index = get_final_option_list(ans,other_options)
|
94 |
+
option1.append(final_options[0])
|
95 |
+
option2.append(final_options[1])
|
96 |
+
option3.append(final_options[2])
|
97 |
+
option4.append(final_options[3])
|
98 |
+
questions.append(ques)
|
99 |
if ques not in questions:
|
100 |
# st.write(final_options)
|
101 |
html_str = f"""
|
|
|
113 |
"""
|
114 |
st.markdown(html_str , unsafe_allow_html=True)
|
115 |
st.markdown("-----")
|
|
|
116 |
output_path = "results/df_quiz_log_file_v1.csv"
|
117 |
+
st.write(len(ans_list),len(questions),len(option1),len(option2),len(option3),len(option4))
|
118 |
+
res_df = pd.DataFrame({"TimeStamp":[start_time]*len(ans_list),\
|
119 |
+
"Input":[str(raw_text)]*len(ans_list),\
|
120 |
"Question":questions,"Option1":[option1],\
|
121 |
"Option2":[option2],\
|
122 |
"Option3":[option3],\
|