Exemplo n.º 1
0
    def run(self):
        if 'first_name' in self.config:
            if 'keyword' in self.config:
                salutation = (
                    "Hi %s, my name is %s. what is your command" %
                    (self.config["first_name"], self.config["keyword"]))
            else:
                salutation = (
                    "Hi %s, my name is Jasper. what is your command" %
                    self.config["first_name"])

        else:
            if 'keyword' in self.config:
                salutation = ("%s is ready to take commands" %
                              self.confi["keyword"])
            else:
                salutation = ("Jasper is ready to take commands")

        self.mic.say(salutation)

        # Setting the engine to detect "keyword" otherwise, default to "JASPER"
        if 'keyword' in self.config:
            conversation = Conversation(self.config["keyword"], self.mic,
                                        self.config)
        else:
            conversation = Conversation("JASPER", self.mic, self.config)

        conversation.handleForever()
Exemplo n.º 2
0
    def run(self):
        if 'first_name' in self.config:
            salutation = (u"%s 我能为您做什么?" % self.config["first_name"])
        else:
            salutation = "主人,我能为您做什么?"

        persona = 'DINGDANG'
        if 'robot_name' in self.config:
            persona = self.config["robot_name"]
        #ender: create conversation robot instance with config file.
        conversation = Conversation(persona, self.mic, self.config)

        # create wechat robot
        if self.config['wechat']:
            self.wxBot = WechatBot.WechatBot(conversation.brain)
            self.wxBot.DEBUG = True
            self.wxBot.conf['qr'] = 'tty'
            conversation.wxbot = self.wxBot
            t = threading.Thread(target=self.start_wxbot)
            t.start()

        self.mic.say(salutation, cache=True)

        #ender: this is the entrance of the robot
        conversation.handleForever()
Exemplo n.º 3
0
    def run(self):
        if 'first_name' in self.config:
            salutation = ("무엇을 도와드릴까요?")
        else:
            salutation = "How can I be of service?"
        self.mic.say(salutation)

        conversation = Conversation("JJ", self.mic, self.config)
        conversation.handleForever()
Exemplo n.º 4
0
    def run(self):
        if 'first_name' in self.config:
            salutation = "How can I be of service, %s?" % self.config["first_name"]
        else:
            salutation = "How can I be of service?"
        self.mic.say(salutation)

        conversation = Conversation("JASPER", self.mic, self.config)
        conversation.handleForever()
Exemplo n.º 5
0
    def run(self):
        if 'first_name' in self.config:
            salutation = ("%s 很高兴为你服务" % self.config["first_name"])
        else:
            salutation = "很高兴为你服务"
        self.mic.say(salutation)

        conversation = Conversation("OKEY TOMMY", self.mic, self.config)
        conversation.handleForever()
Exemplo n.º 6
0
    def run(self):
        if 'first_name' in self.config:
            salutation = ("Hi, I am Bibli robot, my name is Lucky!")  # %s?"
            # % self.config["first_name"])
        else:
            salutation = "Hi, I am Bibli robot, my name is Lucky"
        self.mic.say(salutation)

        conversation = Conversation("LUCKY", self.mic, self.config)
        conversation.handleForever()
Exemplo n.º 7
0
    def run(self):
        greet = ["How can I be of service master?", "I live again master", "hal 9000 now on line", "hello how are you master"]
        
        salutation = random.choice(greet)
        self.pygm.blitimg('nu.png', size, black, x, y)

        self.mic.say(salutation)

        conversation = Conversation("JARVIS", self.mic, self.config, self.pygm)
        conversation.handleForever()
Exemplo n.º 8
0
    def run(self):
        if 'first_name' in self.config:
            salutation = ("Was kann ich für dich tun?, %s?"
                          % self.config["first_name"])
        else:
            salutation = "Was kann ich für dich tun?"
        self.mic.say(salutation)

        conversation = Conversation("JASPER", self.mic, self.config)
        conversation.handleForever()
Exemplo n.º 9
0
    def run(self):
        if 'first_name' in self.config:
            salutation = ("%s , das System ist wieder online. " %
                          self.config["first_name"])
        else:
            salutation = "Wie kann ich Ihnen behilflich sein?"
        self.mic.say(salutation)

        conversation = Conversation("JASPER", self.mic, self.config)
        conversation.handleForever()
Exemplo n.º 10
0
    def run(self):
        if 'first_name' in self.config:
            salutation = ("Bonjour Monsieur, Comment puis-je vous aider?"
                          )  #("How can I be of service, %s?"
            #% self.config["first_name"])
        else:
            salutation = "Bonjour Monsieur, Comment puis-je vous aider?"
        self.mic.say(salutation)

        conversation = Conversation("ALFRED", self.mic, self.config)
        conversation.handleForever()
Exemplo n.º 11
0
    def run(self):
        first_name = client.jasperprofile.profile.get('first_name', '')
        if first_name:
            salutation = (_("How can I be of service, %s?") % first_name)
        else:
            salutation = _("How can I be of service?")

        self.mic.say(salutation)

        conversation = Conversation("MACSEN", self.mic,
                                    client.jasperprofile.profile.get_yml())
        conversation.handleForever()
Exemplo n.º 12
0
    def run(self):
        if 'first_name' in self.config:
            salutation = ("%s 很高兴为你服务"
                          % self.config["first_name"])
        else:
            salutation = "很高兴为你服务"
        if os.path.exists(jasperpath.tjbot('shakehand.servo.js')):
            os.system("node " + jasperpath.tjbot('shakehand.servo.js'))
        self.mic.say(salutation)

        conversation = Conversation("OKEY TOMMY", self.mic, self.config)
        conversation.handleForever()
Exemplo n.º 13
0
    def run(self):
        if 'first_name' in self.config:
            salutation = ("How can I be of service, %s?" %
                          self.config["first_name"])
        else:
            salutation = "How can I be of service?"
        self.mic.say(salutation)

        conversation = Conversation("TOM", self.mic, self.config)
        #Activating the lights here
        LightCommands.command(3)
        conversation.handleForever()
Exemplo n.º 14
0
    def run(self):
        if 'first_name' in self.config:
            salutation = ("How can I be of service, %s?" %
                          self.config["first_name"])
        else:
            salutation = "How can I be of service?"
        self.mic.say(salutation)

        persona_name = self.config.get('persona_name', 'RALPH')
        conversation = Conversation(persona_name, self.mic, self.config)
        signal.signal(signal.SIGINT, self.get_sigint_handler(conversation))
        conversation.handleForever()
Exemplo n.º 15
0
    def run(self):
        if 'first_name' in self.config:
            salutation = ("How can I be of service, %s?" %
                          self.config["first_name"])
        else:
            salutation = "How can I be of service?"
        # self.mic.say(salutation)

        # conversation = Conversation("JASPER", self.mic, self.config)
        # conversation = Conversation("GREW", self.mic, self.config)
        conversation = Conversation("GREW", self.mic, self.config,
                                    self.stt_engine_class)
        conversation.handleForever()
Exemplo n.º 16
0
    def run(self):
        if 'first_name' in self.config:
            salutation = ("Bonjour %s, que puis-je faire pour vous ?" %
                          self.config["first_name"])
        else:
            salutation = "Bonjour, que puis-je faire pour vous ?"
        self.mic.say(salutation)

        if 'name' in self.config:
            name = self.config['name'].upper()
        else:
            name = "LOLA"
        conversation = Conversation(name, self.mic, self.config)
        conversation.handleForever()
Exemplo n.º 17
0
    def run(self):
        if 'first_name' in self.config:
            if datetime.datetime.now().hour < 12:
                dayTime = "morning"
            elif datetime.datetime.now().hour < 6:
                dayTime = "afternoon"
            else:
                dayTime = "evening"
                
            salutation = ("Good %s %s I am the mighty Artificial Intelligence 9000. You can call me Mal"  % (dayTime, self.config["first_name"]))
        else:
            salutation += "How can I be of service?"
        self.mic.say(salutation)

        conversation = Conversation("MAL", self.mic, self.config)
        conversation.handleForever()
Exemplo n.º 18
0
    def run(self):
        salutation = (u"%s,我能为您做什么?" % config.get("first_name", u'主人'))

        persona = config.get("robot_name", 'HUIMEIJINGLING')
        conversation = Conversation(persona, self.mic)

        # create wechat robot
        if config.get('wechat', False):
            self.wxBot = WechatBot.WechatBot(conversation.brain)
            self.wxBot.DEBUG = True
            self.wxBot.conf['qr'] = 'tty'
            conversation.wxbot = self.wxBot
            t = threading.Thread(target=self.start_wxbot)
            t.start()

        self.mic.say(salutation, cache=True)
        conversation.handleForever()
Exemplo n.º 19
0
    def run(self):
        salutation = (u"%s,我能为您做什么?" % config.get("first_name", u'主人'))

        persona = config.get("robot_name", 'DINGDANG')
        conversation = Conversation(persona, self.mic)

        # create wechat robot
        if config.get('wechat', False):
            self.wxBot = WechatBot.WechatBot(conversation.brain)
            self.wxBot.DEBUG = True
            self.wxBot.conf['qr'] = 'tty'
            conversation.wxbot = self.wxBot
            t = threading.Thread(target=self.start_wxbot)
            t.start()

        #self.mic.say(salutation, cache=True)
        self.mic.say(u"叮咚叮咚,我能为你做什么", cache=True)
        #self.mic.music_play('/home/pi/123.mp3')
        conversation.handleForever()
Exemplo n.º 20
0
    def run(self):

        if args.simon:
            return simon.run(self.mic)

        if args.daniel:
            return daniel.run(self.mic)

        if args.nostalgie:
            return nostalgie.run()

        if 'first_name' in self.config:
            salutation = ("How can I be of service, %s?" %
                          self.config["first_name"])
        else:
            salutation = "How can I be of service?"
        self.mic.say(salutation)

        conversation = Conversation("COMPANION", self.mic, self.config)
        conversation.handleForever(args.rank, args.zeljko, args.kataUndBen,
                                   args.matt)
Exemplo n.º 21
0
    def run(self):
        if 'first_name' in self.config:
            salutation = ("How can I be of service, %s?" %
                          self.config["first_name"])
        else:
            salutation = "How can I be of service?"
        self.mic.say(salutation)

        try:
            passiveEnabled = self.config['passive_enabled']
        except KeyError:
            passiveEnabled = "false"
            logger.warning(
                "passive_enabled not specified in profile, " +
                "defaulting to '%s'", passiveEnabled)

        passiveEnabled = passiveEnabled == "true"

        conversation = Conversation("JASPER", self.mic, self.config,
                                    passiveEnabled)
        conversation.handleForever()
Exemplo n.º 22
0
    def run(self):
        if 'first_name' in self.config:
            salutation = (u"%s 我能为您做什么?" % self.config["first_name"])
        else:
            salutation = "主人,我能为您做什么?"

        persona = 'DINGDANG'
        if 'robot_name' in self.config:
            persona = self.config["robot_name"]
        conversation = Conversation(persona, self.mic, self.config)

        # create wechat robot
        if self.config['wechat']:
            self.wxBot = WechatBot(conversation.brain)
            self.wxBot.DEBUG = True
            self.wxBot.conf['qr'] = 'tty'
            conversation.wxbot = self.wxBot
            t = threading.Thread(target=self.start_wxbot)
            t.start()

        self.mic.say(salutation)
        conversation.handleForever()
Exemplo n.º 23
0
    def run(self):
        persona = '小安'
        if 'robot_name' in self.config:
            persona = self.config["robot_name"]
        master = "主人"
        if 'master_name' in self.config:
            master = self.config["master_name"]

        salutation = random.choice([
            "%s,%s 竭诚为您服务!" % (master, persona),
            "%s,%s能为你做什么?" % (master, persona)
        ])

        self.conversation = Conversation(persona, self.mic, self.config)
        self.start_wxbot()
        self.mic.say(salutation)
        if (db.get_instance().is_need_update()):
            t = self.mic.asyncSay("正在更新股票基本信息数据库")
            db.get_instance().updata_stock_basics()
            t.join()
            self.mic.say("更新完成")

        self.conversation.handleForever()
Exemplo n.º 24
0
    def run(self):
        self.kill_legacy_process()
        if 'first_name' in self.config:
            salutation = ("How can I be of service, %s?" %
                          self.config["first_name"])
        else:
            salutation = "How can I be of service?"
        #self.mic.say(salutation)

        if 'slackbot' in self.config:
            if 'slackbot_webhook_url' in self.config["slackbot"]:
                bot = Slackbot(self.config["slackbot"]["slackbot_webhook_url"])
            else:
                bot = Slackbot()
        #bot.startBot()

        if 'robot_name' in self.config:
            persona = self.config["robot_name"]
        else:
            self.mic.say("Please set robot name")
            return

        conversation = Conversation(persona, self.mic, self.config, bot)
        conversation.handleForever()
Exemplo n.º 25
0
    def run(self):
        # salutation = "Hello. How can I be of service? I can give you, the events of the month, your schedule, your marks, the date of your catchup sessions or your upcoming meetings, and other school services. please just say the keyword of the service you want"
        # self.mic.say(salutation)

        conversation = Conversation("JASPER", self.mic, self.config)
        conversation.handleForever()
Exemplo n.º 26
0
    def run(self):
        salutation = "How can I be of service?"
        self.mic.say(salutation)

        conversation = Conversation("JASPER", self.mic, self.config)
        conversation.handleForever()
Exemplo n.º 27
0
    print " Copyright 2013 Shubhro Saha & Charlie Marsh               "
    print "==========================================================="

    speaker.say("Hello.... I am Jasper... Please wait one moment.")
    testConnection()
    configure()

    profile = yaml.safe_load(open("profile.yml", "r"))

    try:
        api_key = profile['keys']['GOOGLE_SPEECH']
    except KeyError:
        api_key = None

    try:
        stt_engine_type = profile['stt_engine']
    except KeyError:
        print "stt_engine not specified in profile, defaulting to PocketSphinx"
        stt_engine_type = "sphinx"

    mic = Mic(speaker, stt.PocketSphinxSTT(),
              stt.newSTTEngine(stt_engine_type, api_key=api_key))

    addendum = ""
    if 'first_name' in profile:
        addendum = ", %s" % profile["first_name"]
    mic.say("How can I be of service%s?" % addendum)

    conversation = Conversation("JASPER", mic, profile)
    conversation.handleForever()
Exemplo n.º 28
0
#!/usr/bin/env python2
Exemplo n.º 29
0
 def run(self):
     self.mic.say("Wakeup Message")
     converstation = Conversation("AssistantName", self.mic, self.config)
     converstation.handleForever()
Exemplo n.º 30
0
        # Initialize Mic
        self.mic = Mic(tts_engine_class.get_instance(),
                       stt_engine_class.get_passive_instance(),
                       stt_engine_class.get_active_instance())

    def run(self):
        if 'first_name' in self.config:
            salutation = ("How can I be of service, %s?"
                          % self.config["first_name"])
        else:
            salutation = "How can I be of service?"
        self.mic.say(salutation)

<<<<<<< HEAD
        conversation = Conversation("HEY", self.mic, self.config)
=======
        conversation = Conversation("JASPER", self.mic, self.config)
>>>>>>> 144f2d0f8aca3d2d93f00ce5cde30c8e665fd3c8
        conversation.handleForever()

if __name__ == "__main__":

    print("*******************************************************")
<<<<<<< HEAD
    print("*                 Commence speech.                    *")
=======
    print("*             JASPER - THE TALKING COMPUTER           *")
    print("* (c) 2015 Shubhro Saha, Charlie Marsh & Jan Holthuis *")
>>>>>>> 144f2d0f8aca3d2d93f00ce5cde30c8e665fd3c8
    print("*******************************************************")