我一直在試用Python NLTK Book中的一些示例。例如,第7章談到了這個例子中的詮釋:在Python中使用NLTK Chinking
grammar = r"""
NP:
{<.*>+} # Chunk everything
}<VBD|IN>+{ # Chink sequences of VBD and IN
"""
sentence = [("the", "DT"), ("little", "JJ"), ("yellow", "JJ"),
("dog", "NN"), ("barked", "VBD"), ("at", "IN"), ("the", "DT"), ("cat", "NN")]
cp = nltk.RegexpParser(grammar)
result = cp.parse(sentence)
據我所知,這應該從結果中「吠叫」。但事實並非如此。我是python和nltk的新手,但我在這裏錯過了什麼?有什麼明顯的需要更新嗎?謝謝..