bllip自然语言解析器的python绑定
bllipparser的Python项目详细描述
快速启动
用pip安装bllipparser
shell% pip install --user bllipparser
或者(如果您有sudo访问权限):
shell% sudo pip install bllipparser
获取解析模型并开始解析:
>>> from bllipparser import RerankingParser >>> rrp = RerankingParser.fetch_and_load('WSJ-PTB3', verbose=True) [downloads, installs, and loads the model] >>> rrp.simple_parse("It's that easy.") "(S1 (S (NP (PRP It)) (VP (VBZ 's) (ADJP (RB that) (JJ easy))) (. .)))"
第一次调用时,将下载并安装解析 《华尔街日报》在 ~/.local/share/bllipparser中培训的模型 (它只在随后的调用中加载)。
有关可安装的解析模型的列表,请运行:
shell% python -mbllipparser.ModelFetcher -l
有关BLLIP解析器模型的信息,请参见 有关为文本选择最佳解析模型的信息。