Git Product home page Git Product logo

ec601_project2's Introduction

EC601_Project2

Twitter API data pulling and analyze sentiment by Google Cloud NLP

Product Mission

Implement twitter API to retrieving tweets from twitter and analyze sentiment of tweets by using the Google Natual Language API.The Twitter API is able to allow tools like Adverity to regularly retrieve tweets information. Users can then implement sentiment analysis from Google Natural Language Process

User Story and MVP

As an analyst from PR agency, it is important to know the customer feedback of their new released products as well as the reputation of their chosen brand ambassadors. Also, as an investor, it is important to analyze related information about the stock markets. A program that takes any tweets as input and ouput a sentiment scale of sentiment. Tweets will be the input from the Twitter api. The result from twitter api will be analyzed by google Natural Language Processing. In this way, the user is able to know the sentiment of tweets.

Environment Setup

Python 3.0+

Tweepy

Google Colab

Google Cloud Natual Language V1

Steps and Resutls

First, to get the permissions to call from Twitter, regist a Twitter account as well as getting API_Key, API_Key_Secret, Access_token, Access_token_secret.

consumer_key ='Your API key/consumer key'
consumer_secret = 'Your secret API key/ consumer key'
access_token = 'Your access token'
access_token_secret = 'Your secret access token'
Bearer_token ='Your bearer token' 

For example, tweets from Elon Reeve Musk will be retrieved by passing the username of the account you want to download.

image

To begin with, regist a account for Google Cloud, and create a project and enable it for Google NLP access as well as creating credentials for a service account: https://cloud.google.com/natural-language

Next, get the configuration of keys for the project with the following steps: In the Cloud Console, click the email address for the service account that you created. 1.Click and Add Keys.

2.Get a JSON key file and uplpoad it to the google dirve if using Google Colab.

os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = "JSon_file_Path"

The Sentiment of Musk's tweets then could be analyzed:

mentions {
    text {
      content: "SpaceX"
      begin_offset: 80
    }
    type: PROPER
    sentiment {
      magnitude: 0.10000000149011612
      score: -0.10000000149011612
    }
  }
  sentiment {
    magnitude: 0.10000000149011612
    score: -0.10000000149011612
  }
}

REFERCENCE:

https://cloud.google.com/natural-language/docs/samples

https://github.com/tweepy/tweepy

ec601_project2's People

Contributors

shiyuhu1933 avatar

Stargazers

 avatar

Watchers

 avatar

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.