import nltk
text = "the little yellow dog barked at the cat."
sens = nltk.sent_tokenize(text)
words = [nltk.word_tokenize(sentence) for sentence in sens]
tags = [nltk.pos_tag(tokens) for tokens in words]
grammar = r"""
NP: {<DT|PP\$>?<JJ>*<NN>}
{<NNP>+}
"""
cp = nltk.RegexpParser(grammar)
result = cp.parse(tags[0])
print(result)