Skip to content

Instantly share code, notes, and snippets.

@philgooch
philgooch / lexrank.py
Created June 21, 2017 12:52 — forked from lastlegion/lexrank.py
LexRank summarization in python using sumy
#Import library essentials
from sumy.parsers.plaintext import PlaintextParser #We're choosing a plaintext parser here, other parsers available for HTML etc.
from sumy.nlp.tokenizers import Tokenizer
from sumy.summarizers.lex_rank import LexRankSummarizer #We're choosing Lexrank, other algorithms are also built in
file = "plain_text.txt" #name of the plain-text file
parser = PlaintextParser.from_file(file, Tokenizer("english"))
summarizer = LexRankSummarizer()
summary = summarizer(parser.document, 5) #Summarize the document with 5 sentences
@philgooch
philgooch / index.md
Created August 10, 2016 10:20 — forked from mathisonian/index.md
requiring npm modules in the browser console

demo gif

The final result: require() any module on npm in your browser console with browserify

This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.

Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5

inspiration

@philgooch
philgooch / chilcot.sh
Last active July 12, 2016 06:22
Pulls the Chilcot PDFs from http://www.iraqinquiry.org.uk/the-report/ and converts them to HTML for further processing
# This script will pull the Chilcot PDFs from the publisher site and convert them to html
# ready for import into your favourite CMS or NLP pipeline for further processing
brew install tidy-html5
brew install parallel
brew install xpdf
# Alternatively
# brew install poppler
# or build from