# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# + id="OHDqKE90ndf_" colab={"base_uri": "https://localhost:8080/"} outputId="aa28f456-266b-4364-d6c7-f71defcba5e5"
import time
start = time.perf_counter()
import tensorflow as tf
print(tf.__version__)
end = time.perf_counter()
print('Elapsed time: ' + str(end - start))

# + [markdown] id="RNuSdnFAnNyD"
# ## Tweet Sentiment Extraction
# "My ridiculous dog is amazing." [sentiment: positive]
#
# With all of the tweets circulating every second it is hard to tell whether the sentiment behind a specific tweet will impact a company, or a person's, brand for being viral (positive), or devastate profit because it strikes a negative tone. Capturing sentiment in language is important in these times where decisions and reactions are created and updated in seconds. But, which words actually lead to the sentiment description? In this competition you will need to pick out the part of the tweet (word or phrase) that reflects the sentiment.
#
# Help build your skills in this important area with this broad dataset of tweets. Work on your technique to grab a top spot in this competition. What words in tweets support a positive, negative, or neutral sentiment? How can you help make that determination using machine learning tools?
#
# In this competition we've extracted support phrases from Figure Eight's Data for Everyone platform. The dataset is titled Sentiment Analysis: Emotion in Text tweets with existing sentiment labels, used here under creative commons attribution 4.0. international licence. Your objective in this competition is to construct a model that can do the same - look at the labeled sentiment for a given tweet and figure out what word or phrase best supports it.
#
# Disclaimer: The dataset for this competition contains text that may be considered profane, vulgar, or offensive.
# Link: https://www.kaggle.com/c/tweet-sentiment-extraction/overview

# + colab={"base_uri": "https://localhost:8080/"} id="jlj1Nfr4otNF" outputId="82483a21-2768-472a-a8a8-d1193a5e1506"
from google.colab import drive
drive.mount('/content/gdrive')

# + [markdown] id="gNZrC5SmndgC"
# # EDA

# + id="gAmkKrZrndgD" colab={"base_uri": "https://localhost:8080/"} outputId="10fe83eb-8f2e-4455-8fce-9e19fffd24c8"
import pandas as pd

start = time.perf_counter()
"""
#loading data if using local system
train_data = pd.read_csv("data/jigsaw-toxic-comment-train.csv")
validation_data = pd.read_csv("data/validation.csv")
test_data = pd.read_csv("data/test.csv")
"""

#loading data if using colab

path = "/content/gdrive/MyDrive/Dataset/Tweet Sentiment Extraction/Data/"
train_data = pd.read_csv(path+ "train.csv")
test_data = pd.read_csv(path+"/test.csv")
end = time.perf_counter()
print('Elapsed time: ' + str(end - start))

# + id="gfmMCAB4ndgD" colab={"base_uri": "https://localhost:8080/", "height": 204} outputId="fff27f80-7a96-4cd1-da3e-65d2ebd1f049"
train_data.head()

# + colab={"base_uri": "https://localhost:8080/"} id="cYutIXkJmULv" outputId="dc48e276-3833-4b62-977d-e0a9aedee840"
train_data.describe

# + id="QbjxvdkSndgF" colab={"base_uri": "https://localhost:8080/", "height": 204} outputId="850089c1-23d2-43ab-eeef-841d1d91e790"
test_data.head()

# + colab={"base_uri": "https://localhost:8080/"} id="z2AXq4J-mWMe" outputId="56ffbda1-06be-441e-c270-c17b21aa7da3"
test_data.describe

# + id="Q4TdsQwPndgG" colab={"base_uri": "https://localhost:8080/"} outputId="647081ed-56ba-4919-eec7-cc38b907931a"
pip install wordcloud

# + id="v8m6iYGXndgG" colab={"base_uri": "https://localhost:8080/"} outputId="e62447c2-ba7d-4520-a97b-f2f06c691875"
pip install plotly

StarcoderdataJupyterScriptsDedupFiltered