How to use the pythainlp.cli.make_usage function in pythainlp

To help you get started, we’ve selected a few pythainlp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PyThaiNLP / pythainlp / pythainlp / cli / tag.py View on Github external
def __init__(self, name, argv):
        parser = argparse.ArgumentParser(**cli.make_usage("tag " + name))
        parser.add_argument(
            "text", type=str, help="input text",
        )
        parser.add_argument(
            "-s",
            "--sep",
            dest="separator",
            type=str,
            help=f"Token separator for input text. default: {self.separator}",
            default=self.separator,
        )

        args = parser.parse_args(argv)
        self.args = args

        tokens = args.text.split(args.separator)
github PyThaiNLP / pythainlp / pythainlp / cli / corpus.py View on Github external
def __init__(self, argv):
        parser = argparse.ArgumentParser(**cli.make_usage("corpus"))

        parser.add_argument(
            "--name",
            type=str,
            help="corpus's name",
        )

        parser.add_argument(
            "command",
            type=str,
            default="",
            nargs="?",
            help="[download|remove]"
        )

        args = parser.parse_args(argv[2:])
github PyThaiNLP / pythainlp / pythainlp / cli / benchmark.py View on Github external
def __init__(self, name, argv):
        parser = argparse.ArgumentParser(**cli.make_usage("benchmark " + name))

        parser.add_argument(
            "--input-file",
            action="store",
            help="Path to input file to compare against the test file",
        )

        parser.add_argument(
            "--test-file",
            action="store",
            help="Path to test file i.e. ground truth",
        )

        parser.add_argument(
            "--save-details",
            default=False,
github PyThaiNLP / pythainlp / pythainlp / cli / tokenize.py View on Github external
def __init__(self, name, argv):
        parser = argparse.ArgumentParser(**cli.make_usage("tokenize " + name))
        parser.add_argument(
            "text", type=str, nargs="?", help="input text",
        )
        parser.add_argument(
            "-s",
            "--sep",
            dest="separator",
            type=str,
            help=f"default: {self.separator}",
            default=self.separator,
        )
        parser.add_argument(
            "-a",
            "--algo",
            dest="algorithm",
            type=str,