View text_normalizer.py
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 re | |
import string | |
import unidecode | |
from nltk.tokenize import sent_tokenize | |
from nltk.tokenize import word_tokenize | |
from nltk.stem import WordNetLemmatizer | |
from nltk.corpus import stopwords | |
import gensim.downloader as api | |
from pycontractions import Contractions | |
from word2number import w2n |
View convex_hull.py
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 random | |
""" | |
Computes the Convex Hull with the Graham Scan algorithm | |
Use: | |
h = ConvexHull() | |
print(h.hull) | |
""" |
View d3_pictogram_demo_circles.html
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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<html> | |
<head> | |
<script src="http://d3js.org/d3.v4.js"></script> | |
</head> | |
<body> | |
<div id='grid-container'> | |
<div id='grid-chart'></div> |
View network_graph_demo_d3.html
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
<html> | |
<head> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<style> | |
label { | |
font: "Helvetica Neue", Helvetica, Arial, sans-serif; | |
} | |
</style> |
View rectCollide.js
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
function rectCollide() { | |
var nodes,sizes,masses; | |
var strength = 1; | |
var iterations = 1; | |
var nodeCenterX; | |
var nodeMass; | |
var nodeCenterY; | |
function force() { |
View sudoku_solver.py
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 random import shuffle | |
import copy | |
""" | |
SudokuGenerator | |
input: grid can be a 2-D matrix of a Sudoku puzzle to solve, or None to generate a new puzzle. | |
""" | |
View rectCollide.js
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
function rectCollide() { | |
var nodes,sizes,masses; | |
var strength = 1; | |
var iterations = 1; | |
var nodeCenterX; | |
var nodeMass; | |
var nodeCenterY; | |
function force() { |
View albumYear.js
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
let yearAlbum = {}; | |
let yearCount = new Map(); | |
for (let i = 0; i < data.length; i++) { | |
for (let j = 0; j < data[i].bandAlbums.length; j++) { | |
if (!yearCount.has(data[i].bandAlbums[j].albumYear)) { | |
yearCount.set(`${data[i].bandAlbums[j].albumYear}`, 1) | |
} else { | |
yearCount.set(`${data[i].bandAlbums[j].albumYear}`, yearCount.get(`${data[i].bandAlbums[j].albumYear}`) + 1) | |
} |
View createTables.js
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
/* | |
1st create database: | |
-go into the interactive interpreter | |
psql postgres | |
Here we're creating: | |
1. a databased called 'darklyrics' | |
2. a user 'darklyricsuser' | |
3. with password 'darklyricspassword' |
View jsonToPostgres.js
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 knex = require('knex')({ | |
client: 'pg', | |
connection: 'postgresql://darklyricsuser:darklyricspassword@localhost/darklyrics', | |
}); | |
const fs = require('fs'); | |
const data = JSON.parse(fs.readFileSync('/Users/christina/Downloads/results(1).json', 'utf8')); | |
async function insertBand(band) { |
NewerOlder