Skip to content

Instantly share code, notes, and snippets.

@Coaden
Coaden / gulp.js
Last active February 24, 2016 15:07
Gulp.js File for VS / ng2 / typescipt + packages.json + tsconfig.json
var gulp = require('gulp');
var rimraf = require('rimraf');
var clean = require('gulp-clean');
var ts = require('gulp-typescript');
var merge = require('merge-stream');
var sourcemaps = require('gulp-sourcemaps');
var tslint = require('gulp-tslint');
var paths = {
webroot: './wwwroot',
@ankitbko
ankitbko / prayer.txt
Last active October 29, 2024 18:23
Programmer's Prayer
Our program, who art in memory,
called by thy name;
thy operating system run;
thy function be done at runtime
as it was on development.
Give us this day our daily output.
And forgive us our code duplication,
as we forgive those who
duplicate code against us.
And lead us not into frustration;
from textblob.classifiers import NaiveBayesClassifier
from textblob import TextBlob
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'),
# coding=UTF-8
import nltk
from nltk.corpus import brown
# This is a fast and simple noun phrase extractor (based on NLTK)
# Feel free to use it, just keep a link back to this post
# http://thetokenizer.com/2013/05/09/efficient-way-to-extract-the-main-topics-of-a-sentence/
# Create by Shlomi Babluki
# May, 2013
@gavinmh
gavinmh / naive_summarizer
Last active December 10, 2015 03:58
A naive, unsupervised text summarizer.
# -*- coding: utf-8 *-*
'''
The following is a naive, unsupervised text summarizer.
It extracts N of the text's most salient sentences.
Salience is defined as the average of the tf-idf weights of the words in a sentence.
'''
from nltk import sent_tokenize, word_tokenize
from collections import Counter
from math import log10