Skip to content

Instantly share code, notes, and snippets.

View ssisaias's full-sized avatar
👨‍💻
:)

Isaias S. Silva ssisaias

👨‍💻
:)
View GitHub Profile
import requests
import time
import datetime
import sys
import json
import re
#change the file name here. the file is generate by ytCommentMiner
dumpFile = open('videoei2-RjJDBHc2017-11-20-1200.json')
json_data = json.load(dumpFile)
import nltk
import csv
import pickle
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
from sklearn.naive_bayes import MultinomialNB
from myclassify import Analise
from pandas import DataFrame
import numpy
from sklearn.feature_extraction.text import CountVectorizer
import nltk
import csv
import pickle
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
from sklearn.naive_bayes import MultinomialNB
from myclassify import Analise # this should be found here: https://gist.github.com/ssisaias/fc49e7983a244b8c29b8f069f263216a
from pandas import DataFrame
import numpy
# 2018 - Isaias S. Silva
# This script converts the sentistrength output to a CSV one with zeros and ones, so we can use in a two class classifier.
import requests
import time
import datetime
import sys
import json
#Attention to the file names bellow
var fs = require('fs');
var obj = JSON.parse(fs.readFileSync('fileURI', 'utf8'));
total = 0;
// obj is the root element; you can change <items> for whatever array you like
obj.items.forEach(element => {
if(element.snippet.totalReplyCount>0){
element.replies.comments.forEach(reply => {
total++;
@ssisaias
ssisaias / WebSecurityConfigFragment.java
Created December 4, 2016 05:15
SpringSecurity(4.1.3) Many Table Login example
//Login config
@Autowired
public void configAuthentication(AuthenticationManagerBuilder auth_1, AuthenticationManagerBuilder auth_2) throws Exception {
auth_1.jdbcAuthentication().dataSource(dataSource)
.usersByUsernameQuery(
"select login,password,1 from table1 where login=?")
.authoritiesByUsernameQuery(
"select login,role from table1 where login=?");
public class ClassicSingleton {
private static ClassicSingleton instance = null;
protected ClassicSingleton() {
// Exists only to defeat instantiation.
}
public static ClassicSingleton getInstance() {
if(instance == null) {
instance = new ClassicSingleton();
}
return instance;