Skip to content

Instantly share code, notes, and snippets.

@RiansyahTohamba
Created January 5, 2021 08:04
Show Gist options
  • Save RiansyahTohamba/ddd794412ed9ed36eb467442bf584e9b to your computer and use it in GitHub Desktop.
Save RiansyahTohamba/ddd794412ed9ed36eb467442bf584e9b to your computer and use it in GitHub Desktop.
# chunk by np-chunk
def get_chunk_np(sentence):
grammar = "NP: {<DT>?<JJ>*<NN>}"
cp = nltk.RegexpParser(grammar)
result = cp.parse(sentence)
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment