A Pen by Anonasaurus Rex on CodePen.
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
| ### 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: |
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
| 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 |
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
| 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)) |
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
| // 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") |
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
| 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' |
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
| # 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 |
NewerOlder