def setup(): '''Copy, convert, TTS and spectrogram''' print("Setup Starting") initialize_dataset_dir() transfer_arrange(config.dataset_location) print("Data transfer complete") mediaconvert.convert_all("Data/HumanAudioFlac") tts.make_tts("Data/Text/3081-166546.trans.txt") spectrogram.spectrogram_tts() spectrogram.spectrogram_human_audio() print("Setup Done")
def get_recipe2(food): r = requests.get("http://www.10000recipe.com/recipe/list.html?q=" + food) s = BeautifulSoup(r.content, "html.parser") food_list = s.find("div", { "class": "col-xs-4" }).find("a", {"class": "thumbnail"})['href'] r = requests.get('http://www.10000recipe.com/' + food_list) s = BeautifulSoup(r.content, "html.parser") aa = s.find_all("div", {"class": "view_step"})[0] t = aa.find_all('div', id=re.compile('^stepDiv')) p = [f.text for f in t] recip = [l.replace('\n', '') for l in p] #print(str(recip[0])) recip = ' '.join(recip) make_tts(str(recip)) print("================end in get_recipe2") return str(recip)
def get_recipe(food): r = requests.get("http://www.10000recipe.com/recipe/list.html?q=" + food) s = BeautifulSoup(r.content, "html.parser") food_list = s.find("div", { "class": "col-xs-4" }).find("a", {"class": "thumbnail"})['href'] r = requests.get('http://www.10000recipe.com/' + food_list) print('http://www.10000recipe.com/' + food_list) s = BeautifulSoup(r.content, "html.parser") i = s.find("div", {"class": "ready_ingre3"}) li = i.findAll("li") rtn = [ l.text.replace(' ', ' ').replace('\n', '') for l in li ] rtn = ' '.join(rtn) #print(str(rtn[0])) make_tts(str(rtn)) print("=================end in get_recipe") return str(rtn)
def get_tts(input): make_tts(input)
def test_make_tts(self): '''test the generation of tts wav files''' assert os.path.exists("Data/Text/3081-166546.trans.txt") tts.make_tts("Data/Text/3081-166546.trans.txt") assert os.path.exists("Data/TTS/3081-166546-0000.wav") assert os.path.exists("Data/TTS/3081-166546-0089.wav")