Commit b96dbe0f authored by LiniEisha's avatar LiniEisha

Integrate

parent 99a8496c
...@@ -2,7 +2,7 @@ import nltk ...@@ -2,7 +2,7 @@ import nltk
import os import os
from fpdf import FPDF from fpdf import FPDF
def LectureNotice(notice_name): def GetLectureNotice(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))
...@@ -57,4 +57,6 @@ def LectureNotice(notice_name): ...@@ -57,4 +57,6 @@ def LectureNotice(notice_name):
# save the pdf with name .pdf # save the pdf with name .pdf
pdf.output("PDF_DESTINATION_DIR") pdf.output("PDF_DESTINATION_DIR")
return text listToStr = ' '.join([str(elem) for elem in sentences_with_word])
\ No newline at end of file
return text, listToStr
\ No newline at end of file
...@@ -8,6 +8,7 @@ def LectureSummary(summary_name): ...@@ -8,6 +8,7 @@ def LectureSummary(summary_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(summary_name)) FILE_PATH = os.path.join(BASE_DIR, "speechToText\\{}".format(summary_name))
print('file path: ' , FILE_PATH)
DESTINATION_DIR = os.path.join(BASE_DIR, "summary\\Summary_{}".format(summary_name)) DESTINATION_DIR = os.path.join(BASE_DIR, "summary\\Summary_{}".format(summary_name))
print('destination directory: ', DESTINATION_DIR) print('destination directory: ', DESTINATION_DIR)
......
...@@ -14,6 +14,7 @@ import datetime ...@@ -14,6 +14,7 @@ import datetime
# APIs used in Lecture Summarizing Component # APIs used in Lecture Summarizing Component
from .ExtractKeySentences import GetLectureNotice
from .Summary import LectureSummary from .Summary import LectureSummary
from .noise import noise_removal from .noise import noise_removal
from .speech_to_text import speech_to_text from .speech_to_text import speech_to_text
...@@ -106,7 +107,7 @@ class audioToTextList(APIView): ...@@ -106,7 +107,7 @@ class audioToTextList(APIView):
# generate new id for speech to text file # generate new id for speech to text file
new_speech_to_text_id = generate_new_id(audio_to_text_list.lecture_speech_to_text_id) 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) speech_to_text(speech_to_text_name)
...@@ -180,11 +181,11 @@ class LectureNoticeList(APIView): ...@@ -180,11 +181,11 @@ class LectureNoticeList(APIView):
# generate new id for notice # generate new id for notice
notice_id = "LN0001" if lecture_notice_list is None else 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)
text = LectureNotices(lecture_notice_name) text, sentences_with_word = GetLectureNotice(lecture_notice_name)
LectureNotices( LectureNotices(
lecture_notice_id=notice_id, lecture_notice_id=notice_id,
lecture_audio_id=id, lecture_audio_id_id=id,
notice_text=text notice_text=text
).save() ).save()
return Response({"response": request.data}) return Response({"response": request.data})
......
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