I am currently writing an AI program that receives input from Dragon NaturallySpeaking (using Natlink), processes it, and returns speech output. I was able to come up with a GrammarBase receiver that captures all the data from Dragon and sends it to my parser.
class Receiver(GrammarBase): gramSpec = """ <start> exported = {emptyList}; """ def initialize(self): self.load(self.gramSpec, allResults = 1) self.activateAll() def gotResultsObject(self, recogType, resObj): if recogType == 'reject': inpt, self.best_guess = [], [] else: inpt = extract_words(resObj) inpt = process_input(inpt)
This code works as expected, but there are a few problems:
The dragon processes the input data before sending it to my program. For example, if I said “Open Google Chrome”, it will open Google Chrome and send the input to Python. Is there a way to send input to Python without first processing it?
When I call waitForSpeech (), a window appears saying that the Python interpreter is awaiting input. Is it possible (for aesthetics and convenience) to prevent the message box from appearing and instead to stop the process of collecting speech after a significant pause from the user?
Thanks!
source share