Skip to content

Instantly share code, notes, and snippets.

@tistaharahap
Last active August 29, 2015 13:56
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 tistaharahap/9167752 to your computer and use it in GitHub Desktop.
Save tistaharahap/9167752 to your computer and use it in GitHub Desktop.
from textblob import TextBlob
def feature_extractor(text):
if not isinstance(text, TextBlob):
text = TextBlob(text.lower())
feats = {
'has_rumor': 'rumor' in text.words,
'has_gosip': 'gosip' in text.words,
'has_pemasaran': 'pemasaran' in text.words,
'has_saham': 'saham' in text.words,
'has_hackathon': 'hackathon' in text.words,
'has_ipo': 'ipo' in text.words,
'has_akuisisi': 'akuisisi' in text.words,
'has_startup': 'startup' in text.words,
'has_android': 'android' in text.words,
'has_aplikasi': 'aplikasi' in text.words,
'has_payment': 'payment' in text.words,
'has_pembayaran': 'pembayaran' in text.words,
'has_api': 'api' in text.words,
'has_kompetisi': 'kompetisi' in text.words,
'has_ide': 'ide' in text.words,
'has_permainan': 'permainan' in text.words,
'has_game': 'game' in text.words,
'has_fundraising': 'fundraising' in text.words,
'has_askds': '[Ask@DailySocial]' in text.words,
'has_investasi': 'investasi' in text.words,
'has_akuisisi': 'akuisisi' in text.words,
'has_musik': 'musik' in text.words,
'has_bhinneka': 'bhinneka' in text.words,
'has_marketplace': 'marketplace' in text.words,
'has_mobile': 'mobile' in text.words
}
return feats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment