Пример #1
0
    if options.testSample:
        mainTest(translator, loadSample(options.testSample), options)
        translator.reportStats(sys.stdout)

    if options.applySample:
        mainApply(translator, options)
        translator.reportStats(sys.stderr)

# ===========================================================================
if __name__ == '__main__':
    import optparse, tool
    optparser = optparse.OptionParser(
        usage   = '%prog [OPTION]... FILE...\n' + __doc__,
        version = '%prog ' + __version__)
    tool.addOptions(optparser)
    SequiturTool.addTrainOptions(optparser)
    optparser.add_option(
        '-e', '--encoding', default='ISO-8859-15',
        help='use character set encoding ENC', metavar='ENC')
    optparser.add_option(
        '-P', '--phoneme-to-phoneme', action='store_true',
        help='train/apply a phoneme-to-phoneme converter')
    optparser.add_option(
        '--test-segmental', action='store_true',
        help='evaluate only at segmental level, i.e. do not count syllable boundaries and stress marks')
    optparser.add_option(
        '-B', '--result', dest='testResult',
        help='store test result in table FILE (for use with bootlog or R)', metavar='FILE')
    optparser.add_option(
        '-a', '--apply', dest='applySample',
        help='apply grapheme-to-phoneme conversion to words read from FILE', metavar='FILE')
Пример #2
0
        mainTest(translator, loadSample(options.testSample), options)
        translator.reportStats(sys.stdout)

    if options.applySample:
        mainApply(translator, options)
        translator.reportStats(sys.stderr)


# ===========================================================================
if __name__ == '__main__':
    import optparse, tool
    optparser = optparse.OptionParser(usage='%prog [OPTION]... FILE...\n' +
                                      str(__doc__),
                                      version='%prog ' + __version__)
    tool.addOptions(optparser)
    SequiturTool.addTrainOptions(optparser)
    optparser.add_option('-e',
                         '--encoding',
                         default='ISO-8859-15',
                         help='use character set encoding ENC',
                         metavar='ENC')
    optparser.add_option('-P',
                         '--phoneme-to-phoneme',
                         action='store_true',
                         help='train/apply a phoneme-to-phoneme converter')
    optparser.add_option(
        '--test-segmental',
        action='store_true',
        help=
        'evaluate only at segmental level, i.e. do not count syllable boundaries and stress marks'
    )
Пример #3
0
def getOptParser():
    import optparse, tool
    optparser = optparse.OptionParser(usage='%prog [OPTION]... FILE...\n' +
                                      str(__doc__),
                                      version='%prog ' + __version__)
    tool.addOptions(optparser)
    SequiturTool.addTrainOptions(optparser)
    optparser.add_option('-e',
                         '--encoding',
                         default='ISO-8859-15',
                         help='use character set encoding ENC',
                         metavar='ENC')
    optparser.add_option('-P',
                         '--phoneme-to-phoneme',
                         action='store_true',
                         help='train/apply a phoneme-to-phoneme converter')
    optparser.add_option(
        '--test-segmental',
        action='store_true',
        help=
        'evaluate only at segmental level, i.e. do not count syllable boundaries and stress marks'
    )
    optparser.add_option(
        '-B',
        '--result',
        dest='testResult',
        help='store test result in table FILE (for use with bootlog or R)',
        metavar='FILE')
    optparser.add_option(
        '-a',
        '--apply',
        dest='applySample',
        help='apply grapheme-to-phoneme conversion to words read from FILE',
        metavar='FILE')
    optparser.add_option('-w',
                         '--word',
                         dest='applyWord',
                         help='apply grapheme-to-phoneme conversion to word',
                         metavar='string')
    optparser.add_option(
        '-V',
        '--variants-mass',
        type='float',
        help=
        'generate pronunciation variants until \sum_i p(var_i) >= Q (only effective with --apply)',
        metavar='Q')
    optparser.add_option(
        '--variants-number',
        type='int',
        help=
        'generate up to N pronunciation variants (only effective with --apply)',
        metavar='N')
    optparser.add_option(
        '-f',
        '--fake',
        dest='fakeTranslator',
        help=
        'use a translation memory (read from sample FILE) instead of a genuine model (use in combination with -x to evaluate two files against each other)',
        metavar='FILE')
    optparser.add_option('--stack-limit',
                         type='int',
                         help='limit size of search stack to N elements',
                         metavar='N')
    return optparser