How to use the pylanguagetool.converters.convert function in pyLanguagetool

To help you get started, we’ve selected a few pyLanguagetool 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 Findus23 / pyLanguagetool / pylanguagetool / __init__.py View on Github external
input_text, inputtype = get_input_text(config)
    if not input_text:
        argparser.print_usage()
        print("input file is required")
        sys.exit(2)
    if config["input_type"]:
        inputtype = config["input_type"]
    if inputtype == "tex":
        print("pyLanguagetool doesn't support LaTeX out of the box.")
        print("But it doesn't have to:")
        print("You can simply use the output of detex")
        if config["input file"]:
            print("    $ detex {} | pylanguagetool".format(config["input file"]))
        print("or use the languagetool integration in TeXstudio.")
        sys.exit(3)
    check_text = converters.convert(input_text, inputtype)
    if config["single_line"]:
        found = False
        for line in check_text.splitlines():
            response = api.check(line, **config)
            print_errors(response,
                         config["api_url"],
                         not config["no_color"],
                         config["rules"],
                         config["rule_categories"]
                         )
            if len(response["matches"]) > 0:
                found = True
        if found:
            sys.exit(1)

    else: