Last active
December 14, 2015 22:09
-
-
Save beauvais/5156382 to your computer and use it in GitHub Desktop.
Working my way through NLTK
This file contains hidden or 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/python | |
# -*- coding: utf-8 -*- | |
import nltk | |
from nltk.corpus import stopwords | |
from collections import Counter | |
stops = stopwords.words('english') | |
ipsem = """ | |
Kickstarting Home Espresso: ZPM Nocturn | |
ZPM‘s Gleb Polyakov and Igor Zamlinsky introduced me to Kickstarter through their Nocturn espresso machine. I’m geeky enough to know what a PID controller is, and why that’s something £5k+ professional machines tend to have under their shiny bonnets. When a friend sent me a link to their Kickstarter project, I quickly joined the—now immense—throng of backers. Following their webby approach to design and engagement, their startup-mentality, and the ultimate goal of bring professional-grade espresso home, the Nocturn sits soundly on the girders of my writing interests. | |
The ZPM team were happy to answer some questions I had for them, and ended up telling me a very compelling story, which I’d like to share with you. | |
1. I understand the Nocturn to be distinctly different from most other home espresso machines. Where do these differences lie, and what makes these important? | |
It’s first important to know that there’s been very little advancement in the way of manual and semi-automatic espresso machines—especially in home machines—since the first pump-driven E61 machine was introduced in 1961. Huge commercial machines have been refined to provide more temperature stability and pressure consistency, but home machines never really caught up despite a growing community of at-home espresso lovers and increases in our knowledge of what you need to make good espresso. | |
Even without major modifications in design, home machines that make solid espresso are really expensive. And that’s what really got us thinking about the problem. We were college students; we loved espresso; but we couldn’t afford a $1000+ home machine that would make truly good, reliable espresso. We could, however, buy a bunch of (very) used espresso machines off of Craigslist, tear them apart, see what made them tick, then Frankenstein them back together to try to make one that worked better. It started to look like we could do a better job for less. | |
We approached it as an engineering problem, not a coffee problem. What do you need to make great espresso? Tightly regulated temperature and pressure. Well, gee, we could do that. | |
""" | |
ipsem = ipsem.lower() | |
tokens = nltk.word_tokenize(ipsem) | |
print tokens | |
cleansed = [x for x in tokens if x not in stops] | |
print cleansed | |
counted = Counter(cleansed) | |
tagged = nltk.pos_tag(cleansed) | |
print tagged | |
top_five = counted.most_common(5) | |
print top_five |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment