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
21895570
Commit
21895570
authored
Jan 10, 2021
by
LiniEisha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integration
parent
325d7379
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
17 deletions
+48
-17
LectureSummarizingApp/ExtractKeySentences.py
LectureSummarizingApp/ExtractKeySentences.py
+6
-0
LectureSummarizingApp/Summary.py
LectureSummarizingApp/Summary.py
+5
-0
LectureSummarizingApp/api.py
LectureSummarizingApp/api.py
+4
-4
LectureSummarizingApp/lecture_audio_batch_process.py
LectureSummarizingApp/lecture_audio_batch_process.py
+21
-10
LectureSummarizingApp/noise.py
LectureSummarizingApp/noise.py
+4
-0
LectureSummarizingApp/speech_to_text.py
LectureSummarizingApp/speech_to_text.py
+6
-1
LectureSummarizingApp/urls.py
LectureSummarizingApp/urls.py
+2
-2
No files found.
LectureSummarizingApp/ExtractKeySentences.py
View file @
21895570
...
...
@@ -9,6 +9,9 @@ def GetLectureNotice(notice_name):
DESTINATION_DIR
=
os
.
path
.
join
(
BASE_DIR
,
"notices
\\
Notice_{}"
.
format
(
notice_name
))
print
(
'destination directory: '
,
DESTINATION_DIR
)
print
(
'starting the notice process'
)
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")]
...
...
@@ -65,4 +68,7 @@ def GetLectureNotice(notice_name):
listToStr
=
' '
.
join
([
str
(
elem
)
for
elem
in
sentences_with_word
])
print
(
'ending the notice process'
)
return
text
,
listToStr
\ No newline at end of file
LectureSummarizingApp/Summary.py
View file @
21895570
...
...
@@ -12,6 +12,9 @@ def LectureSummary(summary_name):
DESTINATION_DIR
=
os
.
path
.
join
(
BASE_DIR
,
"summary
\\
Summary_{}"
.
format
(
summary_name
))
print
(
'destination directory: '
,
DESTINATION_DIR
)
print
(
'starting the summary process'
)
# Reading the file
nlp
=
pt_core_news_sm
.
load
()
# file = open(DESTINATION_DIR, 'w')
...
...
@@ -93,4 +96,6 @@ def LectureSummary(summary_name):
# convert the summary list to a text
listToStr
=
' '
.
join
([
str
(
elem
)
for
elem
in
summary
])
print
(
'ending the summary process'
)
return
text
,
listToStr
\ No newline at end of file
LectureSummarizingApp/api.py
View file @
21895570
...
...
@@ -48,7 +48,7 @@ class LectureAudioAPI(APIView):
class
a
udioNoiseRemovedList
(
APIView
):
class
A
udioNoiseRemovedList
(
APIView
):
def
get
(
self
,
request
):
# lecture_audio_noise_removed = LectureAudioNoiseRemoved.objects.all()
...
...
@@ -68,7 +68,7 @@ class audioNoiseRemovedList(APIView):
# nr.noise_removalll(video_name)
noise_removal
(
audio_name
)
a
,
sr
=
noise_removal
(
audio_name
)
LectureAudioNoiseRemoved
(
lecture_audio_noise_removed_id
=
new_audio_noise_removed_id
,
...
...
@@ -93,7 +93,7 @@ class audioNoiseRemovedList(APIView):
return
Response
({
"response"
:
request
.
data
})
class
a
udioToTextList
(
APIView
):
class
A
udioToTextList
(
APIView
):
def
get
(
self
,
request
):
#lecture_speech_to_text_id = LectureSpeechToText.objects.all()
...
...
@@ -111,7 +111,7 @@ class audioToTextList(APIView):
# generate new id for speech to text file
new_speech_to_text_id
=
"LST0001"
if
audio_to_text_list
is
None
else
generate_new_id
(
audio_to_text_list
.
lecture_speech_to_text_id
)
speech_to_text
(
speech_to_text_name
)
is_finished
=
speech_to_text
(
speech_to_text_name
)
LectureSpeechToText
(
lecture_speech_to_text_id
=
new_speech_to_text_id
,
...
...
LectureSummarizingApp/lecture_audio_batch_process.py
View file @
21895570
...
...
@@ -8,26 +8,37 @@ def summarization_batch_process(audio_id, audio_name):
is_all_processed
=
False
noise_removed_resp
=
requests
.
get
(
'http://127.0.0.1:800/summary/lecture-audio-noise-removed'
,
params
=
{
'id'
:
audio_id
,
'audio_name'
:
audio_name
})
noise_removed_resp
=
requests
.
get
(
'http://127.0.0.1:8000/summary/lecture-audio-noise-removed/'
,
params
=
{
'id'
:
audio_id
,
'audio_name'
:
audio_name
})
print
(
'response: '
,
noise_removed_resp
.
json
())
if
noise_removed_resp
.
json
()[
'response'
]
==
200
:
print
(
'successful noise removed response'
)
audio_root_name
=
audio_name
.
split
(
'.'
)[
0
]
speech_to_text_name
=
audio_root_name
+
'.txt'
audio_text_resp
=
requests
.
get
(
'http://127.0.0.1:800
/summary/lecture-audio-to-text
'
,
params
=
{
'id'
:
audio_id
,
'speech_to_text_name'
:
speech_to_text_name
})
audio_text_resp
=
requests
.
get
(
'http://127.0.0.1:800
0/summary/lecture-audio-to-text/
'
,
params
=
{
'id'
:
audio_id
,
'speech_to_text_name'
:
speech_to_text_name
})
if
audio_text_resp
.
json
()[
'response'
]
==
200
:
print
(
'successful audio to text response'
)
summary_name
=
audio_name
+
'.txt'
summary_resp
=
requests
.
get
(
'http://127.0.0.1:800/summary/lecture-summary'
,
params
=
{
'id'
:
audio_id
,
'lecture_summary_name'
:
summary_name
})
summary_resp
=
requests
.
get
(
'http://127.0.0.1:8000/summary/lecture-summary/'
,
params
=
{
'id'
:
audio_id
,
'lecture_summary_name'
:
summary_name
})
if
summary_resp
.
json
()[
'response'
]
==
200
:
notice_resp
=
requests
.
get
(
'http://127.0.0.1:800/summary/lecture-notices'
,
params
=
{
'id'
:
audio_id
,
'lecture_notice_name'
:
summary_name
})
print
(
'successful summary response'
)
notice_resp
=
requests
.
get
(
'http://127.0.0.1:8000/summary/lecture-notices/'
,
params
=
{
'id'
:
audio_id
,
'lecture_notice_name'
:
summary_name
})
if
notice_resp
.
json
()[
'response'
]
==
200
:
print
(
'successful notice response'
)
is_all_processed
=
True
...
...
@@ -54,9 +65,9 @@ def save_lecturer_audio(lecturer_audio):
return
response
# this is a test method (delete later)
if
__name__
==
'__main__'
:
audio_id
=
1
audio_name
=
'Lecture01.wav'
summarization_batch_process
(
audio_id
=
audio_id
,
audio_name
=
audio_name
)
\ No newline at end of file
# # this is a test method (delete later)
# if __name__ == '__main__':
# audio_id = 1
# audio_name = 'Lecture01.wav'
#
# summarization_batch_process(audio_id=audio_id, audio_name=audio_name)
\ No newline at end of file
LectureSummarizingApp/noise.py
View file @
21895570
...
...
@@ -10,6 +10,8 @@ def noise_removal(video_name):
# sample_directory = 'lectures/'
# sample_path = sample_directory + sample_file
print
(
'starting the noise removal process'
)
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
LECTURE_VIDEO_DIR
=
os
.
path
.
join
(
BASE_DIR
,
"lectures
\\
{}"
.
format
(
video_name
))
...
...
@@ -27,6 +29,8 @@ def noise_removal(video_name):
output_file
(
destination
=
DESTINATION_DIR
,
filename
=
video_name
,
a
=
a
,
sr
=
sr
)
print
(
'ending the noise removal process'
)
return
a
,
sr
...
...
LectureSummarizingApp/speech_to_text.py
View file @
21895570
...
...
@@ -4,6 +4,7 @@ import os
def
speech_to_text
(
speech_to_text_name
):
print
(
'starting the speech_to_text process'
)
#calling the Recognizer()
r
=
sr
.
Recognizer
()
...
...
@@ -26,3 +27,7 @@ def speech_to_text(speech_to_text_name):
file
.
write
(
'error'
)
file
.
close
()
print
(
'ending the speech_to_text process'
)
return
True
LectureSummarizingApp/urls.py
View file @
21895570
...
...
@@ -14,9 +14,9 @@ urlpatterns = [
# API to retrieve lecture summarizing details
url
(
r'^lecture-audio'
,
api
.
LectureAudioAPI
.
as_view
()),
url
(
r'^lecture-audio-noise-removed/$'
,
api
.
a
udioNoiseRemovedList
.
as_view
()),
url
(
r'^lecture-audio-noise-removed/$'
,
api
.
A
udioNoiseRemovedList
.
as_view
()),
url
(
r'^lecture-audio-to-text/
'
,
api
.
a
udioToTextList
.
as_view
()),
url
(
r'^lecture-audio-to-text/
$'
,
api
.
A
udioToTextList
.
as_view
()),
url
(
r'^lecture-summary/$'
,
api
.
LectureSummaryList
.
as_view
()),
...
...
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