python中nltkparse
导读:python中nltkparse?Returnthe``ContextFreeGrammar``correspondingtotheinputstring(s .:paraminput:agrammar,eitherintheformofa...
python中nltkparse?
Returnthe``ContextFreeGrammar``correspondingtotheinputstring(s).
:paraminput:agrammar,eitherintheformofastringor
asalistofstrings.
例子:
importnltk
defparse(sent,grammar):
gr=nltk.parse_cfg(grammar)
parser=nltk.parse.ChartParse(gr,nltk.parse.TD_STRATEGY)
returnparser.get_parse_list(sent.split())
声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!
若转载请注明出处: python中nltkparse
本文地址: https://pptw.com/jishu/62073.html
