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
#!/usr/bin/env python | |
# coding: utf-8 | |
from nltk.corpus import stopwords | |
from nltk.cluster.util import cosine_distance | |
import numpy as np | |
import networkx as nx | |
def read_article(file_name): | |
file = open(file_name, "r") |
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 statments | |
import numpy | |
import re | |
''' | |
Tokenize each the sentences, example | |
Input : "John likes to watch movies. Mary likes movies too" | |
Ouput : "John","likes","to","watch","movies","Mary","likes","movies","too" | |
''' | |
def tokenize(sentences): |
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
var i = 0, | |
maxCount = 5; | |
var storyInterval = setInterval(() => { | |
document.querySelectorAll(".js-trackedPost>a")[i].click() | |
setTimeout(() => { | |
console.log("Title : ", document.getElementsByClassName("graf--title")[i].innerText); | |
p = document.getElementsByClassName("ui-xs-clamp2")[0] | |
console.log("Profile Description : ", p ? p.innerText : ""); | |
history.back() | |
}, 2000); |
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
var storyPath = window.location.href; | |
// Console API to clear console before logging new data | |
console.API; | |
if (typeof console._commandLineAPI !== 'undefined') { | |
console.API = console._commandLineAPI; //chrome | |
} else if (typeof console._inspectorCommandLineAPI !== 'undefined') { | |
console.API = console._inspectorCommandLineAPI; //Safari | |
} else if (typeof console.clear !== 'undefined') { |
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
console.save = function (data, filename) { | |
if (!data) { | |
console.error('Console.save: No data') | |
return; | |
} | |
if (!filename) filename = 'story.json' | |
if (typeof data === "object") { | |
data = JSON.stringify(data, undefined, 4) |
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
// Extracts high level details of current story | |
function getCurrentStoryDetail() { | |
console.API.clear(); | |
storyObj = {}; | |
storyObj.title = document.getElementsByClassName("graf--title")[0].innerText; | |
storyObj.count = document.getElementsByClassName("js-multirecommendCountButton")[0].innerText; | |
storyObj.name = document.getElementsByClassName("ds-link--styleSubtle")[0].innerText; | |
storyObj.imageUrl = document.getElementsByClassName("avatar-image")[0].src; | |
storyObj.profile = document.getElementsByClassName("ui-xs-clamp2")[0].innerText; |