NP VP [0.9] S -> VP [0.1] VP -> V NP [0.5] VP -> V [0.1] VP -> V VP_V [0.3] VP -> V PP [0.1] NP -> NP NP [0.1] NP -> NP PP [0.2] NP -&g_nltk c++">
赞
踩
先上python使用封装好的包的代码和运行结果:
grammar3 = PCFG.fromstring("""
S -> NP VP [0.9]
S -> VP [0.1]
VP -> V NP [0.5]
VP -> V [0.1]
VP -> V VP_V [0.3]
VP -> V PP [0.1]
NP -> NP NP [0.1]
NP -> NP PP [0.2]
NP -> N [0.7]
PP -> P NP [1.0]
N -> 'people' [0.5]
N -> 'fish' [0.2]
N -> 'tanks'
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。