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
#Pick one of the three chunk types in the CoNLL corpus. | |
#Write functions to do the following tasks for your chosen type: | |
#1. List all the tag sequences that occur with each instance of this chunk type. | |
#2. Count the frequency of each tag sequence, and produce a ranked list in order of decreasing | |
# frequency; each line should consist of an integer (the frequency) and the tag sequence. | |
#3. Inspect the high-frequency tag sequences. Use these as the basis for developing a better chunker. | |
import nltk, sys | |
from nltk.corpus import conll2000 | |
from nltk.probability import FreqDist |
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
#Develop an NP chunker that converts POS-tagged text into a list of tuples, where each tuple | |
#consists of a verb followed by a sequence of noun phrases and prepositions, e.g. the little cat | |
#sat on the mat becomes ('sat', 'on', 'NP')... | |
import nltk | |
# Tagged corpus | |
brown = nltk.corpus.brown | |
# Grammar from chapter 7 | |
grammar = 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
from __future__ import division | |
import sys, datetime, string, ConfigParser, textwrap | |
def count_revs(branch, count, get_alias, output, repo, separator, start, users): | |
out = open(output, 'w', 0) | |
# Output header | |
out.write(separator + string.join(users, separator) + '\n') | |
for revid in repo.changelog: |
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/python | |
#-*- coding: utf-8 -*- | |
import os, sys, re, sqlite3, operator | |
if len(sys.argv) >= 2: | |
dbpath = sys.argv[1] | |
else: | |
print "Pass Skype's main.db path:" | |
print "/home/constantine/.Skype/theaspect/main.db" |
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/python | |
# coding=utf-8 | |
# | |
# USAGE | |
# | |
# Download and install | |
# https://pypi.python.org/pypi/Skype4Py/ | |
# https://pypi.python.org/pypi/pysqlite | |
# Edit config |
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
#!/bin/bash | |
# | |
# Constantine Linnick <theaspect@gmail.com> | |
# https://gist.github.com/theaspect/09d0c0e516d41bfcdb7f | |
set -e | |
BASE="$PWD" | |
ORIGIN="$PWD/origin" | |
ALICE="$PWD/alice" |
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 javax.script.ScriptEngine; | |
import javax.script.ScriptEngineManager; | |
import javax.script.ScriptException; | |
import java.lang.reflect.InvocationTargetException; | |
public class Script { | |
public static void main(String... args) throws ScriptException, IllegalAccessException, InvocationTargetException, InstantiationException { | |
ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn"); | |
engine.eval("" + |
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
# theaspect at constantine.local in ~/workspace/aaa on git:master o [16:48:17] | |
$ find . -name '*.java' -exec wc -l {} \; | awk "{s+=int($1);} END {print s}" | |
418 |
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/python | |
# -*- coding: utf-8 -*- | |
import random | |
import multiprocessing | |
def counter(x): | |
cnt = 0 | |
for i in xrange(0,x): | |
cnt+=1 | |
print "Worker %d counted to %d" % (multiprocessing.current_process().pid, cnt) | |
return cnt |
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
a | |
ab | |
abc | |
abbc | |
aabb | |
abcd | |
aaaa | |
acbd | |
dacb | |
baaa |
OlderNewer