This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "my-package", | |
"private": true, | |
"version": "0.0.0", | |
"type": "module", | |
"scripts": { | |
"dev": "vite", | |
"start": "vite", | |
"start:mock": "VITE_MOCK_SERVER=true vite", | |
"build": "tsc && vite build", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getRandomNumberOfTodos = () => { | |
const todos = []; | |
for (let i = 0; i < Math.floor(Math.random() * 10); i++) { | |
todos.push({ | |
id: i, | |
title: `My Todo - ${i}`, | |
description: `This is the description of the todo -${i}` | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import googleapiclient.discovery | |
# Fetching the data from Youtube API | |
def google_api(key,vidId): | |
os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1" | |
api_service_name = "youtube" | |
api_version = "v3" | |
DEVELOPER_KEY = key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
from sklearn.feature_extraction import text | |
from wordcloud import WordCloud | |
def generate_word_clouds(df): | |
allWords = ' '.join([twts for twts in df['Comments']]) | |
wordCloud = WordCloud(stopwords = text.ENGLISH_STOP_WORDS ,width=1000, height=600, random_state=21, max_font_size=110).generate(allWords) | |
plt.imshow(wordCloud, interpolation="bilinear") | |
plt.axis('off') | |
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def print_neutral_comments(): | |
print('Printing neutral comments:\n') | |
sortedDF = df.sort_values(by=['Polarity']) | |
for i in range(0, sortedDF.shape[0] ): | |
if( sortedDF['Analysis'][i] == 'Neutral'): | |
print(str(i+1) + '> '+ sortedDF['Comments'][i]) | |
print() | |
print_neutral_comments() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def print_negative_comments(): | |
print('Printing negative comments:\n') | |
sortedDF = df.sort_values(by=['Polarity']) | |
for i in range(0, sortedDF.shape[0] ): | |
if( sortedDF['Analysis'][i] == 'Negative'): | |
print(str(i+1) + '> '+ sortedDF['Comments'][i]) | |
print() | |
print_negative_comments() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def print_positive_comments(): | |
print('Printing positive comments:\n') | |
sortedDF = df.sort_values(by=['Polarity']) | |
for i in range(0, sortedDF.shape[0] ): | |
if( sortedDF['Analysis'][i] == 'Positive'): | |
print(str(i+1) + '> '+ sortedDF['Comments'][i]) | |
print() | |
print_positive_comments() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
analysis = lambda polarity: 'Positive' if polarity > 0 else 'Neutral' if polarity == 0 else 'Negative' | |
def analysis_based_on_polarity(df): | |
df['Analysis'] = df['Polarity'].apply(analysis) | |
return df | |
df = analysis_based_on_polarity(df) | |
df |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from textblob.blob import TextBlob | |
def find_polarity_of_single_comment(text): | |
return TextBlob(text).sentiment.polarity | |
def find_polarity_of_every_comment(df): | |
df['Polarity'] = df['Comments'].apply(find_polarity_of_single_comment) | |
return df | |
df = find_polarity_of_every_comment(df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from textblob.blob import TextBlob | |
def find_subjectivity_on_single_comment(text): | |
return TextBlob(text).sentiment.subjectivity | |
def apply_subjectivity_on_all_comments(df): | |
df['Subjectivity'] = df['Comments'].apply(find_subjectivity_on_single_comment) | |
return df | |
df = apply_subjectivity_on_all_comments(df) |
NewerOlder