Created
May 8, 2012 21:46
-
-
Save ravikiranj/2639637 to your computer and use it in GitHub Desktop.
Extract Features Method
This file contains hidden or 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
| #get feature list stored in a file (for reuse) | |
| featureList = getFeatureList('data/sampleTweetFeatureList.txt') | |
| #start extract_features | |
| def extract_features(tweet): | |
| tweet_words = set(tweet) | |
| features = {} | |
| for word in featureList: | |
| features['contains(%s)' % word] = (word in tweet_words) | |
| return features | |
| #end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment