Comments (3)
I think we got this problem because the script voice_recognition.py
has not been updated for ver.2.0b, maybe.(There is one miss-spelling of recognise
so I wonder if this function really works in ver.1.0). So I tried to fix it. Update the def recognize_speech(self, bot, update, args=[]
block as the code below:
def recognize_speech(self, bot, update, args=[]):
"""
Recognise voice message. Triggered by `/recog`.
Args:
bot: Telegram Bot instance
update: Message update
args: Arguments from message
"""
if not getattr(update.message, "reply_to_message", None):
text = self._("/recog lang_code\n" \
"Reply to a voice with this command to recognize it.\n" \
"examples:\n/recog zh\n/recog en-US\n\nSupported languages:\n")
text += "\n".join("%s: %r" % (i.engine_name, i.lang_list) for i in self.voice_engines)
return self._reply_error(bot, update, text)
if not getattr(update.message.reply_to_message, "voice"):
return self._reply_error(bot, update,
self._("Reply only to a voice with this command to recognize it. (RS02)"))
if update.message.reply_to_message.voice.duration > 60:
return self._reply_error(bot, update, self._("Only voice shorter than 60s is supported. (RS04)"))
f = bot.get_file(update.message.reply_to_message.voice.file_id)
file = tempfile.NamedTemporaryFile()
f.download(out=file)
file.seek(0)
results = OrderedDict()
if not args:
args=['zh']
for i in self.voice_engines:
results["%s (%s)" % (i.engine_name, args[0])] = i.recognize(file.name, args[0])
msg = ""
for i in results:
msg += "\n<b>%s</b>:\n" % html.escape(i)
for j in results[i]:
msg += "%s\n" % html.escape(j)
msg = self._("Results:\n{0}").format(msg)
bot.send_message(update.message.reply_to_message.chat.id, msg,
reply_to_message_id=update.message.reply_to_message.message_id,
parse_mode=telegram.ParseMode.HTML)
file.close()
Baiduspeech works well for me, but I got some problem with Bingspeech:
/recog
Results:
Bing (zh):
å� 为ä¹�å��ç��è¿�å¾�å¤�é�£ç§�è·�ä½ è¯´è¿�äº�å��å°±ç®�äº�å��ç�¶å��å�¢æ²¡æ�³å�°æ��天ä¸�ç�äº�ã��
å� 为ä¹�å��ç��è¿�å¾�å¤�é�£ç§�è·�ä½ è¯´è¿�äº�å°±ç®�äº�å��ç�¶å��å�¢æ²¡æ�³å�°æ��天ä¸�ç�äº�ã��
å� 为ä¹�å��ç��è¿�å¾�å¤�é�£ç§�è·�ä½ è¯´è¿�äº�å��å°±ç®�äº�å��ç�¶å��å�¢æ²¡æ�³å�°ä½ ç�¶å��ä¸�ç�äº�ã��
å� 为ä¹�å��ç��è¿�å¾�å¤�é�£ç§�è·�ä½ è¯´è¿�äº�å��å°±ç®�äº�å��ç�¶å��å�¢æ²¡æ�³å�°ä½ 天ä»�æ�¢äº�ã��
å� 为ä¹�å��ç��è¿�å¾�å¤�é�£ç§�è·�ä½ è¯´è¿�äº�å°±ç®�äº�å��ç�¶å��å�¢æ²¡æ�³å�°ä½ ç�¶å��ä¸�ç�äº�ã��
Baidu (zh):
真的受不了了就算了嘛,
Seems some coding problem happened. I just want to recognize speech for wechat so Baidu is enough for now.
from efb-telegram-master.
Thank you for the report. Actually I'm considering isolating this voice recognition module as a middleware. I will try to fix this when the middleware is released.
from efb-telegram-master.
Voice recognition implemented as middleware by @catbaron0.
Thank you for your effort!
from efb-telegram-master.
Related Issues (20)
- [BUG]添加http代理,设置账户密码后日志显示找不到参数username
- [FR] support telegram api host
- [BUG] When sending an mp3 file, it has no filename
- [BUG] send message failed with time out HOT 7
- [BUG] Use own api_url,python-telegram-bot errors caused by parameter changes HOT 1
- [BUG] Cannot send stickers in WebM format. HOT 1
- [BUG] peewee.OperationalError: database is locked HOT 6
- [BUG] Unable to link groups HOT 3
- [BUG] raise RetryAfter(retry_after) telegram.error.RetryAfter: Flood control exceeded. Retry in 5.0 seconds HOT 1
- Wipe description on Telegram when a linked chat does not have a description/member list HOT 1
- [FR] Support auto link functionality HOT 1
- [FR] automatic group creating feature HOT 4
- [BUG] cant send large file when use local telegram api HOT 9
- [FR] 在TG发送未绑定消息时弹出的对话选择框加个延时,到时间不点按钮的话自动退出。
- [FR] Resent the incoming photo as a file HOT 2
- [BUG] Using telegram bot local server can't send / receive Files HOT 3
- [BUG] Can't send stickers in ETM 2.3.1
- [FR] Forward all unlinked contacts or group information to a special group
- [FR] Keep the video name with the original file name
- [FR] Support Topics HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from efb-telegram-master.