Skip to content

Instantly share code, notes, and snippets.

View gerbal's full-sized avatar

Grant McLendon gerbal

  • Madison
  • 00:45 (UTC -05:00)
View GitHub Profile
# File name: NLTK_presentation_code.py
# Purpose: Intro to text analysis in Python, NLTK
# Data Used: NLTK data and book examples, own Manifesto data
# Data Output: -
"""
Examples based on
"Natural Language Processing with Python"
Bird, Klein and Loper, 2010
@gerbal
gerbal / generate_sentence.py
Last active January 4, 2016 12:29
For NLP Presentation about NLTK
from nltk.grammar import parse_cfg
from nltk.parse import generate2
grammar2 = parse_cfg("""
S -> NP VP
NP -> Det Nom | PropN
Nom -> Adj Nom | N
VP -> V Adj | V NP | V S | V NP PP
PP -> P NP
PropN -> 'Buster' | 'Chatterer' | 'Joe'
Det -> 'the' | 'a'
// Create a 3d scatter plot within d3 selection parent.
function scatterPlot3d(parent) {
var x3d = parent
.append("x3d")
.style("width", parseInt(parent.style("width")) + "px")
.style("height", parseInt(parent.style("height")) + "px")
.style("border", "none")
var scene = x3d.append("scene")
import random
import time
def randomMAC():
mac = [0x00, 0x16, 0x3e,
random.randint(0x00, 0x7f),
random.randint(0x00, 0xff),
random.randint(0x00, 0xff)]
return ':'.join(map(lambda x: "%02x" % x, mac))
@gerbal
gerbal / 1_Identify_training_set.py
Last active August 29, 2015 14:00
Simple Definition Extraction attempt
import nltk.data
import nltk
from nltk import tokenize
from nltk import tag
from nltk import chunk
try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.ElementTree as ET
import re
### Keybase proof
I hereby claim:
* I am gerbal on github.
* I am gerbal (https://keybase.io/gerbal) on keybase.
* I have a public key whose fingerprint is F5D1 28C2 F876 6377 98DA 34D2 7056 7C33 9349 553C
To claim this, I am signing this object:
@gerbal
gerbal / gist:d2f1dc200646efdf6fc3
Last active August 29, 2015 14:07
G BoxStarter
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
# Enable-RemoteDesktop
# Basic functionality
cinst binroot
cinst mingw
# Cmdline functionality
cinst cmder
cinst webpi
cinst virtualbox
cinst binroot
cinst mingw
cinst cmder
cinst webpi
cinst git
cinst Wget
cinst hg
cinst curl