Ejemplo n.º 1
0
                           host=host,
                           listen_port=listen_port,
                           talk_port=talk_port,
                           cmd_line=cmd_line)
    else:
        app = WaxClientAppSingle(client_indentation=client_indentation,
                                 host=host,
                                 listen_port=listen_port,
                                 talk_port=talk_port,
                                 cmd_line=cmd_line)
    app.run()


if __name__ == '__main__':
    opts, args = util.gopt([
        'h', None, 'm', None, 'p', None, 'i', None, 'c', None, 'host=', None,
        'talk=', None, 'listen=', None
    ])
    if opts['h']:
        help()
    else:
        #        print sys.modules
        host = opts['host']
        listen_port = opts['listen']
        talk_port = opts['talk']
        multiple = 0
        if opts['m']:
            multiple = 1
        client_indentation = 0
        if opts['i']:
            client_indentation = 1
        cmd_line = 0
Ejemplo n.º 2
0
        host = None, listen_port = None, talk_port = None, cmd_line = 0):
    if multiple:
        app = WaxClientApp(client_indentation = client_indentation, 
            host = host, listen_port = listen_port, talk_port = talk_port, 
            cmd_line = cmd_line)
    else:
        app = WaxClientAppSingle(client_indentation = client_indentation, 
            host = host, listen_port = listen_port, talk_port = talk_port,
            cmd_line = cmd_line)
    app.run()



if __name__ == '__main__':
    opts, args = util.gopt(['h', None, 'm', None, 'p', None,
                            'i', None, 'c', None,
                            'host=', None,
                            'talk=', None, 'listen=', None])
    if opts['h']:
        help()
    else:
#        print sys.modules
        host = opts['host']
        listen_port = opts['listen']
        talk_port = opts['talk']
        multiple = 0
        if opts['m']:
            multiple = 1
        client_indentation = 0
        if opts['i']:
            client_indentation = 1
        cmd_line = 0
Ejemplo n.º 3
0
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
# (C)2002, National Research Council of Canada
#
##############################################################################

import sr_interface, util
import natlink


def help():
   print """

Usage: python toggle_nat_text.py user_name status
   
Turns NaturalText on (status=1) or off (status=0)."""

if __name__ == '__main__':
   opts, args = util.gopt(())
   if len(args) == 0:
      help()
   else:
      sr_interface.connect(args[0])
      natlink.execScript('SetNaturalText %s' % args[1])
      sr_interface.disconnect()
   
   
   
Ejemplo n.º 4
0
--bypass : bypass natlink for dictation utterances (used for profiling)

ARGUMENTS
---------

suite-name : name of a test or test suite

output1, output2 :
             two test run ouput files to be compared
    """


if (__name__ == '__main__'):
    opts, args = util.gopt(('d', None, 
        'bypass', None,
        'h', None, 
        'p=', None,
        'train=', 0))

    if (opts['h']) or len(args) == 0:
        usage()
    elif (opts['d']):
        print "-d option not implemented yet.\n"
    else:
        the_mediator = \
            NewMediatorObject.NewMediatorObject(
                test_or_suite = args[0],
                global_grammars = 1, exclusive = 1, 
                profile_prefix = opts['p'],
                bypass_sr_recog = opts['bypass'],
                num_words_training = int(opts['train']))
Ejemplo n.º 5
0
   Upon connection by a new external editor, run regression test suite
   *testSuite* on that external editor.

   (Default: None)

-p pfile : profile the code, writing the output of the python profiler
           to pfile (see Python Profiler in the Python library manual)

--bypass : bypass natlink for dictation utterances (used for profiling)

    """


if __name__ == '__main__':
    opts, args = util.gopt(['h', None, 't=', None, 'bypass', 0,
        'p=', None, 'train=', 0])
    
    if opts['t']:
        sys.stderr = sys.stdout
        print 'starting tests'
    else:
        print 'starting Mediator for normal use'
    #
    # Start servers on the VC_LISTEN and VC_TALK ports
    #
    run(test_suite=opts['t'], profile_prefix = opts['p'],
        bypass_sr_recog = opts['bypass'], 
        num_words_training = int(opts['train']))


Ejemplo n.º 6
0
-0:
   Close the server when the last external editor disconnects.
   Currently ignored except for ServerOldMediator


-p pfile : profile the code, writing the output of the python profiler
           to pfile (see Python Profiler in the Python library manual)

--bypass : bypass natlink for dictation utterances (used for profiling)
    """


if __name__ == '__main__':
    opts, args = util.gopt([
        'h', None, 't=', None, '0', None, 'bypass', 0, 'p=', None, 'train=', 0
    ])
    non_exclusive_opts = ['0']

    #    sr_interface.connect()

    #
    # Create a global grammar manager
    #
    #    the_recog_start_mgr = RecogStartMgr.RecogStartMgr()

    sys.stderr = sys.stdout
    #
    # Start servers on the VC_LISTEN and VC_TALK ports
    #
    extra_opts = {}
Ejemplo n.º 7
0
def runme():

    #
    # Path of the pythondoc or pydoc.py script
    #
    pydoc_path = find_pydoc_path()
    if not pydoc_path:
        sys.stderr.write("unable to locate pydoc script\n")
        quit()
    sys.stderr.write("pydoc was found in\n" + pydoc_path + "\n")

    #
    # Get names of py files to document
    #
    #    glob_pattern = posixpath.expandvars('$VCODE_HOME' + os.sep + 'Mediator' + os.sep + '*.py')
    glob_pattern = posixpath.expandvars('$VCODE_HOME' + os.sep + '*' + os.sep +
                                        '*.py')
    files = glob.glob(glob_pattern)

    #
    # Remove files that don't match name patter
    #
    slow = 0
    if sys.argv:
        opts, args = util.gopt(['s', None])
        # parse command line options and arguments
        if opts:
            if opts['s']:
                slow = 1
        regs_file_name = args
    if regs_file_name:
        orig_files = files
        files = []
        for a_file in orig_files:
            for a_reg in regs_file_name:
                a_reg = '[\s\S]*\\' + os.sep + a_reg + '$'
                if re.match(a_reg, a_file):
                    files = files + [a_file]
                    break

    #
    # Remove make_doc.py from files list
    #


#     this_file_name = posixpath.expandvars('$VCODE_HOME' + os.sep + 'Admin' + os.sep + 'make_doc.py')
#     this_file_ind = files.index(this_file_name)
#     files = files[:this_file_ind - 1] + files[this_file_ind + 1:]

# Not needed anymore
# modules = map(pythondoc.pythondoc.path2module, files)

#
# Set format to HTML4
#
#  formats = []
#  pythondoc.pythondoc.add_formatter('HTML4', formats)

#
# Set documentation directory to $VCODE_HOME/Doc/Modules
#
    doc_dir = posixpath.expandvars(vc_globals.doc_modules)

    #  pythondoc.pythondoc._options.add_value('main_directory', doc_dir)
    #  pythondoc.pythondoc._options.add_value('main_index', 1)

    # for a_module in modules:
    #     sys.stdout.write("   %s\n" % a_module)
    #     pythondoc.pythondoc.generate_pages(modules, formats)

    #
    # Generate the HTML doc for each module
    #
    cmd_line = 'e:\python\python.exe ' + pydoc_path + ' -i -f HTML4 -d ' + doc_dir + ' '
    for a_file in files:

        #
        # Check to see if HTML doc needs to be refreshed
        #
        a_match = re.match('.*?([^\\' + os.sep + ']*)\.py$', a_file)
        module_name = a_match.groups()[0]
        html_file = doc_dir + os.sep + module_name + '.html'

        if (util.last_mod(html_file) < util.last_mod(a_file)):
            print "   Updating documentation for module '%s'...\n" % module_name
            cmd = cmd_line + a_file
            os.system(cmd)
            if slow:
                print "   That was module '%s'...\n\n" % module_name
                raw_input("press enter to continue")

    #
    # Fix problem with references
    #
    fix_references(doc_dir)
Ejemplo n.º 8
0
   Upon connection by a new external editor, run regression test suite
   *testSuite* on that external editor.

   (Default: None)

-p pfile : profile the code, writing the output of the python profiler
           to pfile (see Python Profiler in the Python library manual)

--bypass : bypass natlink for dictation utterances (used for profiling)

    """


if __name__ == "__main__":
    opts, args = util.gopt(["h", None, "t=", None, "bypass", 0, "p=", None, "train=", 0])

    if opts["t"]:
        sys.stderr = sys.stdout

    #
    # Start servers on the VC_LISTEN and VC_TALK ports
    #
    run(
        test_suite=opts["t"],
        profile_prefix=opts["p"],
        bypass_sr_recog=opts["bypass"],
        num_words_training=int(opts["train"]),
    )

Ejemplo n.º 9
0
        EVT_MINE(self, wxEVT_SOCKET_DATA, self.on_data)


def run(multiple=0, client_indentation=0, host=None, listen_port=None, talk_port=None):
    app = ClientEdSimWX(
        multiple=multiple,
        client_indentation=client_indentation,
        host=host,
        listen_port=listen_port,
        talk_port=talk_port,
    )
    app.run()


if __name__ == "__main__":
    opts, args = util.gopt(["h", None, "m", None, "p", None, "i", None, "host=", None, "talk=", None, "listen=", None])
    if opts["h"]:
        help()
    else:
        #        print sys.modules
        host = opts["host"]
        listen_port = opts["listen"]
        talk_port = opts["talk"]
        multiple = 0
        if opts["m"]:
            multiple = 1
        client_indentation = 0
        if opts["i"]:
            client_indentation = 1
        run(multiple, client_indentation, host, listen_port, talk_port)
Ejemplo n.º 10
0
           to pfile (see Python Profiler in the Python library manual)

--bypass : bypass natlink for dictation utterances (used for profiling)

ARGUMENTS
---------

suite-name : name of a test or test suite

output1, output2 :
             two test run ouput files to be compared
    """


if (__name__ == '__main__'):
    opts, args = util.gopt(
        ('d', None, 'bypass', None, 'h', None, 'p=', None, 'train=', 0))

    if (opts['h']) or len(args) == 0:
        usage()
    elif (opts['d']):
        print "-d option not implemented yet.\n"
    else:
        the_mediator = \
            NewMediatorObject.NewMediatorObject(
                test_or_suite = args[0],
                global_grammars = 1, exclusive = 1,
                profile_prefix = opts['p'],
                bypass_sr_recog = opts['bypass'],
                num_words_training = int(opts['train']))
        sys.stderr.write('Configuring the mediator...\n')
        if the_mediator.configure():
Ejemplo n.º 11
0
When this server is running, external editors can connect to VoiceCode through
TCP connections on the VC_LISTEN (45770) and VC_TALK (45771) ports.

OPTIONS
-------

-h :

   print this help message.

    """


if __name__ == '__main__':
    opts, args = util.gopt(['h', None])
    
#    sr_interface.connect()

    #
    # Create a global grammar manager
    #
#    the_recog_start_mgr = RecogStartMgr.RecogStartMgr()


    if opts['h']:
        help()
    else:
        run()

Ejemplo n.º 12
0
When this server is running, external editors can connect to VoiceCode through
TCP connections on the VC_LISTEN (45770) and VC_TALK (45771) ports.

OPTIONS
-------

-h :

   print this help message.

    """


if __name__ == '__main__':
    opts, args = util.gopt(['h', None])

    #    sr_interface.connect()

    #
    # Create a global grammar manager
    #
    #    the_recog_start_mgr = RecogStartMgr.RecogStartMgr()

    if opts['h']:
        help()
    else:
        run()

# defaults for vim - otherwise ignore
# vim:sw=4
Ejemplo n.º 13
0
def runme():

    #
    # Path of the pythondoc or pydoc.py script
    #
    pydoc_path = find_pydoc_path()
    if not pydoc_path:
        sys.stderr.write("unable to locate pydoc script\n")
        quit()
    sys.stderr.write("pydoc was found in\n" + pydoc_path + "\n")
       
    #
    # Get names of py files to document
    #
    #    glob_pattern = posixpath.expandvars('$VCODE_HOME' + os.sep + 'Mediator' + os.sep + '*.py')
    glob_pattern = posixpath.expandvars('$VCODE_HOME' + os.sep + '*' + os.sep + '*.py')
    files = glob.glob(glob_pattern)

    #
    # Remove files that don't match name patter
    #
    slow = 0
    if sys.argv: 
        opts, args = util.gopt(['s', None])
    # parse command line options and arguments
        if opts:
            if opts['s']:
                slow = 1
        regs_file_name = args
    if regs_file_name:
        orig_files = files
        files = []
        for a_file in orig_files:
            for a_reg in regs_file_name:
                a_reg = '[\s\S]*\\' + os.sep + a_reg + '$'
                if re.match(a_reg, a_file):
                    files = files + [a_file]
                    break

    #
    # Remove make_doc.py from files list
    #
#     this_file_name = posixpath.expandvars('$VCODE_HOME' + os.sep + 'Admin' + os.sep + 'make_doc.py')
#     this_file_ind = files.index(this_file_name)
#     files = files[:this_file_ind - 1] + files[this_file_ind + 1:]
   
      
    # Not needed anymore
    # modules = map(pythondoc.pythondoc.path2module, files)
    
    #
    # Set format to HTML4
    #
    #  formats = []
    #  pythondoc.pythondoc.add_formatter('HTML4', formats)
    
    #
    # Set documentation directory to $VCODE_HOME/Doc/Modules
    #
    doc_dir = posixpath.expandvars(vc_globals.doc_modules)
   
    #  pythondoc.pythondoc._options.add_value('main_directory', doc_dir)
    #  pythondoc.pythondoc._options.add_value('main_index', 1)
   
    # for a_module in modules:
    #     sys.stdout.write("   %s\n" % a_module)
    #     pythondoc.pythondoc.generate_pages(modules, formats)
       
    #
    # Generate the HTML doc for each module
    #
    cmd_line = 'e:\python\python.exe ' + pydoc_path + ' -i -f HTML4 -d ' + doc_dir + ' '
    for a_file in files:
           
        #
        # Check to see if HTML doc needs to be refreshed
        #
        a_match = re.match('.*?([^\\' + os.sep + ']*)\.py$', a_file)
        module_name = a_match.groups()[0]
        html_file = doc_dir + os.sep + module_name + '.html'

        if (util.last_mod(html_file) < util.last_mod(a_file)):
            print "   Updating documentation for module '%s'...\n" % module_name
            cmd = cmd_line + a_file
            os.system(cmd)
            if slow:
                print "   That was module '%s'...\n\n" % module_name
                raw_input("press enter to continue")

    #
    # Fix problem with references
    #
    fix_references(doc_dir)