Metadata-Version: 1.1
Name: Naughty-and-Nice
Version: 7.6.9
Summary: A program that gets tweets off your API key in tweepy and analyizes a user's acount on twitter to see if they are naughty or nice.
Home-page: UNKNOWN
Author: Arhith
Author-email: arhithprem@gmail.com
License: UNKNOWN
Description: Before you analyze people's twitter accounts, you need to get a twiiter API key and you are also going to need to import other stuff for this to work!
        Make a register/login at https://twitter.com/ then got to https://apps.twitter.com/ and click the "Create a New App" button so you can make a new app. Put all 
        the details in, like the name and the description for your app, but don't worry about the website. Just put a random domain, but change it later! After you 
        create your App, go to the "Keys and Access Tokens" tab and you will see your API key(Consumer Key) and API secret(Consumer Secret), but you will need 2 more 
        things. You will need your access token and your access token secret. Generate both of them by clicking the "Create My Access Token" button to create you access 
        token. Don't ever share you API keys and Access Tokens. If you accidently share your access tokens, just press regenerate access tokens. Open up a file on a Text 
        Editor like LeafPad or Notepad. Save the file as "twitter_auth.json". The file should look like this:
        
        {
            "consumer_key": "YOUR-API-KEY-OR-CONSUMER-KEY",
            "consumer_secret": "YOUR-API-SECRET-OR-CONSUMER-SECRET",
            "access_token": "YOUR-ACCESS-TOKEN",
            "access_token_secret": "YOUR-ACCESS-TOKEN-SECRET"
        }
        
        Copy and paste it, but put your credentials in the quotes "".
        
        That's it for the twitter setup.
        Next is the coding for the sentiment analysis.
        If you haven't installed Python, then you should install it!.
        After you install Python, go to the Command Prompt/Terminal. Type in the command prompt "pip install Naughty-and-Nice".
        On the terminal, type in "pip3 install Naughty-and-Nice". After you install Naughty-and-Nice, using the same process "pip install" or "pip3 install", install
        2 more things. NLTK and Tweepy. "pip/pip3 install nltk" and "pip/pip3 install tweepy". Then make a new file called "nltk_download.py" and type in:
        
        import nltk
        nltk.download()
        
        Run the code and you will see a window pop up called NLTK downloader after the python run window pops up. Double click on "all packages" to install all the
        packages.
        Then make a new file called sentiment_analysis.py and put the following code in it:
        
        from naughty_and_nice import naughty_and_nice
        import tweepy
        import json
        import re
        import string
        import random
        from nltk.corpus import stopwords
        from nltk.tokenize import word_tokenize
        import nltk.classify.util
        from nltk.classify import NaiveBayesClassifier
        
        ##SET UP TWITTER
        with open('/path/to/your/twitter_auth.json') as f:
            keys = json.load(f)
        
        ## Or On Windows ##
        #with open (r'C:\Users\username\path_to\twitter_auth.json')
        #	keys = json.load(f)
        
        consumer_key = keys['consumer_key']
        consumer_secret = keys['consumer_secret']
        access_token = keys['access_token']
        access_token_secret = keys['access_token_secret']
        
        auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
        auth.set_access_token(access_token, access_token_secret)
        api = tweepy.API(auth)
        
        ##TWITTER STREAM
        class MyStreamListener(tweepy.StreamListener):
        
            def on_status(self, status):
                tweets.append(status.text.rstrip())
                print(status.text.rstrip())
                if len(tweets) > int(howManyTweets):
                    myStream.disconnect()
        while True:
        
            howManyTweets = input("How many tweets do you want? ")
            try:
                howManyTweets = int(howManyTweets)
                break
        
            except Exception as e:
                print(str(e) + " . Please try again!")
        
        myStreamListener = MyStreamListener()
        myStream = tweepy.Stream(auth = api.auth, listener=myStreamListener)    
        tweets = []
        naughty_and_nice(tweets)
        
        Don't run the code. If you do, you will see a error pop up. Go to the ##SET UP TWITTER comment and look below it. You will see 3 things below it. The with open 
        and the ## Or On Windows ## and two lines below that, another with open. If you are on Linux or MacOS then use the first with open. If you are on windows,
        use the second with open AND take out the # right at the start of the with open. Then type in the path of your "twitter_auth.json" file. Then you can run it.
        If a error pops up, then make sure your credentials are correct and your path. Then the system should run properly.
Keywords: twitter,learning
Platform: UNKNOWN
Classifier: Development Status :: 6 - Mature
Classifier: Intended Audience :: Education
Classifier: Programming Language :: Python :: 3
Requires: tweepy
Requires: json
Requires: re
Requires: string
Requires: nltk
