Last active
December 27, 2015 16:19
-
-
Save language-engineering/7354649 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def opinion_extractor(aspect_token, parsed_sentence): | |
# Your function will have 3 steps: | |
# i. Initialise a list of opinions | |
opinions = [] | |
# ii. Find opinions (as an example we get all the dependants of the aspect token that have the relation "det") | |
opinions += [dependant.form for dependant in parsed_sentence.get_dependants(aspect_token) if dependant.deprel == "det"] | |
# You can continue to add to "opinions". Remember you can get the head of a token, and filter by PoS tag or Deprel too! | |
# iii. Return the (possibly empty) list of opinions | |
return opinions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment