Commit 0e9d90dd authored by chalikaM's avatar chalikaM

clearness of the speech

parent 892eb4b8
import spacy
from scipy.io.wavfile import read
import numpy as np
import matplotlib.pyplot as plt
from pydub import AudioSegment
import os
import glob
#Identify ocer complex words
nlp = spacy.load("en_core_web_sm")
doc = nlp("Apple is looking at buying U.K. startup for $1 billion accumulativeness. This ia a dog. <y name is Chalika Mihiran")
for token in doc:
count = len(token)
if count > 12:
print(f"{token.text} - {count}: This is a too complicated word")
#Identify over complex sentences
for sent in doc.sents:
word_count = 0
# print(sent.text)
for words in sent:
# print(words.text)
word_count = word_count + 1
# print(word_count)
sentence_tokens = [sent for sent in doc.sents]
# print(sentence_tokens)
# sentence_words = {}
# word_count = 0
# for sent in sentence_tokens:
# for token in sent:
# sentence_words[sent] = word_count + 1
# print(sentence_words)
#Calculate the rate of the speed
# Read the Audiofile
samplerate, data = read('C:/Users/CHALIKA PC/Desktop/Year 04/Research/Audio/videoplayback_1_.wav')
# Frame rate for the Audio
# print(samplerate)
# Duration of the audio in Seconds
duration = len(data)/samplerate
print("Duration of Audio in Seconds", duration)
print("Duration of Audio in Minutes", duration/60)
# print(len(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