阿兰·图灵
一位伟大的数学家、逻辑学家,被誉为“计算机科学之父”,“人工智能之父”。
1936年,阿兰·图灵提出“图灵机”设想,为计算机发展奠定理论和思想基础。
1950年,阿兰·图灵发表论文“机器能思考吗”,提出一种用于判定机器是否具有智能的试验方法,即著名的“图灵测试”。

图灵机器人
2014年,一群对人工智能充满无比热情的年轻人,发布“图灵机器人”,以此致敬人工智能伟大的先驱阿兰·图灵
最强大的中文语义机器人, 通用对话语料150亿条,儿童对话语料10亿条

 电报群:https://t.me/joinchat/FZtb9xPnRgPdMFqmt2uB8g 
# -*- coding: utf-8 -*-
# telegram_bot_tuling.py

import json
import urllib3
import logging
from telegram.ext import MessageHandler
from telegram.ext import Filters


def get_tu_ling_message(message, chat_id):
    tu_ling = 'a7bfa89887134695928b0e243f5766e4'
    tu_ling_api_url = "http://openapi.tuling123.com/openapi/api/v2"
    req = {
        "perception":
            {
                "inputText":
                {
                    "text": message
                },

                "selfInfo":
                    {
                        "location":
                            {
                                "city": "深圳",
                                "province": "广州",
                                "street": "XXX"
                            }
                    }
            },
        "userInfo":
            {
                "apiKey": tu_ling,
                "userId": chat_id
            }
    }
    req = json.dumps(req).encode('utf8')
    http = urllib3.PoolManager()
    http_post = http.request('POST', tu_ling_api_url, body=req, headers={'content-type': 'application/json'})
    response_str = http_post.data.decode('utf-8')
    response_dic = json.loads(response_str)
    t_intent_code = response_dic['intent']['code']
    t_result_text = response_dic['results'][0]['values']['text']
    logging.info("get_tu_ling_message message:%s userId:%d response_str:%s" % (message, chat_id, response_str))
    return t_intent_code, t_result_text


def echo(bot, update):
    if update.message.chat_id == -333923843:
        intent_code, result_text = get_tu_ling_message(update.message.text, abs(update.message.chat_id))
        if len(result_text) > 0:
            bot.send_message(chat_id=update.message.chat_id, text=result_text)
        else:
            logging.error("调用错误:%d" % intent_code)
            bot.send_message(chat_id=update.message.chat_id, text=update.message.text)


def start_tu_ling(dispatcher):
    # all text message
    logging.info('start_tu_ling')
    echo_handler = MessageHandler(Filters.text, echo)
    dispatcher.add_handler(echo_handler)
# -*- coding: utf-8 -*-
# telegram_bot_jobs.py

import logging
import telegram_bot_tuling
from telegram.ext import Updater
from datetime import datetime


def error(bot, update, err):
    logging.error('bot : %s update : %s error : %s' % (bot, update, err))


def echo(bot, update):
    logging.info("bot : %s chat_id:%d text:%s" % (bot, update.message.chat_id, update.message.text))


def start_bot():
    try:
        start_time = datetime.now()  # 获取当前datetime
        logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)

        # 温顺的莱昂
        updater = Updater(token='739344882:AAF_BMyjc7S45nado1dK5E6sMt-0jYH5VMA')
        dp = updater.dispatcher
        dp.add_error_handler(error)

        # #1 电报机器人-图灵中文聊天
        telegram_bot_tuling.start_tu_ling(dp)

        updater.start_polling()
        logging.info('telegram bot updater start_polling...')
        updater.idle()

        end_time = datetime.now()  # 获取当前datetime
        logging.info('花费时间:%f秒' % (end_time - start_time).total_seconds())
    except BaseException as start_bot_ex:
        logging.error("telegram_bot_jobs ex : %s" % start_bot_ex)

1 对 “#1 电报机器人-图灵中文聊天”的想法;

发表评论

电子邮件地址不会被公开。 必填项已用*标注