•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 430,118 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,318 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser: Programming Forums
Views: 1065 | Replies: 22
![]() |
•
•
Join Date: Aug 2007
Posts: 55
Reputation:
Rep Power: 2
Solved Threads: 0
Hello again, everybody.
Now that I've just about learned all I can for programming my robot with 'smarts' (I think), I think I'm ready for a bigger challenge: Having my robot program aspects of itself.
Right now I'm going to try to implement it into my robot's human socialization program. After downloading a python script for the English Dictionary, which I found in Projects for the Beginner, I'm going to sort the words by noun, verb, etc, and then, when the robot is listening for chat, she'll get the sentence through the listening, prepare a verbal response (for example by replacing 'I' with 'you' and 'my' with 'your') and say it out loud through text to speech. It won't be perfect, I know, but I can't resist.
I've bookmarked a few tutorials from which I'll implement, but a few things I'd like to ask on top of that:
I want to learn the right syntax for engaging the 'dictation' part of the window's speech recognition, so my robot can listen for any word, pre-put together in the python english dictionary, and then manipulate the sentence and formulate her response.
Also, is there a way I could do a mix between the two: by that I mean pre-built sentences for understanding and the GetSentence function? For instance, I have a prebuilt sentence to recognize, "I'd like you to meet" and I'd like the program to "wait" for a name to catch, like, "Sarah," before saying, "Pleased to meet you, Sarah..." I've tried some experimentation with this, but right after I say "I'd like you to meet" it immediatle comes up with an error that basically says the value for the name of the person has no attribute, without waiting for me to say the name.
I'll be experimenting in the meantime.
Any input would be greatly appreciated. Thanks!
Now that I've just about learned all I can for programming my robot with 'smarts' (I think), I think I'm ready for a bigger challenge: Having my robot program aspects of itself.
Right now I'm going to try to implement it into my robot's human socialization program. After downloading a python script for the English Dictionary, which I found in Projects for the Beginner, I'm going to sort the words by noun, verb, etc, and then, when the robot is listening for chat, she'll get the sentence through the listening, prepare a verbal response (for example by replacing 'I' with 'you' and 'my' with 'your') and say it out loud through text to speech. It won't be perfect, I know, but I can't resist.
I've bookmarked a few tutorials from which I'll implement, but a few things I'd like to ask on top of that:
I want to learn the right syntax for engaging the 'dictation' part of the window's speech recognition, so my robot can listen for any word, pre-put together in the python english dictionary, and then manipulate the sentence and formulate her response.
Also, is there a way I could do a mix between the two: by that I mean pre-built sentences for understanding and the GetSentence function? For instance, I have a prebuilt sentence to recognize, "I'd like you to meet" and I'd like the program to "wait" for a name to catch, like, "Sarah," before saying, "Pleased to meet you, Sarah..." I've tried some experimentation with this, but right after I say "I'd like you to meet" it immediatle comes up with an error that basically says the value for the name of the person has no attribute, without waiting for me to say the name.
I'll be experimenting in the meantime.
•
•
Join Date: Aug 2007
Posts: 55
Reputation:
Rep Power: 2
Solved Threads: 0
Okay, I'm trying my experiment in a separate code, scaled down a bit for a prototype script.
Here's what I got so far.
This is what I want to happen in sudo code:
This is the first step. I later intent to have my robot 'learn' new words via dictation. A word document with the words of the English language will pre-existant on the system. The plan is to ulimately acheive a human interactor to 'define' knew words, if the robot asks for them, and then have the robot say something like "I see, cheese is a dairy product!" and then save that string to a list preserved for 'learning' new items, and then save the updated python script (so everytime she's powered down her memory doesn't get wiped). That's on the horizon, though.
One muddling road block I've encountered so far with this scaled down version of the script:
Every time I run the program, the python editor seems to close it immediately. Then it names the directory its under and then says "returned exit code 0." Anyone know what this means?
Thanks
Here's what I got so far.
python Syntax (Toggle Plain Text)
import re import sys, time, math, string, win32com.client,win32event,pythoncom from win32com.client import constants import win32com import cPickle, zlib import string import pickle import win32api import win32com.client import traceback import threading import random speaker = win32com.client.Dispatch("SAPI.SpVoice") def say(text): speaker.Speak(text) def multiwordReplace(text, wordDic): rc = re.compile('|'.join(map(re.escape, wordDic))) def translate(match): return wordDic[match.group(0)] return rc.sub(translate, text) wordDic = { 'you' : 'me', 'I' : 'you', 'mine' : 'yours', 'my' : 'your', } class ContextEvents(win32com.client.getevents("SAPI.SpSharedRecoContext")): def OnRecognition(self, StreamNumber, StreamPosition, RecognitionType, Result): newResult = win32com.client.Dispatch(Result) speaker.Speak(multiwordReplace(GetText.wordDic))
This is what I want to happen in sudo code:
listen for voice
if something is said:
get text
replace words according to wordDic
speak text with replaced wording
if vocalization not understood:
speak "I'm sorry, what was that?"This is the first step. I later intent to have my robot 'learn' new words via dictation. A word document with the words of the English language will pre-existant on the system. The plan is to ulimately acheive a human interactor to 'define' knew words, if the robot asks for them, and then have the robot say something like "I see, cheese is a dairy product!" and then save that string to a list preserved for 'learning' new items, and then save the updated python script (so everytime she's powered down her memory doesn't get wiped). That's on the horizon, though.
One muddling road block I've encountered so far with this scaled down version of the script:
Every time I run the program, the python editor seems to close it immediately. Then it names the directory its under and then says "returned exit code 0." Anyone know what this means?
Thanks
Last edited by vegaseat : Aug 11th, 2008 at 4:49 pm. Reason: modified code tags to [code=python]
•
•
Join Date: Aug 2007
Posts: 55
Reputation:
Rep Power: 2
Solved Threads: 0
Okay, I know what's happening now. The program goes through all the code, and once it's done, its done. (I should've seen that...
)
Okay, I'm now modifying Inigo Surgui's speech recognition script, replacing some things and adding some others:
The goal of the experiment is to be able to say something like , "My name is Loren." And then have the robot catch that string, replace a few words and reply, "So, your name is Loren" That's what I'm shooting for so far.
Now, new problem. I get this error message the moment I say "My":
Not sure what's going wrong. Because "say" is defined earlier in the script.
Anyone's input would be appreciated. I'll continue experimentation on my end.
Thanks!
Okay, I'm now modifying Inigo Surgui's speech recognition script, replacing some things and adding some others:
python Syntax (Toggle Plain Text)
from win32com.client import constants import win32com.client import pythoncom import re def multiwordReplace(text, wordDic): rc = re.compile('|'.join(map(re.escape, wordDic))) def translate(match): return wordDic[match.group(0)] return rc.sub(translate, text) wordDic = { 'you' : 'me', 'I' : 'you', 'mine' : 'yours', 'my' : 'your' } """Sample code for using the Microsoft Speech SDK 5.1 via COM in Python. Requires that the SDK be installed; it's a free download from http://microsoft.com/speech and that MakePy has been used on it (in PythonWin, select Tools | COM MakePy Utility | Microsoft Speech Object Library 5.1). After running this, then saying "One", "Two", "Three" or "Four" should display "You said One" etc on the console. The recognition can be a bit shaky at first until you've trained it (via the Speech entry in the Windows Control Panel.""" class SpeechRecognition: """ Initialize the speech recognition with the passed in list of words """ def __init__(self, wordsToAdd): # For text-to-speech self.speaker = win32com.client.Dispatch("SAPI.SpVoice") # For speech recognition - first create a listener self.listener = win32com.client.Dispatch("SAPI.SpSharedRecognizer") # Then a recognition context self.context = self.listener.CreateRecoContext() # which has an associated grammar self.grammar = self.context.CreateGrammar() # Do not allow free word recognition - only command and control # recognizing the words in the grammar only self.grammar.DictationSetState(0) # Create a new rule for the grammar, that is top level (so it begins # a recognition) and dynamic (ie we can change it at runtime) self.wordsRule = self.grammar.Rules.Add("wordsRule", constants.SRATopLevel + constants.SRADynamic, 0) # Clear the rule (not necessary first time, but if we're changing it # dynamically then it's useful) self.wordsRule.Clear() # And go through the list of words, adding each to the rule [ self.wordsRule.InitialState.AddWordTransition(None, word) for word in wordsToAdd ] # Set the wordsRule to be active self.grammar.Rules.Commit() self.grammar.CmdSetRuleState("wordsRule", 1) # Commit the changes to the grammar self.grammar.Rules.Commit() # And add an event handler that's called back when recognition occurs self.eventHandler = ContextEvents(self.context) # Announce we've started using speech synthesis self.say("Started successfully") """Speak a word or phrase""" def say(self, phrase): self.speaker.Speak(phrase) """The callback class that handles the events raised by the speech object. See "Automation | SpSharedRecoContext (Events)" in the MS Speech SDK online help for documentation of the other events supported. """ class ContextEvents(win32com.client.getevents("SAPI.SpSharedRecoContext")): """Called when a word/phrase is successfully recognized - ie it is found in a currently open grammar with a sufficiently high confidence""" def OnRecognition(self, StreamNumber, StreamPosition, RecognitionType, Result): newResult = win32com.client.Dispatch(Result) say("So",newResult.PhraseInfo.GetText(multiwordreplace)) if __name__=='__main__': wordsToAdd = [ "My", "Name", "is", "Loren" ] speechReco = SpeechRecognition(wordsToAdd) while 1: pythoncom.PumpWaitingMessages()
The goal of the experiment is to be able to say something like , "My name is Loren." And then have the robot catch that string, replace a few words and reply, "So, your name is Loren" That's what I'm shooting for so far.
Now, new problem. I get this error message the moment I say "My":
pythoncom error: Python error invoking COM method.
Traceback (most recent call last):
File "C:\Python25\Lib\site-packages\win32com\server\policy.py", line 285, in _Invoke_
return self._invoke_(dispid, lcid, wFlags, args)
File "C:\Python25\Lib\site-packages\win32com\server\policy.py", line 290, in _invoke_
return S_OK, -1, self._invokeex_(dispid, lcid, wFlags, args, None, None)
File "C:\Python25\Lib\site-packages\win32com\server\policy.py", line 593, in _invokeex_
return func(*args)
File "C:\Users\Loren\Desktop\My Robots\Experimental Code!\Prototype Script B.py", line 74, in OnRecognition
say("So",newResult.PhraseInfo.GetText(multiwordreplace))
<type 'exceptions.NameError'>: global name 'say' is not definedNot sure what's going wrong. Because "say" is defined earlier in the script.
Anyone's input would be appreciated. I'll continue experimentation on my end.
Thanks!
Last edited by vegaseat : Aug 11th, 2008 at 4:51 pm. Reason: modified code tags to [code=python]
•
•
Join Date: Aug 2007
Posts: 55
Reputation:
Rep Power: 2
Solved Threads: 0
New Progress, everyone.
I've been doing my research and I think I'm getting close to acheiving phase 1 of my artificial 'Learning' project. Here's the script I've put together, after some studying, tinkering and debugging:
The main problem I'm encountering with this one: I get this exception when I try to run the script.
for me, its a puzzling exception, because 'text' is defined in the class 'SpeechRecognition' under 'sentence' and I think I calling that function on line 26...but I must be doing something wrong.
Can anyone point out my flaw? In the meantime, I'll be trying to find it myself...
Thanks
I've been doing my research and I think I'm getting close to acheiving phase 1 of my artificial 'Learning' project. Here's the script I've put together, after some studying, tinkering and debugging:
python Syntax (Toggle Plain Text)
from win32com.client import constants import win32com.client import re listening = True class SpeechRecognition: def __init__(self, str1): self.speaker = win32com.client.Dispatch("SAPI.SpVoice") self.listener = win32com.client.Dispatch("SAPI.SpSharedRecognizer") self.context = self.listener.CreateRecoContext() self.grammar = self.context.CreateGrammar() self.eventHandler = ContextEvents(self.context) self.say("I am listening for you master") def say(self, phrase): self.speaker.Speak(phrase) def sentence(self, text): self.GetText() class ContextEvents(win32com.client.getevents("SAPI.SpSharedRecoContext")): def OnRecognition(self, StreamNumber, StreamPosition, RecognitionType, Result): newResult = win32com.client.Dispatch(Result) IHeardYou = True while listening == True: str1 = SpeechRecognition.sentence(text) str2 = multiwordReplace(str1, wordDic) if IHeardYou == True: say(str2) IHeardYou = False def multiwordReplace(text, wordDic): rc = re.compile('|'.join(map(re.escape, wordDic))) def translate(match): return wordDic[match.group(0)] return rc.sub(translate, text) wordDic = { 'my': 'your', 'you': 'me', 'mine': 'yours', 'your': 'my', 'yours': 'mine', 'me': 'you', 'I' : 'you' }
The main problem I'm encountering with this one: I get this exception when I try to run the script.
Traceback (most recent call last):
File "C:\Python25\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\Users\Loren\Desktop\My Robots\Experimental Code!\Prototype Script C.py", line 26, in <module>
str1 = SpeechRecognition.sentence(text)
NameError: name 'text' is not definedfor me, its a puzzling exception, because 'text' is defined in the class 'SpeechRecognition' under 'sentence' and I think I calling that function on line 26...but I must be doing something wrong.
Can anyone point out my flaw? In the meantime, I'll be trying to find it myself...
Thanks
Last edited by vegaseat : Aug 11th, 2008 at 4:52 pm. Reason: modified code tags to [code=python]
•
•
Join Date: Aug 2007
Posts: 55
Reputation:
Rep Power: 2
Solved Threads: 0
Okay, I've decided to start with something even simpler--making one modification to Inigo Surgui's speech recognition recipe:
All I'm trying to do for this test is switch this bit of code on line 60:
to this:
But here's what I get the moment I say "One":
from what I understand, 'say' is defined under ContextEvents, the same class under which 'OnRecognition' is defined. So 'say' should be local right?
By the way, I've tried using the global statement before 'say' but that didn't seem to work either.
I've spent hours and hours trying to solve this simple problem but to no avail...
Now I really stumped
Can anyone give me any input? I'd really appreciate it.
python Syntax (Toggle Plain Text)
from win32com.client import constants import win32com.client import pythoncom """Sample code for using the Microsoft Speech SDK 5.1 via COM in Python. Requires that the SDK be installed; it's a free download from http://microsoft.com/speech and that MakePy has been used on it (in PythonWin, select Tools | COM MakePy Utility | Microsoft Speech Object Library 5.1). After running this, then saying "One", "Two", "Three" or "Four" should display "You said One" etc on the console. The recognition can be a bit shaky at first until you've trained it (via the Speech entry in the Windows Control Panel.""" class SpeechRecognition: """ Initialize the speech recognition with the passed in list of words """ def __init__(self, wordToAdd): # For text-to-speech self.speaker = win32com.client.Dispatch("SAPI.SpVoice") # For speech recognition - first create a listener self.listener = win32com.client.Dispatch("SAPI.SpSharedRecognizer") # Then a recognition context self.context = self.listener.CreateRecoContext() # which has an associated grammar self.grammar = self.context.CreateGrammar() # Do not allow free word recognition - only command and control # recognizing the words in the grammar only self.grammar.DictationSetState(0) # Create a new rule for the grammar, that is top level (so it begins # a recognition) and dynamic (ie we can change it at runtime) self.wordsRule = self.grammar.Rules.Add("wordsRule", constants.SRATopLevel + constants.SRADynamic, 0) # Clear the rule (not necessary first time, but if we're changing it # dynamically then it's useful) self.wordsRule.Clear() # And go through the list of words, adding each to the rule [ self.wordsRule.InitialState.AddWordTransition(None, word) for word in wordsToAdd ] # Set the wordsRule to be active self.grammar.Rules.Commit() self.grammar.CmdSetRuleState("wordsRule", 1) # Commit the changes to the grammar self.grammar.Rules.Commit() # And add an event handler that's called back when recognition occurs self.eventHandler = ContextEvents(self.context) # Announce we've started using speech synthesis self.speaker.Speak("Started successfully") """Speak a word or phrase""" """The callback class that handles the events raised by the speech object. See "Automation | SpSharedRecoContext (Events)" in the MS Speech SDK online help for documentation of the other events supported. """ class ContextEvents(win32com.client.getevents("SAPI.SpSharedRecoContext")): """Called when a word/phrase is successfully recognized - ie it is found in a currently open grammar with a sufficiently high confidence""" def say(self, phrase): self.speaker.Speak(phrase) def OnRecognition(self, StreamNumber, StreamPosition, RecognitionType, Result): newResult = win32com.client.Dispatch(Result) print "You said",newResult.PhraseInfo.GetText() if __name__=='__main__': wordsToAdd = [ "One", "Two", "Three", "Four" ] speechReco = SpeechRecognition(wordsToAdd) while 1: pythoncom.PumpWaitingMessages()
All I'm trying to do for this test is switch this bit of code on line 60:
print "You said",newResult.PhraseInfo.GetText()
to this:
say("You said",newResult.PhraseInfo.GetText())But here's what I get the moment I say "One":
pythoncom error: Python error invoking COM method.
Traceback (most recent call last):
File "C:\Python25\Lib\site-packages\win32com\server\policy.py", line 285, in _Invoke_
return self._invoke_(dispid, lcid, wFlags, args)
File "C:\Python25\Lib\site-packages\win32com\server\policy.py", line 290, in _invoke_
return S_OK, -1, self._invokeex_(dispid, lcid, wFlags, args, None, None)
File "C:\Python25\Lib\site-packages\win32com\server\policy.py", line 593, in _invokeex_
return func(*args)
File "C:\Users\Loren\Desktop\My Robots\SpeechRecognition.py", line 60, in OnRecognition
say("You said",newResult.PhraseInfo.GetText())
<type 'exceptions.NameError'>: global name 'say' is not definedfrom what I understand, 'say' is defined under ContextEvents, the same class under which 'OnRecognition' is defined. So 'say' should be local right?
By the way, I've tried using the global statement before 'say' but that didn't seem to work either.
I've spent hours and hours trying to solve this simple problem but to no avail...
Now I really stumped

Can anyone give me any input? I'd really appreciate it.
Last edited by vegaseat : Aug 11th, 2008 at 4:51 pm. Reason: modified code tags to [code=python]
Yes, it is defined within the same class but not in the scope of the function OnRecognition. say() is a member of the ContextEvents class so you'll need to call it as self.say()
Let's Go Pens!
** Just because I reply to your question does not invite you to PM me. Keep discussions on the thread of topic, I will not answer your questions over PM. **
** Just because I reply to your question does not invite you to PM me. Keep discussions on the thread of topic, I will not answer your questions over PM. **
•
•
Join Date: Aug 2007
Posts: 55
Reputation:
Rep Power: 2
Solved Threads: 0
Okay I think I see now, jlm669. Thanks.
But now its saying this when I say one:
Okay, let me see if I can identify this problem visually: the problem starts when the script runs the line: self.say("You said",newResult.PhraseInfo.Get())
am I right?
The problem is that the function 'say' only takes 2 arguments, which are "self and phrase," right? But three arguments are given in the line: self.say("You said",newResult.PhraseInfo.GetText()) So basically, there's an argument I need to add to the function 'say' to make it work. Is this correct? If so, which arguement could that be I wonder...newResult? GetText()? or maybe just text?
By the way, part of my big difficulty learning to program in python is that I can't see how it works visually, so I have trouble identifying the various names of the parts of code (for example, what part of the code is the argument?). I'd program my robot in visual basic, but I've already done tons of it in python and python gives me more possibilities...
If only they had visual python...
But now its saying this when I say one:
Traceback (most recent call last):
File "C:\Python25\Lib\site-packages\win32com\server\policy.py", line 285, in _Invoke_
return self._invoke_(dispid, lcid, wFlags, args)
File "C:\Python25\Lib\site-packages\win32com\server\policy.py", line 290, in _invoke_
return S_OK, -1, self._invokeex_(dispid, lcid, wFlags, args, None, None)
File "C:\Python25\Lib\site-packages\win32com\server\policy.py", line 593, in _invokeex_
return func(*args)
File "C:\Users\Loren\Desktop\My Robots\SpeechRecognition.py", line 60, in OnRecognition
self.say("You said",newResult.PhraseInfo.GetText())
<type 'exceptions.TypeError'>: say() takes exactly 2 arguments (3 given)Okay, let me see if I can identify this problem visually: the problem starts when the script runs the line: self.say("You said",newResult.PhraseInfo.Get())
am I right?
The problem is that the function 'say' only takes 2 arguments, which are "self and phrase," right? But three arguments are given in the line: self.say("You said",newResult.PhraseInfo.GetText()) So basically, there's an argument I need to add to the function 'say' to make it work. Is this correct? If so, which arguement could that be I wonder...newResult? GetText()? or maybe just text?
By the way, part of my big difficulty learning to program in python is that I can't see how it works visually, so I have trouble identifying the various names of the parts of code (for example, what part of the code is the argument?). I'd program my robot in visual basic, but I've already done tons of it in python and python gives me more possibilities...
If only they had visual python...
•
•
Join Date: Aug 2007
Posts: 55
Reputation:
Rep Power: 2
Solved Threads: 0
Okay, I tinkered around a bit and I fixed it!
The working script now looks like this:
Some minor flaws I noticed with my tinkering, the Voice synthesis starts over everytime I speak a number (I presume because I told it to on line 58. Oh well) Also, I don't know why it wouldn't work if I tried to put in "You said: " So I just separated them into two operations.
Now for the next step! Getting my robot to listen for a string of words, and replacing them!
The working script now looks like this:
python Syntax (Toggle Plain Text)
from win32com.client import constants import win32com.client import pythoncom """Sample code for using the Microsoft Speech SDK 5.1 via COM in Python. Requires that the SDK be installed; it's a free download from http://microsoft.com/speech and that MakePy has been used on it (in PythonWin, select Tools | COM MakePy Utility | Microsoft Speech Object Library 5.1). After running this, then saying "One", "Two", "Three" or "Four" should display "You said One" etc on the console. The recognition can be a bit shaky at first until you've trained it (via the Speech entry in the Windows Control Panel.""" class SpeechRecognition: """ Initialize the speech recognition with the passed in list of words """ def __init__(self, wordsToAdd): # For text-to-speech self.speaker = win32com.client.Dispatch("SAPI.SpVoice") # For speech recognition - first create a listener self.listener = win32com.client.Dispatch("SAPI.SpSharedRecognizer") # Then a recognition context self.context = self.listener.CreateRecoContext() # which has an associated grammar self.grammar = self.context.CreateGrammar() # Do not allow free word recognition - only command and control # recognizing the words in the grammar only self.grammar.DictationSetState(0) # Create a new rule for the grammar, that is top level (so it begins # a recognition) and dynamic (ie we can change it at runtime) self.wordsRule = self.grammar.Rules.Add("wordsRule", constants.SRATopLevel + constants.SRADynamic, 0) # Clear the rule (not necessary first time, but if we're changing it # dynamically then it's useful) self.wordsRule.Clear() # And go through the list of words, adding each to the rule [ self.wordsRule.InitialState.AddWordTransition(None, word) for word in wordsToAdd ] # Set the wordsRule to be active self.grammar.Rules.Commit() self.grammar.CmdSetRuleState("wordsRule", 1) # Commit the changes to the grammar self.grammar.Rules.Commit() # And add an event handler that's called back when recognition occurs self.eventHandler = ContextEvents(self.context) # Announce we've started using speech synthesis self.speaker.Speak("Started successfully") """Speak a word or phrase""" """The callback class that handles the events raised by the speech object. See "Automation | SpSharedRecoContext (Events)" in the MS Speech SDK online help for documentation of the other events supported. """ class ContextEvents(win32com.client.getevents("SAPI.SpSharedRecoContext")): """Called when a word/phrase is successfully recognized - ie it is found in a currently open grammar with a sufficiently high confidence""" def OnRecognition(self, StreamNumber, StreamPosition, RecognitionType, Result): newResult = win32com.client.Dispatch(Result) self.speaker = win32com.client.Dispatch("SAPI.SpVoice") print "You said",newResult.PhraseInfo.GetText() self.speaker.Speak("You said") self.speaker.Speak(newResult.PhraseInfo.GetText()) if __name__=='__main__': wordsToAdd = [ "One", "Two", "Three", "Four" ] speechReco = SpeechRecognition(wordsToAdd) while 1: pythoncom.PumpWaitingMessages()
Some minor flaws I noticed with my tinkering, the Voice synthesis starts over everytime I speak a number (I presume because I told it to on line 58. Oh well) Also, I don't know why it wouldn't work if I tried to put in "You said: " So I just separated them into two operations.
Now for the next step! Getting my robot to listen for a string of words, and replacing them!
Last edited by vegaseat : Aug 11th, 2008 at 4:52 pm. Reason: modified code tags to [code=python]
P.S. when you use code tags it helps if you define the language via [code=xxxx] so that syntax highlighting is turned on. This makes it loads easier to read.
[code=python] for this forum (usually)
[code=python] for this forum (usually)
Let's Go Pens!
** Just because I reply to your question does not invite you to PM me. Keep discussions on the thread of topic, I will not answer your questions over PM. **
** Just because I reply to your question does not invite you to PM me. Keep discussions on the thread of topic, I will not answer your questions over PM. **
![]() |
•
•
•
•
•
•
•
•
DaniWeb Python Marketplace

