Skip to content

Instantly share code, notes, and snippets.

@language-engineering
Last active October 12, 2015 05:48
Show Gist options
  • Save language-engineering/3980058 to your computer and use it in GitHub Desktop.
Save language-engineering/3980058 to your computer and use it in GitHub Desktop.
# This code assumes you have the *parsed_sents* and *verb_variants* variables
# from the previous section. *parsed_sents* is a list of ParsedSentence objects
# Print to screen the parsed sentences
for sentence in parsed_sents: # *parsed_sents* acquired from the previous section
print "-----" # Just a separator
print sentence
# Each sentence is made up of a list of BasicToken objects
# Each token has several attributes: id, form (the actual word), pos,
# head, deprel (dependency relation)
for token in parsed_sents[0]: # for each token in the first sentence
print token.id, token.form, token.pos, token.head, token.deprel
# For each sentence, print all of the dependent tokens that are subjects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment