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
title: Bacon Ipsum | |
date: 2013-07-14 12:00:00 | |
Bacon ipsum dolor sit amet ball tip tongue pancetta jowl sirloin rump. Chuck tail pork cow, fatback jerky hamburger pancetta leberkas pig . | |
[Read more](http://baconipsum.com/) |
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
{% extends "base.html" %} | |
{% block content %} | |
<h1>{{ page.meta.title }}</h1> | |
<p>{{ page.meta.date }}</p> | |
{{ page }} | |
{% endblock %} |
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
$ python freeze.py | |
$ git init | |
$ git add . --all | |
$ git commit -am "Initial commit" | |
$ git checkout -b gh-pages | |
$ git remote add origin https://github.com/username/flask-ghpages-example.git | |
$ git push origin --all |
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 | |
from flask import Flask, jsonify, request, render_template, abort | |
from text.blob import TextBlob | |
from text.utils import strip_punc | |
app = Flask(__name__) | |
##### TextBlob API ##### | |
@app.route("/api/sentiment", methods=['POST']) | |
def sentiment(): |
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 text.classifiers import NaiveBayesClassifier | |
train = [ | |
('I love this sandwich.', 'pos'), | |
('This is an amazing place!', 'pos'), | |
('I feel very good about these beers.', 'pos'), | |
('This is my best work.', 'pos'), | |
("What an awesome view", 'pos'), | |
('I do not like this restaurant', 'neg'), | |
('I am tired of this stuff.', 'neg'), |
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 -*- | |
import string | |
from text.blob import Blobber | |
from text.taggers import PerceptronTagger, PatternTagger, NLTKTagger | |
def accuracy(test_set, tagger): | |
n_correct = 0 | |
total = 0 | |
tb = Blobber(pos_tagger=tagger) |
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
Show hidden characters
{ | |
// Color | |
"color_scheme": "Packages/Theme - Nil/Big Duo.tmTheme", | |
"theme": "Nil.sublime-theme", | |
// Font | |
"font_face": "Ubuntu Mono", | |
"font_options": ["subpixel_antialias"], | |
"font_size": 15.0, | |
// Caret | |
"caret_style": "phase", |
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
{ | |
"auto_complete_selector": "source - comment, meta.tag - punctuation.definition.tag.begin", | |
"auto_complete_triggers": | |
[ | |
{ | |
"characters": "$", | |
"selector": "source.coffee, source.js, source.js.embedded.html" | |
} | |
], | |
"bold_folder_labels": true, |
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 textblob.classifiers import NaiveBayesClassifier | |
train = [ | |
('amor', "spanish"), | |
("perro", "spanish"), | |
("playa", "spanish"), | |
("sal", "spanish"), | |
("oceano", "spanish"), | |
("love", "english"), | |
("dog", "english"), |
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
# Even better | |
def lazy_property(fn): | |
'''Decorator that makes a property lazy-evaluated. | |
''' | |
attr_name = '_lazy_' + fn.__name__ | |
@property | |
def _lazy_property(self): | |
if not hasattr(self, attr_name): |