Commit 51a8aad4 authored by LiniEisha's avatar LiniEisha

Integrate

parent b96dbe0f
......@@ -10,9 +10,15 @@ def GetLectureNotice(notice_name):
print('destination directory: ', DESTINATION_DIR)
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 = []
sentence_list = nltk.sent_tokenize(read_lines)
sentence_list = nltk.sent_tokenize(text)
word_search = "important"
sentences_with_word = []
for sentence in sentence_list:
......@@ -55,7 +61,7 @@ def GetLectureNotice(notice_name):
pdf.cell(200, 10, txt=x, ln=1, align='C')
# 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])
......
......@@ -88,7 +88,7 @@ def LectureSummary(summary_name):
pdf.cell(200, 10, txt=x, ln=1, align='C')
# save the pdf with name .pdf
pdf.output(PDF_DESTINATION_DIR)
# pdf.output(PDF_DESTINATION_DIR)
# convert the summary list to a text
listToStr = ' '.join([str(elem) for elem in summary])
......
......@@ -153,7 +153,7 @@ class LectureSummaryList(APIView):
audio_original_text=text,
audio_summary=summary
).save()
return Response({"response": request.data})
return Response({"response": Response.status_code})
def post(self, request):
LectureAudioSummary(
......@@ -188,7 +188,7 @@ class LectureNoticeList(APIView):
lecture_audio_id_id=id,
notice_text=text
).save()
return Response({"response": request.data})
return Response({"response": Response.status_code})
......
......@@ -11,11 +11,11 @@ def noise_removal(video_name):
# sample_path = sample_directory + sample_file
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
LECTURE_VIDEO_DIR = os.path.join(BASE_DIR, "LectureSummarizingApp\\lectures\\{}".format(video_name))
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
LECTURE_VIDEO_DIR = os.path.join(BASE_DIR, "lectures\\{}".format(video_name))
print('lecture audio directory: ', LECTURE_VIDEO_DIR)
# 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)
# generating audio time series and a sampling rate (int)
a, sr = librosa.load(path=LECTURE_VIDEO_DIR)
......@@ -75,6 +75,7 @@ def mffc_highshelf(a, sr):
# return a_enhanced
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)
......@@ -86,8 +86,8 @@
$('.to_summary').click(function(e) {
alert('Processing');
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-notice-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');-->
<!-- lecture_summary_name = lecture_summary_name + ".txt";-->
lecture_summary_name = lecture_summary_name + ".wav.txt";
alert('id: ' + id);
......@@ -112,7 +112,7 @@
$('.get_notices').click(function(e) {
alert('Processing');
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";
alert('id: ' + id);
alert('lecture_notice_name: ' + lecture_notice_name);
......@@ -311,7 +311,7 @@
<tbody>
{% 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>-->
<!-- <div class="radio">-->
<!-- <label><input type="radio"-->
......
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