Commit 862e3829 authored by LiniEisha's avatar LiniEisha

text to pdf

parent b098d5ae
......@@ -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
......@@ -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("audioToText01.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
......@@ -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')
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment