我正在尝试让我的电脑与Ubuntu Utility Ubuntu16.04上的谷歌翻译语音功能进行对话。我找到了一种方法来使用语音库speak
和this repository,但是我在VLC上遇到了错误,我没有在互联网上发现类似的错误。
...
# for text to speech
import webbrowser as wb
import speak
# running music
from pygame import mixer
...
class ActionTranslate(Action):
def name(self):
return 'action_translate'
def run (self,dispatcher,tracker,domain):
try:
# What Google thinks you said
text = tracker.get_slot('sentenceToTranslate')
if tracker.get_slot('voice') is 'en':
lang = 'en'
else:
lang = 'ko'
# Google saying what he thinks you said
speak.speak(text, lang)
f_text = 'https://www.google.co.in/search?q=' + text
wb.get(chrome_path).open(f_text)
except Exception as e:
print (e)
但我收到了这个错误:
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): api.voicerss.org
could not locate runnable browser
[00007ff164c0c2b8] es demux error: cannot peek
[00007ff164c0c2b8] es demux error: cannot peek
[mp3 @ 0x7ff164c5d860] Header missing
我知道peek指的是:
顺序执行非破坏性操作, 具有“顶级元素”概念的类似集合的数据结构 或“下一个元素”,例如堆栈,队列和流。
peek
operation不返回“top”(或“next”)元素的值 “消费”那个元素