Code Monkey home page Code Monkey logo

twitteranalyzer's Introduction

TwitterAnalyzer

Application for analyzing and processing text information in tweets using Machine learning techniques.

Recommended setup

Clone this repository

Python version

python==3.8.1

Virtual environment

conda create -n analyzer python==3.8.1
conda activate analyzer

Install

Run this command to install package with setup.py

pip install -e .

or install just dependencies

pip install -r requirements.txt

Usage

Gui has 3 main tabs

  • Tweet request
  • Tweet filtration
  • Tweet analysis

Layers

        1. Gui
        2. Celery
        3. Tweet operator
         /               \
        /                 \
4. Database operator    4. Api

twitteranalyzer's People

Contributors

grzegorzkrug avatar

Stargazers

 avatar

Watchers

 avatar  avatar

twitteranalyzer's Issues

Split words with ','

def filter_db_search_words(Session, words):
    """

    Args:
        Session:
        words:

    Returns:

    """
    # stages = re.split(';', words)  # Separating stages

    words = words.split()

WorkList

  • Add parent tweets not RT which have less informations

Retweets are shorter

Retweeted tweets are shorter then original text messages.
Reject or replace RT with original.

users have many urls

tweets users can have multilpe urls.
example:

{
'url': {'urls': [{'url': 'https://t.co/X0CD15SXij', 'expanded_url': 'http://www.telewizjarepublika.pl', 'display_url': 'telewizjarepublika.pl', 'indices': [0, 23]}]},
'description': {'urls': [{'url': 'https://t.co/mS7UCAa8ud', 'expanded_url': 'http://live.telewizjarepublika.pl', 'display_url': 'live.telewizjarepublika.pl', 'indices': [5, 28]}, {'url': 'https://t.co/dVdcL089WR', 'expanded_url': 'http://facebook.com/RepublikaTV', 'display_url': 'facebook.com/RepublikaTV', 'indices': [36, 59]}, {'url': 'https://t.co/Mh5BtolgmB', 'expanded_url': 'http://instagram.com/republikatv', 'display_url': 'instagram.com/republikatv', 'indices': [66, 89]}, {'url': 'https://t.co/F3fLcfn45H', 'expanded_url': 'http://youtube.com', 'display_url': 'youtube.com', 'indices': [95, 118]}]}}

Psql, PRogrammingError

2020-04-02 01:27:59,841 - DB_Orm - ERROR - ProgrammingError: (psycopg2.ProgrammingError) can't adapt type 'dict'
[SQL: INSERT INTO tweet (tweet_id, timestamp, contributors, coordinates, created_at, current_user_retweet, favorite_count, favorited, full_text, geo, hashtags, in_reply_to_status_id, in_reply_to_user_id, lang, location, media, place, possibly_sensitive, quoted_status_id, retweet_count, retweeted, retweeted_status_id, scopes, source, truncated, urls, user_id, user_mentions, withheld_copyright, withheld_in_countries, withheld_scope, tweet_mode) VALUES (%(tweet_id)s, %(timestamp)s, %(contributors)s, %(coordinates)s, %(created_at)s, %(current_user_retweet)s, %(favorite_count)s, %(favorited)s, %(full_text)s, %(geo)s, %(hashtags)s, %(in_reply_to_status_id)s, %(in_reply_to_user_id)s, %(lang)s, %(location)s, %(media)s, %(place)s, %(possibly_sensitive)s, %(quoted_status_id)s, %(retweet_count)s, %(retweeted)s, %(retweeted_status_id)s, %(scopes)s, %(source)s, %(truncated)s, %(urls)s, %(user_id)s, %(user_mentions)s, %(withheld_copyright)s, %(withheld_in_countries)s, %(withheld_scope)s, %(tweet_mode)s)]
[parameters: {'tweet_id': '1241700295765303302', 'timestamp': 1585783680, 'contributors': None, 'coordinates': None, 'created_at': 'Sun Mar 22 12:16:34 +0000 2020', 'current_user_retweet': None, 'favorite_count': 14, 'favorited': False, 'full_text': '@vwgoral @StKarczewski 2 godziny pracy dla idei. Nowy rekord.', 'geo': None, 'hashtags': None, 'in_reply_to_status_id': '1241698415723057154', 'in_reply_to_user_id': '4560803920', 'lang': 'pl', 'location': None, 'media': None, 'place': {'id': 'fd939cc11a6c2e63', 'url': 'https://api.twitter.com/1.1/geo/id/fd939cc11a6c2e63.json', 'place_type': 'city', 'name': 'Tychy', 'full_name': 'Tyc ... (103 characters truncated) ... : 'Polygon', 'coordinates': [[[18.922873, 50.0771704], [19.091493, 50.0771704], [19.091493, 50.1757059], [18.922873, 50.1757059]]]}, 'attributes': {}}, 'possibly_sensitive': None, 'quoted_status_id': 'None', 'retweet_count': 1, 'retweeted': False, 'retweeted_status_id': 'None', 'scopes': None, 'source': '<a href="http://twitter.com/download/android" rel="nofollow">Twitter for Android</a>', 'truncated': False, 'urls': None, 'user_id': '2903784436', 'user_mentions': None, 'withheld_copyright': None, 'withheld_in_countries': None, 'withheld_scope': None, 'tweet_mode': None}]
(Background on this error at: http://sqlalche.me/e/f405)

Word filteration

Filtrating tweets with word, it is searching in full quoted status, for example in user description

Print Log

Replace printing with logger module.

Display only Tweets

display most important fields only

  • id
  • Text
  • Hide quote and retweet
  • Likes and retweets
  • User

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.