Commit e3753bcb authored by Alessio Quaresima's avatar Alessio Quaresima
Browse files

SpikeTimit.py fixed (no NLTK module needed)

parent 90d4d211
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="TIMIT_loader", # Replace with your username
version="1.0.0",
author="<authorname>",
author_email="<authorname@templatepackage.com>",
description="<Template Setup.py package>",
long_description=long_description,
long_description_content_type="text/markdown",
url="<https://github.com/authorname/templatepackage>",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.6',
)
......@@ -4,7 +4,7 @@ import librosa
import pathlib
from .load_wav import normalize
import numpy as np
from nltk.tokenize import word_tokenize
# from nltk.tokenize import word_tokenize
......@@ -73,7 +73,7 @@ def count_dataset(path, dtype="train"):
yield 1
def get_dialect(path):
return int(path.split("\\")[-3][-1])
return int(path.split("/")[-3][-1])
# | > x->parse(Int, filter(startswith("dr"), x)[1][end])
......@@ -89,7 +89,7 @@ def yield_dataset(path):
Speaker_ID = dirname.split("/")[-1]
path = os.path.join(dirname, _file.split(".")[0])
sentence = read_utterance(path+".txt")
words = word_tokenize(sentence.lower())
words = (sentence.lower()).split()
gender = Speaker_ID[0]
a, b = get_word_times(path)
words = [[w,t[0],t[1]] for w, t in zip(a,b)]
......@@ -222,7 +222,7 @@ BAE = {"b": int(np.ceil(1 / np.log2(238.3 / 200.3))), "hop": 16, "fmin": 200, "n
def get_spectra(dataframe, target_words=[], cqt_p=BAE):
def scale_times(times, scaling):
t0, t1 = times
return round(t0 * scaling), int(t1 * scaling)
return int(t0 * scaling), int(t1 * scaling)
words_list = []
paths = dataframe.path
......@@ -362,4 +362,3 @@ def get_spectra(dataframe, target_words=[], cqt_p=BAE):
# def first_speaker_id(sentence_number):
# return get_speakers_id(sentence_number)[1]
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