Esempio n. 1
0
class SpeechReco(threading.Thread):
    def run(self):
        # Initialize and try to connect
        self.client = pyjulius.Client('localhost', 10500)
        self.client.modelize = True
        try:
            self.client.connect()
        except pyjulius.ConnectionError:
            print 'Start julius as module first!'
            sys.exit(1)
        # Start listening to the server
        self.client.start()
        self.result = ""
        self.think = Think()
        while (True):
            self.RequestMsg()

    def RequestMsg(self):
        sentence = ""
        try:
            self.result = self.client.results.get(True)
        except Queue.Empty:
            pass
        if isinstance(self.result, pyjulius.Sentence):
            for word in self.result.words:
                sentence += "{0} ".format(word)
            print sentence
            if (sentence != ""):
                self.think.checkcommand(sentence)
Esempio n. 2
0
class SpeechReco(threading.Thread):

    def run(self):
        # Initialize and try to connect
        self.client = pyjulius.Client('localhost', 10500)
        self.client.modelize = True
        try:
            self.client.connect()
        except pyjulius.ConnectionError:
            print 'Start julius as module first!'
            sys.exit(1)
        # Start listening to the server
        self.client.start()
        self.result = ""
        self.think = Think()
        while(True):
            self.RequestMsg()

    def RequestMsg(self):
        sentence = ""
        try:
            self.result = self.client.results.get(True)
        except Queue.Empty:
            pass
        if isinstance(self.result, pyjulius.Sentence):
            for word in self.result.words:
                sentence += "{0} ".format(word)
            print sentence
            if(sentence != ""):
                self.think.checkcommand(sentence)
Esempio n. 3
0
class WriteReco(threading.Thread):
    def run(self):
        self.result = ""
        self.think = Think()
        while (True):
            self.RequestMsg()

    def RequestMsg(self):
        self.result = raw_input("What you want to do ? \n")
        if (self.result != ""):
            self.think.checkcommand(self.result)
Esempio n. 4
0
class WriteReco(threading.Thread):

    def run(self):
        self.result = ""
        self.think = Think()
        while(True):
            self.RequestMsg()

    def RequestMsg(self):
        self.result = raw_input("What you want to do ? \n")
        if(self.result != ""):
            self.think.checkcommand(self.result)
            
Esempio n. 5
0
def tree_speak():
    while True:
        you = Listen.listen()
        # print("Robot: ",you)
        if "hello" in you:
            Think.start(you)
        elif "bye" in you:
            Speak.speak("Goodbye,See you again")
            break
        elif "dictionary" in you:
            Think.dictionary()
        else:
            you = Think.think(you)
            print(you)
            Speak.speak(you)
Esempio n. 6
0
 def run(self):
     # Initialize and try to connect
     self.client = pyjulius.Client('localhost', 10500)
     self.client.modelize = True
     try:
         self.client.connect()
     except pyjulius.ConnectionError:
         print 'Start julius as module first!'
         sys.exit(1)
     # Start listening to the server
     self.client.start()
     self.result = ""
     self.think = Think()
     while (True):
         self.RequestMsg()
Esempio n. 7
0
 def run(self):
     # Initialize and try to connect
     self.client = pyjulius.Client('localhost', 10500)
     self.client.modelize = True
     try:
         self.client.connect()
     except pyjulius.ConnectionError:
         print 'Start julius as module first!'
         sys.exit(1)
     # Start listening to the server
     self.client.start()
     self.result = ""
     self.think = Think()
     while(True):
         self.RequestMsg()
Esempio n. 8
0
def tree_write():
    while True:
        you = input("Input: ")
        # print("Robot: ",you)
        if "hello" in you:
            Think.start(you)
        if "shut down" in you:
            Think.shut_down()
        elif "bye" in you:
            Speak.speak("Goodbye,see you again")
            break
        elif "dictionary" in you:
            Think.dictionary()
        else:
            you = Think.think(you)
            print(you)
            Speak.speak(you)
Esempio n. 9
0
 def run(self):
     self.result = ""
     self.think = Think()
     while (True):
         self.RequestMsg()
Esempio n. 10
0
 def run(self):
     self.result = ""
     self.think = Think()
     while(True):
         self.RequestMsg()