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
862e3829
Commit
862e3829
authored
Jan 08, 2021
by
LiniEisha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
text to pdf
parent
b098d5ae
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
32 deletions
+46
-32
LectureSummarizingApp/ExtractKeySentences.py
LectureSummarizingApp/ExtractKeySentences.py
+20
-1
LectureSummarizingApp/Summary.py
LectureSummarizingApp/Summary.py
+25
-6
LectureSummarizingApp/noise.py
LectureSummarizingApp/noise.py
+0
-24
LectureSummarizingApp/templates/LectureSummarizingApp/summarization.html
...ingApp/templates/LectureSummarizingApp/summarization.html
+1
-1
No files found.
LectureSummarizingApp/ExtractKeySentences.py
View file @
862e3829
...
...
@@ -25,4 +25,23 @@ def LectureNotice(notice_name):
for
sentence
in
sentences_list
:
if
sentence
.
count
(
word
)
>
0
:
sentences_with_word
.
append
(
sentence
)
word_sentence_dictionary
[
word
]
=
sentences_with_word
\ No newline at end of file
word_sentence_dictionary
[
word
]
=
sentences_with_word
def
SaveNotices
():
pdf
=
FPDF
()
# Add a page
pdf
.
add_page
()
# set style and size of font
# that you want in the pdf
pdf
.
set_font
(
"Arial"
,
size
=
15
)
# open the text file in read mode
f
=
open
(
"Summary01.txt"
,
"r"
)
# insert the texts in pdf
for
x
in
f
:
pdf
.
cell
(
200
,
10
,
txt
=
x
,
ln
=
1
,
align
=
'C'
)
# save the pdf with name .pdf
pdf
.
output
(
"summary01.pdf"
)
\ No newline at end of file
LectureSummarizingApp/Summary.py
View file @
862e3829
...
...
@@ -5,14 +5,14 @@ import os
def
LectureSummary
(
summary_name
):
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
FILE_PATH
=
os
.
path
.
join
(
BASE_DIR
,
"speechToText
\\
{}"
.
format
(
summary_name
))
DESTINATION_DIR
=
os
.
path
.
dirname
(
os
.
path
.
join
(
BASE_DIR
,
"LectureSummarizingApp
\\
summary
\\
sample.txt"
))
print
(
'destination directory: '
,
DESTINATION_DIR
)
#
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
#
FILE_PATH = os.path.join(BASE_DIR, "speechToText\\{}".format(summary_name))
#
DESTINATION_DIR = os.path.dirname(os.path.join(BASE_DIR, "LectureSummarizingApp\\summary\\sample.txt"))
#
print('destination directory: ', DESTINATION_DIR)
# Reading the file
nlp
=
pt_core_news_sm
.
load
()
with
open
(
"audioToText
01
.txt"
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
"audioToText.txt"
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
text
=
" "
.
join
(
f
.
readlines
())
doc
=
nlp
(
text
)
...
...
@@ -55,4 +55,23 @@ def LectureSummary(summary_name):
for
i
in
summary
:
file
=
open
(
'Summary01.txt'
,
'w'
)
file
.
write
(
str
(
i
))
file
.
close
()
\ No newline at end of file
file
.
close
()
def
SaveSummary
():
pdf
=
FPDF
()
# Add a page
pdf
.
add_page
()
# set style and size of font
# that you want in the pdf
pdf
.
set_font
(
"Arial"
,
size
=
15
)
# open the text file in read mode
f
=
open
(
"Summary01.txt"
,
"r"
)
# insert the texts in pdf
for
x
in
f
:
pdf
.
cell
(
200
,
10
,
txt
=
x
,
ln
=
1
,
align
=
'C'
)
# save the pdf with name .pdf
pdf
.
output
(
"summary01.pdf"
)
\ No newline at end of file
LectureSummarizingApp/noise.py
View file @
862e3829
...
...
@@ -78,27 +78,3 @@ def output_file(destination ,filename, a, sr, ext=""):
destination
=
destination
+
filename
[:
-
4
]
+
ext
+
'.wav'
librosa
.
output
.
write_wav
(
destination
,
a
,
sr
)
# lectures = ['Lecture01.wav', 'Lecture02.wav']
# for s in lectures:
# filename = s
# a, sr = noise_removal(filename)
#
#
# # a_reduced_centroid_s = reduce_noise_centroid_s(a, sr)
# # a_reduced_mfcc_lowshelf = mfcc_lowshelf(a, sr)
# a_reduced_mfcc_highshelf = mffc_highshelf(a, sr)
#
#
# # trimming silences
# # a_reduced_centroid_s, time_trimmed = trim_silence(a_reduced_centroid_s)
# # a_reduced_mfcc_up, time_trimmed = trim_silence(mfcc_lowshelf)
# a_reduced_mfcc_down, time_trimmed = trim_silence(mffc_highshelf)
#
#
#
# # output_file('lectures_trimmed_noise_reduced/' ,filename, y_reduced_centroid_s, sr, '_ctr_s')
# #output_file('lectures_trimmed_noise_reduced/' ,filename, a_reduced_mfcc_up, sr, '_mfcc_up')
# output_file('lectures_trimmed_noise_reduced/' ,filename, a_reduced_mfcc_down, sr, '_mfcc_down')
# # output_file('lectures_trimmed_noise_reduced/' ,filename, a, sr, '_org')
LectureSummarizingApp/templates/LectureSummarizingApp/summarization.html
View file @
862e3829
...
...
@@ -326,7 +326,7 @@
</button>
</td>
<td>
<button
TYPE=
"button"
class=
"btn btn-
danger
get_notices"
>
Notices
<button
TYPE=
"button"
class=
"btn btn-
success
get_notices"
>
Notices
</button>
</td>
</tr>
...
...
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