Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2020-101
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sachith Fernando
2020-101
Commits
dd665bb8
Commit
dd665bb8
authored
Jan 08, 2021
by
LiniEisha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integrate
parent
2e86bf20
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
16 deletions
+25
-16
LectureSummarizingApp/ExtractKeySentences.py
LectureSummarizingApp/ExtractKeySentences.py
+15
-6
LectureSummarizingApp/api.py
LectureSummarizingApp/api.py
+8
-8
LectureSummarizingApp/templates/LectureSummarizingApp/summarization.html
...ingApp/templates/LectureSummarizingApp/summarization.html
+1
-1
LectureSummarizingApp/urls.py
LectureSummarizingApp/urls.py
+1
-1
No files found.
LectureSummarizingApp/ExtractKeySentences.py
View file @
dd665bb8
...
@@ -6,10 +6,11 @@ def LectureNotice(notice_name):
...
@@ -6,10 +6,11 @@ def LectureNotice(notice_name):
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
FILE_PATH
=
os
.
path
.
join
(
BASE_DIR
,
"speechToText
\\
{}"
.
format
(
notice_name
))
FILE_PATH
=
os
.
path
.
join
(
BASE_DIR
,
"speechToText
\\
{}"
.
format
(
notice_name
))
DESTINATION_DIR
=
os
.
path
.
dirname
(
os
.
path
.
join
(
BASE_DIR
,
"LectureSummarizingApp
\\
Notices
\\
sample.txt"
))
DESTINATION_DIR
=
os
.
path
.
join
(
BASE_DIR
,
"notices
\\
Notice_{}"
.
format
(
notice_name
))
print
(
'destination directory: '
,
DESTINATION_DIR
)
print
(
'destination directory: '
,
DESTINATION_DIR
)
read_lines
=
[
line
.
rstrip
(
'
\n
'
)
for
line
in
open
(
"audioToText01.txt"
,
"r"
)]
text
=
''
read_lines
=
[
line
.
rstrip
(
'
\n
'
)
for
line
in
open
(
FILE_PATH
,
"r"
)]
sentences_list
=
[]
sentences_list
=
[]
sentence_list
=
nltk
.
sent_tokenize
(
read_lines
)
sentence_list
=
nltk
.
sent_tokenize
(
read_lines
)
word_search
=
"important"
word_search
=
"important"
...
@@ -28,11 +29,17 @@ def LectureNotice(notice_name):
...
@@ -28,11 +29,17 @@ def LectureNotice(notice_name):
sentences_with_word
.
append
(
sentence
)
sentences_with_word
.
append
(
sentence
)
word_sentence_dictionary
[
word
]
=
sentences_with_word
word_sentence_dictionary
[
word
]
=
sentences_with_word
file
=
open
(
'
Notices01.txt
'
,
'w'
)
file
=
open
(
'
DESTINATION_DIR
'
,
'w'
)
file
.
close
()
file
.
close
()
def
SaveNotices
():
# def SaveNotices():
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
# PDF_DESTINATION_DIR = os.path.dirname(os.path.join(BASE_DIR, "summaryPDF\\sample.txt"))
PDF_DESTINATION_DIR
=
os
.
path
.
join
(
BASE_DIR
,
"noticePDF
\\
Notice{}.pdf"
.
format
(
notice_name
))
pdf
=
FPDF
()
pdf
=
FPDF
()
# Add a page
# Add a page
pdf
.
add_page
()
pdf
.
add_page
()
...
@@ -41,11 +48,13 @@ def SaveNotices():
...
@@ -41,11 +48,13 @@ def SaveNotices():
pdf
.
set_font
(
"Arial"
,
size
=
15
)
pdf
.
set_font
(
"Arial"
,
size
=
15
)
# open the text file in read mode
# open the text file in read mode
f
=
open
(
"
Summary01.txt
"
,
"r"
)
f
=
open
(
"
DESTINATION_DIR
"
,
"r"
)
# insert the texts in pdf
# insert the texts in pdf
for
x
in
f
:
for
x
in
f
:
pdf
.
cell
(
200
,
10
,
txt
=
x
,
ln
=
1
,
align
=
'C'
)
pdf
.
cell
(
200
,
10
,
txt
=
x
,
ln
=
1
,
align
=
'C'
)
# save the pdf with name .pdf
# save the pdf with name .pdf
pdf
.
output
(
"summary01.pdf"
)
pdf
.
output
(
"PDF_DESTINATION_DIR"
)
\ No newline at end of file
return
text
\ No newline at end of file
LectureSummarizingApp/api.py
View file @
dd665bb8
...
@@ -148,27 +148,27 @@ class LectureSummaryList(APIView):
...
@@ -148,27 +148,27 @@ class LectureSummaryList(APIView):
class
l
ectureNoticeList
(
APIView
):
class
L
ectureNoticeList
(
APIView
):
def
get
(
self
,
request
):
def
get
(
self
,
request
):
lecture_notice_id
=
LectureNotices
.
objects
.
all
()
lecture_notice_id
=
LectureNotices
.
objects
.
all
()
# serializer = LectureNoticesSerializer(lecture_notice_id, many=True)
# serializer = LectureNoticesSerializer(lecture_notice_id, many=True)
# return Response(serializer.data)
# return Response(serializer.data)
lecture_notice_list
=
LectureNotices
.
objects
.
order_by
(
'lecture_notice_
list
'
)
.
last
()
lecture_notice_list
=
LectureNotices
.
objects
.
order_by
(
'lecture_notice_
id
'
)
.
last
()
lecture_notice_name
=
request
.
query_params
.
get
(
"lecture_notice_name"
)
lecture_notice_name
=
request
.
query_params
.
get
(
"lecture_notice_name"
)
id
=
int
(
request
.
query_params
.
get
(
"id"
))
id
=
int
(
request
.
query_params
.
get
(
"id"
))
# generate new id for notice
s
# generate new id for notice
lecture_notice_id
=
generate_new_id
(
lecture_notice_list
.
lecture_notice_id
)
notice_id
=
"LN0001"
if
lecture_notice_list
is
None
else
generate_new_id
(
lecture_notice_list
.
lecture_notice_id
)
LectureNotices
(
lecture_notice_name
)
text
=
LectureNotices
(
lecture_notice_name
)
LectureNotices
(
LectureNotices
(
lecture_notice_id
=
id
,
lecture_notice_id
=
notice_
id
,
lecture_audio_id
=
lecture_notice_
id
,
lecture_audio_id
=
id
,
notice_text
=
lecture_notice_name
notice_text
=
text
)
.
save
()
)
.
save
()
return
Response
({
"response"
:
request
.
data
})
return
Response
({
"response"
:
request
.
data
})
...
...
LectureSummarizingApp/templates/LectureSummarizingApp/summarization.html
View file @
dd665bb8
...
@@ -112,7 +112,7 @@
...
@@ -112,7 +112,7 @@
alert
(
'
Processing
'
);
alert
(
'
Processing
'
);
let
id
=
e
.
target
.
parentNode
.
parentNode
.
getAttribute
(
'
id
'
);
let
id
=
e
.
target
.
parentNode
.
parentNode
.
getAttribute
(
'
id
'
);
let
lecture_notice_name
=
e
.
target
.
parentNode
.
parentNode
.
getAttribute
(
'
data-summary-name
'
);
let
lecture_notice_name
=
e
.
target
.
parentNode
.
parentNode
.
getAttribute
(
'
data-summary-name
'
);
lecture_notice_name
=
lecture_notice_name
+
"
.wav
"
;
lecture_notice_name
=
lecture_notice_name
+
"
.wav
.txt
"
;
alert
(
'
id:
'
+
id
);
alert
(
'
id:
'
+
id
);
alert
(
'
lecture_notice_name:
'
+
lecture_notice_name
);
alert
(
'
lecture_notice_name:
'
+
lecture_notice_name
);
...
...
LectureSummarizingApp/urls.py
View file @
dd665bb8
...
@@ -20,7 +20,7 @@ urlpatterns = [
...
@@ -20,7 +20,7 @@ urlpatterns = [
url
(
r'^lecture-summary/$'
,
api
.
LectureSummaryList
.
as_view
()),
url
(
r'^lecture-summary/$'
,
api
.
LectureSummaryList
.
as_view
()),
url
(
r'^lecture-notices/$'
,
api
.
l
ectureNoticeList
.
as_view
()),
url
(
r'^lecture-notices/$'
,
api
.
L
ectureNoticeList
.
as_view
()),
path
(
'api-auth/'
,
include
(
'rest_framework.urls'
,
namespace
=
'rest_framework'
))
path
(
'api-auth/'
,
include
(
'rest_framework.urls'
,
namespace
=
'rest_framework'
))
...
...
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