python - python中的语音翻译器
问题描述
我已经使用此代码-https ://github.com/Alekh-sinha/google_translator/blob/master/text_to_speech_3.py进行语音翻译。它基本上将语音转换为文本,然后翻译该文本,然后将翻译后的文本转换回声音。我想将它用于在我的 PC 上运行的视频,所以我在我的 PC 中启用了立体声混音并且它有效。但是当我将相同的主体应用于Skype通话时,它不起作用。我将非常感谢有人会在这方面帮助我
解决方案
我已经尝试过了,但由于 Python 版本不同,它不起作用。所以最好在没有 API 的情况下制作一个翻译器,它的代码在这里,但首先进入你的终端并输入 pip install googletrans:
from googletrans import Translator
while True:
sentence=str(input("say..."))
translator=Translator()
translated_sentence=translator.translate(sentence,src='en',dest='hi')
print(translated_sentence.text)
推荐阅读
- c++ - 通过引用返回迭代器
- javascript - Javascript - 将字符串转换为对象数组中的数字
- mysql - 为什么失败的 startupProbe 不会杀死 Pod 而是允许它运行?
- javascript - 为什么我的 if 语句没有响应我对变量所做的更改?
- reactjs - 使用 Docker npm run build 时出现错误
- python - 如何在 Visual Studio 代码中使用整个终端?
- python - 将数据帧发送到 Redis 的最快方法
- python-3.x - 引发 exc.NoSuchModuleError(sqlalchemy.exc.NoSuchModuleError:无法加载插件:sqlalchemy.dialects:postgresql
- node.js - Node.Js 中的示例单元测试
- hash - OpenSSL:如何“手动”获取 x509 -subject_hash?