Add voice recognition

This commit is contained in:
Richard Chien
2017-01-01 23:16:34 +08:00
parent 6e86d36056
commit 1880409b7f
11 changed files with 156 additions and 15 deletions

View File

@ -0,0 +1,12 @@
import jieba
from command import CommandRegistry
__registry__ = cr = CommandRegistry()
@cr.register('process')
@cr.restrict(full_command_only=True)
def process(args_text, ctx_msg, internal=False):
print('自然语言消息处理', args_text)
print(list(jieba.cut_for_search(args_text)))

View File

@ -97,6 +97,6 @@ def translate_to(args_text, ctx_msg):
data = resp.json()
print(data)
if 'trans_result' in data:
core.echo('翻译结果:\n' + '\n'.join([x['dst'] for x in data['trans_result']]), ctx_msg)
core.echo('翻译结果(百度翻译)\n' + '\n'.join([x['dst'] for x in data['trans_result']]), ctx_msg)
return
core.echo('翻译失败,可能因为后台接口的频率限制或服务器连接不上', ctx_msg)