Skip to content

Instantly share code, notes, and snippets.

@aniruddha27
Created June 5, 2020 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aniruddha27/07e760dd5b53cef35b52652bafa5f687 to your computer and use it in GitHub Desktop.
Save aniruddha27/07e760dd5b53cef35b52652bafa5f687 to your computer and use it in GitHub Desktop.
def rule2_mod(text,index):
doc = nlp(text)
phrase = ''
for token in doc:
if token.i == index:
for subtoken in token.children:
if (subtoken.pos_ == 'ADJ'):
phrase += ' '+subtoken.text
break
return phrase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment