Giter Club home page Giter Club logo

predictinghatredcommentsontwitter's Introduction

Predicting Hatred Comments On Twitter

Predict Hatred tweets from twitter using the dataset Twitter Sentiment Analysis.

Working of the Model

This model uses deep convolutional layers with multichannel input layers.

Steps:

Pre-processing

  1. Load data as dataframe.
  2. Drop unrequired columns.
  3. Remove usernames from tweets.
  4. Remove #s.
  5. Remove emojies as it will not be recognisable by normal character.

Tokenizer

  1. Fit the train data on a tokeniser to convert all the strings into numbers.
  2. Encode the strings in the dataset into numbers.

Padding

The ends of the sentences are padded with 0 (zero) to indicate the end of the string.

Model

We use 1DConvolution layers for text classification.

  1. The first channel has a kernal size of 2.
  2. The second channel has a kernal size of 3.
  3. The third channel has a kernal size of 4.
  4. All outputs are concatenated.
  5. Dense layer is added.
  6. Dropout layer is added.
  7. Final output dense layer with one output class is added.

Dependencies

import pandas as pd
import numpy as np
import re
import tensorflow_datasets as tfds
import tensorflow as tf
from keras.preprocessing.sequence import pad_sequences as pad_seq
from keras.models import Model
from keras.layers import Input
from keras.layers import Dense
from keras.layers import Flatten
from keras.layers import Dropout
from keras.layers import Embedding
from keras.layers.convolutional import Conv1D
from keras.layers.convolutional import MaxPooling1D
from keras.layers.merge import concatenate
import statistics

Run the model

  1. Clone the repository
  2. Install dependencies
  3. Run the sentimentAnalysis.py
  4. Run predict.py to test results

License

Apache License 2.0

I recommend using Google Colab or Jupyter notebooks to run the file cell by cell
Connect with me on LinkedIn

predictinghatredcommentsontwitter's People

Contributors

ani-poroorkara avatar

Watchers

 avatar  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.