Skip to content

Instantly share code, notes, and snippets.

@language-engineering
Created October 24, 2012 11:19
Show Gist options
  • Select an option

  • Save language-engineering/3945534 to your computer and use it in GitHub Desktop.

Select an option

Save language-engineering/3945534 to your computer and use it in GitHub Desktop.
from sussex_nltk import lemmatize_tagged, untag_sequence
#Given your review object, you can get tagged words from it
tagged_words = amazon_review.tagged_words()
#Lemmatise the words (required tagged words)
lemma_words = [lemmatize_tagged(tagged_word) for tagged_word in tagged_words]
#Remove the PoS tags in order to use the lemmas as features
features = untag_sequence(lemma_words)
print features
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment