class WavePlayerRTCManager:
    def __init__(self):
        encoding = locale.getpreferredencoding()
        sys.stdout = codecs.getwriter(encoding)(sys.stdout, errors="replace")
        sys.stderr = codecs.getwriter(encoding)(sys.stderr, errors="replace")

        parser = utils.MyParser(version=__version__, description=__doc__)
        utils.addmanageropts(parser)
        parser.add_option('-g',
                          '--gui',
                          dest='guimode',
                          action="store_true",
                          default=False,
                          help=_('show file open dialog in GUI'))
        try:
            opts, args = parser.parse_args()
        except optparse.OptionError, e:
            print >> sys.stderr, 'OptionError:', e
            sys.exit(1)

        if opts.guimode == True:
            sel = utils.askopenfilename(title="select wave file")
            if sel is not None:
                args.append(sel)

        if len(args) != 1:
            parser.error("wrong number of arguments")
            sys.exit(1)

        self._file = args[0]
        self._comp = None
        self._manager = OpenRTM_aist.Manager.init(utils.genmanagerargs(opts))
        self._manager.setModuleInitProc(self.moduleInit)
        self._manager.activateManager()
Beispiel #2
0
    def __init__(self):
        encoding = locale.getpreferredencoding()
        #sys.stdout = codecs.getwriter(encoding)(sys.stdout, errors = "replace")
        #sys.stderr = codecs.getwriter(encoding)(sys.stderr, errors = "replace")

        parser = utils.MyParser(version=__version__,
                                usage="%prog [srgsfile]",
                                description=__doc__)
        utils.addmanageropts(parser)
        parser.add_option('-g',
                          '--gui',
                          dest='guimode',
                          action="store_true",
                          default=False,
                          help='show file open dialog in GUI')

        parser.add_option('-D',
                          '--dictation',
                          dest='dictation_mode',
                          action="store_true",
                          default=False,
                          help='run with dictation mode')

        parser.add_option('-r',
                          '--rebuild-lexicon',
                          dest='rebuild_lexicon',
                          action="store_true",
                          default=False,
                          help='rebuild lexicon')
        try:
            opts, args = parser.parse_args()
        except optparse.OptionError as e:
            #print >>sys.stderr, 'OptionError:', e
            print('OptionError:', e, file=sys.stderr)
            sys.exit(1)

        if opts.guimode == True:
            sel = utils.askopenfilenames(title="select W3C-SRGS grammar files")
            if sel is not None:
                args.extend(sel)

        if opts.dictation_mode == False and len(args) == 0:
            parser.error("wrong number of arguments")
            sys.exit(1)

        if opts.dictation_mode == True:
            args.extend(['dictation'])

        self._rebuid_lexicon = opts.rebuild_lexicon

        self._grammars = args
        self._comp = {}
        self._manager = OpenRTM_aist.Manager.init(utils.genmanagerargs(opts))
        self._manager.setModuleInitProc(self.moduleInit)
        self._manager.activateManager()
Beispiel #3
0
class MARYRTCManager:
    def __init__(self):
        parser = optparse.OptionParser(version=__version__, description=__doc__)
        utils.addmanageropts(parser)
        try:
            opts, args = parser.parse_args()
        except optparse.OptionError, e:
            print >>sys.stderr, 'OptionError:', e
            sys.exit(1)
        self._comp = None
        self._manager = OpenRTM_aist.Manager.init(utils.genmanagerargs(opts))
        self._manager.setModuleInitProc(self.moduleInit)
        self._manager.activateManager()
Beispiel #4
0
class FestivalRTCManager:
    def __init__(self):
        encoding = locale.getpreferredencoding()
        sys.stdout = codecs.getwriter(encoding)(sys.stdout, errors="replace")
        sys.stderr = codecs.getwriter(encoding)(sys.stderr, errors="replace")

        parser = utils.MyParser(version=__version__, description=__doc__)
        utils.addmanageropts(parser)
        try:
            opts, args = parser.parse_args()
        except optparse.OptionError, e:
            print >> sys.stderr, 'OptionError:', e
            sys.exit(1)
        self._comp = None
        self._manager = OpenRTM_aist.Manager.init(utils.genmanagerargs(opts))
        self._manager.setModuleInitProc(self.moduleInit)
        self._manager.activateManager()
Beispiel #5
0
        return False


def main():
    encoding = locale.getpreferredencoding()
    sys.stdout = codecs.getwriter(encoding)(sys.stdout, errors="replace")
    sys.stderr = codecs.getwriter(encoding)(sys.stderr, errors="replace")

    parser = utils.MyParser(version=__version__, description=__doc__)
    utils.addmanageropts(parser)
    try:
        opts, args = parser.parse_args()
    except optparse.OptionError, e:
        print >> sys.stderr, 'OptionError:', e
        sys.exit(1)
    manager = OpenRTM_aist.Manager.init(utils.genmanagerargs(opts))
    manager.activateManager()
    for c in ('JuliusRTC', 'OpenJTalkRTC', 'FestivalRTC', 'MARYRTC', 'XSLTRTC',
              'CombineResultsRTC'):
        print 'loading... %s' % (c, )
        exec('from openhrivoice import %s' % (c, ))
        profile = OpenRTM_aist.Properties(defaults_str=eval('%s.%s_spec' %
                                                            (c, c)))
        manager.registerFactory(profile, eval('%s.%s' % (c, c)),
                                OpenRTM_aist.Delete)
    manager.runManager(False)


if __name__ == '__main__':
    main()
                self.save_file_as()
                return True
            elif event.keyval == gtk.keysyms.f:
                self.format_data()
                return True
        return False

def main():
    encoding = locale.getpreferredencoding()
    sys.stdout = codecs.getwriter(encoding)(sys.stdout, errors = "replace")
    sys.stderr = codecs.getwriter(encoding)(sys.stderr, errors = "replace")
    
    parser = utils.MyParser(version=__version__, description=__doc__)
    utils.addmanageropts(parser)
    try:
        opts, args = parser.parse_args()
    except optparse.OptionError, e:
        print >>sys.stderr, 'OptionError:', e
        sys.exit(1)
    manager = OpenRTM_aist.Manager.init(utils.genmanagerargs(opts))
    manager.activateManager()
    for c in ('JuliusRTC', 'OpenJTalkRTC', 'FestivalRTC', 'MARYRTC', 'XSLTRTC', 'CombineResultsRTC', 'JuliusDicRTC'):
        print 'loading... %s' % (c,)
        exec('from openhrivoice import %s' % (c,))
        profile=OpenRTM_aist.Properties(defaults_str=eval('%s.%s_spec' % (c, c)))
        manager.registerFactory(profile, eval('%s.%s' % (c, c)), OpenRTM_aist.Delete)
    manager.runManager(False)

if __name__=='__main__':
    main()