예제 #1
0
def land():
    global username, password
    number_of_time = 1
    value = []
    value = g.multpasswordbox(msg="Land( Press 'OK' to go to the next step )",
                              fields=("Username : "******"Password : "******"哈哈只有这一步是中文,我是Cyg,这个程序是我一个人编写出来的,有什么报错给我说下哈,启动turing机器人")
        turing.turing()
    elif value[0] != now_username:
        choice = g.msgbox("Username error , do you want to tyr again?")
        if choice and number_of_time <= 2:
            number_of_time += 1
    else:
        choice = g.ccbox(msg="Password error, do you want to try again?")
        if choice and number_of_time <= 2:
            number_of_time += 1

        else:
            forpassword = g.ccbox(msg="Forget Password?",
                                  choices=("Yes", "No"))
            if forpassword:
                forget_password()
            else:
                g.msgbox("See you next time!")
예제 #2
0
def text_reply(msg):
    ss = msg['Text']
    print ss
    typeNumber = findType(ss)
    if typeNumber == 1 or typeNumber == 2:  #One功能
        print oneText
        itchat.send(oneText.decode('utf-8'), msg['FromUserName'])
        itchat.send('@%s@%s' % ('img', 'one.jpg'), msg['FromUserName'])
    elif typeNumber == 0:  #机器人回复
        ss = ss[2:len(ss)]
        ss = ss.encode('utf-8')
        text = turing.turing(msg['FromUserName'][1:20].encode('utf-8'), ss)
        print text
        itchat.send(text, msg['FromUserName'])
    elif typeNumber == 3:  #豆瓣评分
        ss = ss[3:len(ss)]
        ss = ss.encode('utf-8')
        text = douban.findMoive(ss).decode('utf-8')
        itchat.send(text, msg['FromUserName'])
    elif typeNumber == 4:  #帮助
        text=u'使用教程如下\n' \
             u'\"r+文字\" 如 r+你好 向机器人问话\n' \
             u'\"db+电影\" 如 db+大话西游 查询豆瓣评分\n' \
             u'\"help\" 打开帮助\n' \
             u'\"one(One)\" 获取one'
        itchat.send(text, msg['FromUserName'])
예제 #3
0
import sys
import turing

ask = sys.argv[1]
print(ask)
print('p3 start')
print('hello it is ', ask)
ans = turing.turing('12345', ask)
print('answer is ', ans)
예제 #4
0
import turing

turing.turing('123456', 'china')
예제 #5
0
from record import GenAudio
from recognize import recognizer
from turing import turing
from compose import composer
from player import player

ask_path = 'ask.wav'
ask_audio = GenAudio()
ask_audio.read_audio()
ask_audio.save_wav("ask.wav")

reco = recognizer()
ask_txt = reco.recognize(ask_path)
print('Me: ' + ask_txt)

tur = turing()
ans_txt = tur.ask(ask_txt)
print('Robot: ' + ans_txt)

com = composer()
ans_path = com.compose(ans_txt)

play = player()
play.play(ans_path)
예제 #6
0
import sys
from turing import turing


def print_help():
    print("usage: ft_turing [-h] jsonfile input\n\n")
    print("positional arguments:\n")
    print("\tjsonfile\t\tjson description of the machine")
    print("\tinput\t\tinput of the machine")
    print("optional arguments:\n")
    print("\t-h, --help\t\tshow this help message and exit")


if __name__ == '__main__':
    ac = len(sys.argv)

    if (ac < 2) or (sys.argv[1] == "-h") or (sys.argv[1] == "--help"):
        print_help()
    else:
        turing(sys.argv)