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
51a8aad4
Commit
51a8aad4
authored
Jan 10, 2021
by
LiniEisha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integrate
parent
b96dbe0f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
14 deletions
+21
-14
LectureSummarizingApp/ExtractKeySentences.py
LectureSummarizingApp/ExtractKeySentences.py
+9
-3
LectureSummarizingApp/Summary.py
LectureSummarizingApp/Summary.py
+1
-1
LectureSummarizingApp/api.py
LectureSummarizingApp/api.py
+2
-2
LectureSummarizingApp/noise.py
LectureSummarizingApp/noise.py
+5
-4
LectureSummarizingApp/templates/LectureSummarizingApp/summarization.html
...ingApp/templates/LectureSummarizingApp/summarization.html
+4
-4
No files found.
LectureSummarizingApp/ExtractKeySentences.py
View file @
51a8aad4
...
@@ -10,9 +10,15 @@ def GetLectureNotice(notice_name):
...
@@ -10,9 +10,15 @@ def GetLectureNotice(notice_name):
print
(
'destination directory: '
,
DESTINATION_DIR
)
print
(
'destination directory: '
,
DESTINATION_DIR
)
text
=
''
text
=
''
read_lines
=
[
line
.
rstrip
(
'
\n
'
)
for
line
in
open
(
FILE_PATH
,
"r"
)]
# read_lines = [line.rstrip('\n') for line in open(FILE_PATH, "r")]
# read_lines = [line.rstrip('\n') for line in open(FILE_PATH, "r")]
for
line
in
open
(
FILE_PATH
,
"r"
):
text
+=
line
.
rstrip
(
'
\n
'
)
sentences_list
=
[]
sentences_list
=
[]
sentence_list
=
nltk
.
sent_tokenize
(
read_lines
)
sentence_list
=
nltk
.
sent_tokenize
(
text
)
word_search
=
"important"
word_search
=
"important"
sentences_with_word
=
[]
sentences_with_word
=
[]
for
sentence
in
sentence_list
:
for
sentence
in
sentence_list
:
...
@@ -55,7 +61,7 @@ def GetLectureNotice(notice_name):
...
@@ -55,7 +61,7 @@ def GetLectureNotice(notice_name):
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
(
"PDF_DESTINATION_DIR"
)
#
pdf.output("PDF_DESTINATION_DIR")
listToStr
=
' '
.
join
([
str
(
elem
)
for
elem
in
sentences_with_word
])
listToStr
=
' '
.
join
([
str
(
elem
)
for
elem
in
sentences_with_word
])
...
...
LectureSummarizingApp/Summary.py
View file @
51a8aad4
...
@@ -88,7 +88,7 @@ def LectureSummary(summary_name):
...
@@ -88,7 +88,7 @@ def LectureSummary(summary_name):
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
(
PDF_DESTINATION_DIR
)
#
pdf.output(PDF_DESTINATION_DIR)
# convert the summary list to a text
# convert the summary list to a text
listToStr
=
' '
.
join
([
str
(
elem
)
for
elem
in
summary
])
listToStr
=
' '
.
join
([
str
(
elem
)
for
elem
in
summary
])
...
...
LectureSummarizingApp/api.py
View file @
51a8aad4
...
@@ -153,7 +153,7 @@ class LectureSummaryList(APIView):
...
@@ -153,7 +153,7 @@ class LectureSummaryList(APIView):
audio_original_text
=
text
,
audio_original_text
=
text
,
audio_summary
=
summary
audio_summary
=
summary
)
.
save
()
)
.
save
()
return
Response
({
"response"
:
request
.
data
})
return
Response
({
"response"
:
Response
.
status_code
})
def
post
(
self
,
request
):
def
post
(
self
,
request
):
LectureAudioSummary
(
LectureAudioSummary
(
...
@@ -188,7 +188,7 @@ class LectureNoticeList(APIView):
...
@@ -188,7 +188,7 @@ class LectureNoticeList(APIView):
lecture_audio_id_id
=
id
,
lecture_audio_id_id
=
id
,
notice_text
=
text
notice_text
=
text
)
.
save
()
)
.
save
()
return
Response
({
"response"
:
request
.
data
})
return
Response
({
"response"
:
Response
.
status_code
})
...
...
LectureSummarizingApp/noise.py
View file @
51a8aad4
...
@@ -11,11 +11,11 @@ def noise_removal(video_name):
...
@@ -11,11 +11,11 @@ def noise_removal(video_name):
# sample_path = sample_directory + sample_file
# sample_path = sample_directory + sample_file
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)
))
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
LECTURE_VIDEO_DIR
=
os
.
path
.
join
(
BASE_DIR
,
"
LectureSummarizingApp
\\
lectures
\\
{}"
.
format
(
video_name
))
LECTURE_VIDEO_DIR
=
os
.
path
.
join
(
BASE_DIR
,
"lectures
\\
{}"
.
format
(
video_name
))
print
(
'lecture audio directory: '
,
LECTURE_VIDEO_DIR
)
print
(
'lecture audio directory: '
,
LECTURE_VIDEO_DIR
)
# DESTINATION_DIR = os.path.join(BASE_DIR, "LectureSummarizingApp\\noise_removed_lectures")
# DESTINATION_DIR = os.path.join(BASE_DIR, "LectureSummarizingApp\\noise_removed_lectures")
DESTINATION_DIR
=
os
.
path
.
dirname
(
os
.
path
.
join
(
BASE_DIR
,
"
LectureSummarizingApp
\\
noise_removed_lectures
\\
sample.txt"
))
DESTINATION_DIR
=
os
.
path
.
dirname
(
os
.
path
.
join
(
BASE_DIR
,
"noise_removed_lectures
\\
sample.txt"
))
print
(
'destination directory: '
,
DESTINATION_DIR
)
print
(
'destination directory: '
,
DESTINATION_DIR
)
# generating audio time series and a sampling rate (int)
# generating audio time series and a sampling rate (int)
a
,
sr
=
librosa
.
load
(
path
=
LECTURE_VIDEO_DIR
)
a
,
sr
=
librosa
.
load
(
path
=
LECTURE_VIDEO_DIR
)
...
@@ -75,6 +75,7 @@ def mffc_highshelf(a, sr):
...
@@ -75,6 +75,7 @@ def mffc_highshelf(a, sr):
# return a_enhanced
# return a_enhanced
def
output_file
(
destination
,
filename
,
a
,
sr
,
ext
=
""
):
def
output_file
(
destination
,
filename
,
a
,
sr
,
ext
=
""
):
destination
=
destination
+
filename
[:
-
4
]
+
ext
+
'.wav'
destination
=
destination
+
"
\\
"
+
filename
[:
-
4
]
+
ext
+
'.wav'
print
(
'output destination: '
,
destination
)
librosa
.
output
.
write_wav
(
destination
,
a
,
sr
)
librosa
.
output
.
write_wav
(
destination
,
a
,
sr
)
LectureSummarizingApp/templates/LectureSummarizingApp/summarization.html
View file @
51a8aad4
...
@@ -86,8 +86,8 @@
...
@@ -86,8 +86,8 @@
$
(
'
.to_summary
'
).
click
(
function
(
e
)
{
$
(
'
.to_summary
'
).
click
(
function
(
e
)
{
alert
(
'
Processing
'
);
alert
(
'
Processing
'
);
let
id
=
e
.
target
.
parentNode
.
parentNode
.
getAttribute
(
'
id
'
);
let
id
=
e
.
target
.
parentNode
.
parentNode
.
getAttribute
(
'
id
'
);
<!--
let
lecture_summary_name
=
e
.
target
.
parentNode
.
parentNode
.
getAttribute
(
'
data-summary-name
'
);
-->
let
lecture_summary_name
=
e
.
target
.
parentNode
.
parentNode
.
getAttribute
(
'
data-summary-name
'
);
let
lecture_summary_name
=
e
.
target
.
parentNode
.
parentNode
.
getAttribute
(
'
data-notice-name
'
);
<!--
let
lecture_summary_name
=
e
.
target
.
parentNode
.
parentNode
.
getAttribute
(
'
data-notice-name
'
);
-->
<!--
lecture_summary_name
=
lecture_summary_name
+
"
.txt
"
;
-->
<!--
lecture_summary_name
=
lecture_summary_name
+
"
.txt
"
;
-->
lecture_summary_name
=
lecture_summary_name
+
"
.wav.txt
"
;
lecture_summary_name
=
lecture_summary_name
+
"
.wav.txt
"
;
alert
(
'
id:
'
+
id
);
alert
(
'
id:
'
+
id
);
...
@@ -112,7 +112,7 @@
...
@@ -112,7 +112,7 @@
$
(
'
.get_notices
'
).
click
(
function
(
e
)
{
$
(
'
.get_notices
'
).
click
(
function
(
e
)
{
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-
notice
-name
'
);
lecture_notice_name
=
lecture_notice_name
+
"
.wav.txt
"
;
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
);
...
@@ -311,7 +311,7 @@
...
@@ -311,7 +311,7 @@
<tbody>
<tbody>
{% for lec_text in lecture_text_data %}
{% for lec_text in lecture_text_data %}
<tr
class=
"recordings not_clicked"
id=
"{{ lec_text.lecture_audio_id.id }}"
data-summary-name=
"{{lec_text.lecture_audio_id.lecture_audio_name}}"
data-notice-name=
"{{lec_text.lecture_audio_id}}"
>
<tr
class=
"recordings not_clicked"
id=
"{{ lec_text.lecture_audio_id.id }}"
data-summary-name=
"{{lec_text.lecture_audio_id.lecture_audio_name}}"
data-notice-name=
"{{lec_text.lecture_audio_id
.lecture_audio_name
}}"
>
<!-- <td>-->
<!-- <td>-->
<!-- <div class="radio">-->
<!-- <div class="radio">-->
<!-- <label><input type="radio"-->
<!-- <label><input type="radio"-->
...
...
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