【发布时间】:2015-05-18 22:04:17
【问题描述】:
我正在将语言工具与 python 一起使用。但是当我想要处理很长的文本或大量文本时,它会很慢。我一直在看建议机制有多长,我其实不需要任何建议,我只对 rule_id 和 category 感兴趣。
有人知道如何关闭这个建议机制以获得一些处理能力吗?
【问题讨论】:
标签: python languagetool
我正在将语言工具与 python 一起使用。但是当我想要处理很长的文本或大量文本时,它会很慢。我一直在看建议机制有多长,我其实不需要任何建议,我只对 rule_id 和 category 感兴趣。
有人知道如何关闭这个建议机制以获得一些处理能力吗?
【问题讨论】:
标签: python languagetool
查看source: 看起来最接近的参数是-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()
【讨论】: