2

我正在将语言工具与 python 一起使用。但是当我想要处理很长的文本或大量文本时,它会很慢。我继续阅读建议机制多长时间,我实际上不需要任何建议,我只对 rule_id 和类别感兴趣。

有人知道如何关闭这个建议机制以获得一些处理能力吗?

4

1 回答 1

0

查看源代码:看起来最接近的参数是-a,但这只是为了启用自动应用建议,而不是禁用建议。它是开源的,因此您可以自己编辑它和一个参数。

  parser.add_argument("file",
                    help="plain text file or “-” for stdin")
parser.add_argument("-c", "--encoding",
                    help="input encoding")
parser.add_argument("-l", "--language", metavar="CODE",
                    help="language code of the input or “auto”")
parser.add_argument("-m", "--mother-tongue", metavar="CODE",
                    help="language code of your first language")
parser.add_argument("-d", "--disable", metavar="RULES", type=get_rules,
                    action=RulesAction, default=set(),
                    help="list of rule IDs to be disabled")
parser.add_argument("-e", "--enable", metavar="RULES", type=get_rules,
                    action=RulesAction, default=set(),
                    help="list of rule IDs to be enabled")
parser.add_argument("--api", action="store_true",
                    help="print results as XML")
parser.add_argument("--version", action="version",
                    version="LanguageTool {} ({})"
                            .format(language_tool.get_version(),
                                    language_tool.get_build_date()),
                    help="show LanguageTool version and build date")
parser.add_argument("-a", "--apply", action="store_true",
                    help="automatically apply suggestions if available")
parser.add_argument("-s", "--spell-check-off", dest="spell_check",
                    action="store_false",
                    help="disable spell-checking rules")
return parser.parse_args()  parser.add_argument("file",
                    help="plain text file or “-” for stdin")
parser.add_argument("-c", "--encoding",
                    help="input encoding")
parser.add_argument("-l", "--language", metavar="CODE",
                    help="language code of the input or “auto”")
parser.add_argument("-m", "--mother-tongue", metavar="CODE",
                    help="language code of your first language")
parser.add_argument("-d", "--disable", metavar="RULES", type=get_rules,
                    action=RulesAction, default=set(),
                    help="list of rule IDs to be disabled")
parser.add_argument("-e", "--enable", metavar="RULES", type=get_rules,
                    action=RulesAction, default=set(),
                    help="list of rule IDs to be enabled")
parser.add_argument("--api", action="store_true",
                    help="print results as XML")
parser.add_argument("--version", action="version",
                    version="LanguageTool {} ({})"
                            .format(language_tool.get_version(),
                                    language_tool.get_build_date()),
                    help="show LanguageTool version and build date")
parser.add_argument("-a", "--apply", action="store_true",
                    help="automatically apply suggestions if available")
parser.add_argument("-s", "--spell-check-off", dest="spell_check",
                    action="store_false",
                    help="disable spell-checking rules")
return parser.parse_args()
于 2015-03-16T17:14:36.947 回答