Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022-066
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
2022-066
2022-066
Commits
7d0d8b06
Commit
7d0d8b06
authored
Nov 14, 2022
by
De Silva K.C.C.C
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
text summarizing
parent
b23bb206
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
10 deletions
+1
-10
Indexing/question_generator.py
Indexing/question_generator.py
+1
-10
No files found.
Indexing/question_generator.py
View file @
7d0d8b06
...
@@ -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])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment