Giter VIP home page Giter VIP logo

keyword-extraction-from-tweets's Introduction

keyword-extraction-from-tweets

keyword extraction from tweets using python

In this module, we use Pattern tools to do POS tagging/Phrase extraction of tweets. The usual POS tagging/chunking tools do not work well for free form texts like tweets, so we needed to use a tool that is designed and trained for twitter/tweets. From Pattern tool output, we extract phrases as entities. You can decide to use on NP (Noun Phrase), but our default is to use NP (Noun Phrase) and ADJP (Adjective Phrase). With this tool, you can also extract hashtags, usernames, urls from the tweet.

Questions, comments, feedbacks: [email protected], @naushadzaman.

Install requirements (Pattern)

Pattern: http://www.clips.ua.ac.be/pattern

$ pip install -r requirements.txt

or you can directly just install Patterm

$ pip install Pattern

Examples

$ python 

Sample keyword extraction

>>> import keyword_extraction_w_parser
>>> query = "The mobile web is more important than mobile apps."
>>> keyword_extraction_w_parser.get_keywords(query)
[u'mobile web', u'mobile apps', u'important']

If we want to extract only the NP (Noun Phrase).

>>> keyword_extraction_w_parser.get_keywords(query, ['NP'])
[u'mobile web', u'mobile apps']

Another example:

>>> query = "As a #roadmapscholar, I highly recommend #startup bootcamp for #founders by @andrewsroadmaps : http://t.co/ZBISIMEBRH http://t.co/VF5CojRWNF"
>>> keyword_extraction_w_parser.get_keywords(query)
[u'roadmapscholar', u'startup bootcamp', u'founders']

Sample extraction of other entities

For tweets, hashtags, usernames, urls are obvious entities that we might need to extract. We provide that functionality as well.

Extract hashtags:

>>> query = "As a #roadmapscholar, I highly recommend #startup bootcamp for #founders by @andrewsroadmaps : http://t.co/ZBISIMEBRH http://t.co/VF5CojRWNF"
>>> keyword_extraction_w_parser.extract_hashtag(query) 
['#roadmapscholar', '#startup', '#founders']

Extract usernames (twitter handles):

>>> query = "RT @andrewsroadmaps: Proud of @naushadzaman & @WasimKhal for winning the #IBMWatson hackathon! #roadmapscholars https://t.co/08sbAjKWKu"
>>> keyword_extraction_w_parser.extract_users(query)
['@andrewsroadmaps', '@naushadzaman', '@wasimkhal']

Extract urls/links:

>>> query = "As a #roadmapscholar, I highly recommend #startup bootcamp for #founders by @andrewsroadmaps : http://t.co/ZBISIMEBRH http://t.co/VF5CojRWNF"
>>> keyword_extraction_w_parser.extract_link(query)
['http://t.co/ZBISIMEBRH', 'http://t.co/VF5CojRWNF']

keyword-extraction-from-tweets's People

Contributors

naushadzaman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

keyword-extraction-from-tweets's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.