MCPcopy Create free account
hub / github.com/ASLP-lab/OSUM / get_parser

Function get_parser

OSUM/tools/text2token.py:38–86  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36
37
38def get_parser():
39 parser = argparse.ArgumentParser(
40 description='convert raw text to tokenized text',
41 formatter_class=argparse.ArgumentDefaultsHelpFormatter)
42 parser.add_argument('--nchar',
43 '-n',
44 default=1,
45 type=int,
46 help='number of characters to split, i.e., \
47 aabb -> a a b b with -n 1 and aa bb with -n 2')
48 parser.add_argument('--skip-ncols',
49 '-s',
50 default=0,
51 type=int,
52 help='skip first n columns')
53 parser.add_argument('--space',
54 default='<space>',
55 type=str,
56 help='space symbol')
57 parser.add_argument('--bpe-model',
58 '-m',
59 default=None,
60 type=str,
61 help='bpe model for english part')
62 parser.add_argument('--non-lang-syms',
63 '-l',
64 default=None,
65 type=str,
66 help='list of non-linguistic symobles,'
67 ' e.g., <NOISE> etc.')
68 parser.add_argument('text',
69 type=str,
70 default=False,
71 nargs='?',
72 help='input text')
73 parser.add_argument('--trans_type',
74 '-t',
75 type=str,
76 default="char",
77 choices=["char", "phn", "cn_char_en_bpe"],
78 help="""Transcript type. char/phn. e.g., for TIMIT
79 FADG0_SI1279 -
80 If trans_type is char, read from
81 SI1279.WRD file -> "bricks are an alternative"
82 Else if trans_type is phn,
83 read from SI1279.PHN file ->
84 "sil b r ih sil k s aa r er n aa l
85 sil t er n ih sil t ih v sil" """)
86 return parser
87
88
89def main():

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected