I hereby claim:
- I am lekevicius on github.
- I am lekevicius (https://keybase.io/lekevicius) on keybase.
- I have a public key whose fingerprint is 8CD7 B7E7 19FD 0DB3 0604 785E 2F1F B4F3 6100 6889
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
require 'json' | |
require 'csv' | |
data_txt = File.read('data_itf.txt') | |
words = ['sir', 'thank', 'love', 'god', 'life', 'night', 'shit', 'boy', 'girl', 'fuck', 'car', 'money', 'father', 'mother', 'hell', 'son', 'kill', 'dead', 'call', 'friend', 'stay', 'leave', 'baby', 'home', 'world'] | |
results = {} | |
words.each do |word| | |
years = {} |
from pattern.vector import * | |
import glob | |
from string import * | |
import operator | |
import json | |
words = ['sir', 'thank', 'love', 'god', 'life', 'night', 'shit', 'boy', 'girl', 'fuck', 'car', 'money', 'father', 'mother', 'hell', 'son', 'kill', 'dead', 'call', 'friend', 'stay', 'leave', 'baby', 'home', 'world'] | |
documents = [] | |
corpus = Corpus.load('years.corpus') |
from pattern.vector import * | |
import glob | |
from string import * | |
import operator | |
documents = [] | |
def create_document(script, name): | |
document = Document(script, | |
filter = lambda w: w.isalpha() and len(w) > 1, |
drop_words = ['subtitle', 'cd1', 'cd2', 'kbps', 'transc', 'subed', 'distrib', 'synched', '.com'] | |
(1962..2012).each do |year| | |
year_string = "" | |
Dir.glob("Scripts/#{ year }-*") do |file| | |
contents = File.read(file) | |
year_string += contents | |
year_string += "\n\n" | |
end |
# encoding: UTF-8 | |
require 'iconv' | |
require 'json' | |
require 'nokogiri' | |
# getsub -s i -l eng -t srt tt0055928 | |
def download_movie movie_data |
listTopMovies = (year) -> | |
url = "http://www.imdb.com/year/#{ year }/" | |
casper.then -> | |
casper.open(url).then -> | |
# console.log '# ' + url | |
console.log '' | |
console.log "========= #{ year } =========" | |
# console.log url | |
pageMovies = @evaluate -> | |
movies = [] |
hue2rgb = (p, q, t) -> | |
t += 1 if t < 0 | |
t -= 1 if t > 1 | |
return p + (q - p) * 6 * t if t < 1/6 | |
return q if t < 1/2 | |
return p + (q - p) * (2/3 - t) * 6 if t < 2/3 | |
return p | |
hslToRgb = (h, s, l) -> | |
if s is 0 |
loadPage = (url) -> | |
casper.open(url).then -> | |
pageIcons = @evaluate -> | |
links = [] | |
$('a.thumbnail_link').each -> links.push $(@).attr('href') | |
links | |
# console.log pageIcons | |
allIcons.push icon for icon in pageIcons | |
hasNextPage = @evaluate -> $('.navigation a.next').length | |
# console.log hasNextPage |