From 3f572c4bcdb080ff1faebee5fb0dbc7cab2ea39d Mon Sep 17 00:00:00 2001 From: Eric Joanis Date: Mon, 1 May 2023 11:38:54 -0400 Subject: [PATCH] feat: expose the tokenize option to api/v1/g2p --- g2p/api.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/g2p/api.py b/g2p/api.py index ac2d1eeb..cc961b71 100644 --- a/g2p/api.py +++ b/g2p/api.py @@ -110,6 +110,15 @@ def __init__(self): required=False, help="Debugging information about the transduction process", ) + self.parser.add_argument( + "tokenize", + dest="tokenize", + type=inputs.boolean, + location="args", + default=False, + required=False, + help="Tokenize before transducing", + ) def get(self): args = self.parser.parse_args() @@ -118,8 +127,9 @@ def get(self): text = args["text"] index = args["index"] debugger = args["debugger"] + tokenize = args["tokenize"] try: - transducer = make_g2p(in_lang, out_lang, tokenize=False) + transducer = make_g2p(in_lang, out_lang, tokenize=tokenize) tg = transducer(text) text = tg.output_string input_text = tg.input_string