Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View abhisheksoni27's full-sized avatar

Abhishek Soni abhisheksoni27

View GitHub Profile
@abhisheksoni27
abhisheksoni27 / aws-sns-example.js
Created August 3, 2019 14:30 — forked from tmarshall/aws-sns-example.js
aws-sdk sns example, in Node.js
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: '{AWS_KEY}',
secretAccessKey: '{AWS_SECRET}',
region: '{SNS_REGION}'
});
var sns = new AWS.SNS();
SELECT
p.Id,
c.Text
FROM
[sotorrent-org:2018_09_23.Posts] p
INNER JOIN
[sotorrent-org:2018_09_23.Comments] c
ON
p.Id = c.PostId
WHERE
import tensorflow as tf
from tensorflow import keras
from tensorflow.python.keras.applications.inception_resnet_v2 import preprocess_input
from tensorflow.python.keras.models import load_model
from tensorflow.python.keras.applications.inception_resnet_v2 import InceptionResNetV2
from tensorflow.python.keras.applications.mobilenet import preprocess_input
from tensorflow.python.keras.applications.mobilenet import MobileNet
from tensorflow.python.keras.preprocessing.image import ImageDataGenerator
import numpy as np
import cv2
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-183-74b2cf4f5e86> in <module>()
----> 1 model = load_model('muteTV.h5')
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/saving.py in load_model(filepath, custom_objects, compile)
227 raise ValueError('No model found in config file.')
228 model_config = json.loads(model_config.decode('utf-8'))
--> 229 model = model_from_config(model_config, custom_objects=custom_objects)
230
"""
Removes the matches and
replace them with an empty string
"""
chatText = regexMedia.sub("", chatText)
chatText = regexDate.sub("", chatText)
lines = []
for line in chatText.splitlines():
import re
mediaPattern = r"(\<Media omitted\>)" # Because it serves no purpose
regexMedia = re.compile(mediaPattern, flags=re.M)
dateAndTimepattern = r"(\d+\/\d+\/\d+)(,)(\s)(\d+:\d+)(\s)(\w+)(\s)(-)(\s\w+)*(:)"
regexDate = re.compile(dateAndTimepattern, flags=re.M)
import sys
import re
import matplotlib.pyplot as plt
import nltk
from utilities import cleanText
from nltk.sentiment.vader import SentimentIntensityAnalyzer
sentiment_analyzer = SentimentIntensityAnalyzer() # Our Great Sentiment Analyzer
def analyze(name):
import sys
from collections import Counter
import re
import matplotlib.pyplot as plt
import numpy as np
from utilities import cleanText
def analyze(name):
linesText = cleanText(name + ".txt")
import re
mediaPattern = r"(\<Media omitted\>)" # Because it serves no purpose
regexMedia = re.compile(mediaPattern, flags=re.M)
dateAndTimepattern = r"(\d+\/\d+\/\d+)(,)(\s)(\d+:\d+)(\s)(\w+)(\s)(-)(\s\w+)*(:)"
regexDate = re.compile(dateAndTimepattern, flags=re.M)
def cleanText(filename):
chat = open(filename)
10/09/16, 6:10 PM - Person 1: Person 2?
10/09/16, 7:10 PM - Person 2: Yes?
10/09/16, 8:10 PM - Person 1: How are you?
10/09/16, 9:10 PM - Person 2: Idk. You?
10/09/16, 10:10 PM - Person 1: I just got a new phone
10/09/16, 11:10 PM - Person 2: Which one?
10/09/16, 12:10 AM - Person 1: I showed you?
10/09/16, 1:10 AM - Person 2: Cool
10/09/16, 2:10 AM - Person 1: Tes
10/09/16, 3:10 AM - Person 1: Yes