Commit 7d0d8b06 authored by De Silva K.C.C.C's avatar De Silva K.C.C.C

text summarizing

parent b23bb206
...@@ -37,11 +37,10 @@ def postprocesstext(content): ...@@ -37,11 +37,10 @@ def postprocesstext(content):
final = final + " " + sent final = final + " " + sent
return final return final
# text summarizing
def summarizer(text, model=summary_model, tokenizer=summary_tokenizer): def summarizer(text, model=summary_model, tokenizer=summary_tokenizer):
text = text.strip().replace("\n", " ") text = text.strip().replace("\n", " ")
text = "summarize: " + text text = "summarize: " + text
# print (text)
max_len = 512 max_len = 512
encoding = tokenizer.encode_plus(text, max_length=max_len, pad_to_max_length=False, truncation=True, encoding = tokenizer.encode_plus(text, max_length=max_len, pad_to_max_length=False, truncation=True,
return_tensors="pt").to(device) return_tensors="pt").to(device)
...@@ -150,11 +149,3 @@ def generate_questions_and_answers(text): ...@@ -150,11 +149,3 @@ def generate_questions_and_answers(text):
return question_and_answer_list return question_and_answer_list
# print(generate_questions_and_answers(xxx))
#
# x = generate_questions_and_answers(xxx)
#
# for i in x:
# print(i[0])
# print(i[1])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment