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
# all_summary is the data here. in this case, just a lot of text records collapsed into on corpus string | |
# Prep data for NLTK Analysis | |
import nltk.collocations | |
tokens = nltk.word_tokenize(all_summary) | |
text = nltk.Text(tokens) | |
# Remove stop-words, convert to lower-case, remove all non-alpha characters | |
from nltk.corpus import stopwords | |
stopwords = stopwords.words('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
import mediacloud | |
import json | |
mc_query = u'+"heart disease"' | |
mc_filter = u'+publish_date: [2010-01-01T00:00:00Z TO 2011-01-01T00:00:00Z]' | |
print('query: ' + mc_query) | |
print('filter: ' + mc_filter) | |
mc = mediacloud.api.MediaCloud('MY_API_KEY') |
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
# For non-trivial scraping, better to use Scrapy or Beautiful Soup... | |
# - http://doc.scrapy.org/en/latest/intro/tutorial.html | |
# - http://www.crummy.com/software/BeautifulSoup/ | |
import requests | |
r = requests.get("http://sacbee.com/search_results?aff=1100&q=robot") | |
r | |
# <Response [200]> |
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
float time = 0; | |
float radius = 0; | |
void setup() { | |
background(5); | |
size(displayWidth,displayHeight, OPENGL); | |
noStroke(); | |
} | |
void draw() { |
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 org.apache.http.impl.client.DefaultHttpClient; | |
import org.apache.http.client.HttpClient; | |
import org.apache.http.client.methods.HttpGet; | |
import org.apache.http.HttpResponse; | |
import org.apache.http.HttpEntity; | |
// http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html - Apache HttpClient | |
// https://forum.processing.org/topic/http-post-processing - Integration with Processing (different from above) | |
// https://code.google.com/p/processing/source/browse/trunk/processing/java/libraries/net/examples/HTTPClient/HTTPClient.pde?r=7950 - Messy. | |
// https://github.com/francisli/processing-http - Unnecessary? |
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
library(XML) | |
getMARCField = function(marc_doc, tag, code) { | |
xpath = paste("/m:collection/m:record/m:datafield[@tag='", tag, "']/m:subfield[@code='", code, "']", sep="") | |
return(xpathApply(marc_doc, xpath, namespaces=c("m"), xmlValue)) | |
} | |
vs = xmlRoot(xmlParse('vail-first-3500.xml')) | |
field100a = getMARCField(vs, '100', 'a') |
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
#!/Users/sands/.rvm/rubies/ruby-1.8.7-p371-i386/bin/ruby | |
require 'rubygems' | |
require 'rdf' | |
require 'rdf/ntriples' | |
include RDF | |
repository = RDF::Repository.load("http://rdf.rubyforge.org/doap.nt") | |
# reports correct predicate URI... | |
# DOAP.name: http://usefulinc.com/ns/doap#name |
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
<div id="committee-members"><table id="att4" style="display"> | |
<tbody><tr> | |
<td><input type="text" class="input-medium" id="committeeFirstName4" name="committeeFirstName4"></td> | |
<td><input type="text" class="span1" id="committeeMiddleInitial4" name="committeeMiddleInitial4"></td> | |
<td><input type="text" class="input-medium" id="committeeLastName4" name="committeeLastName4"></td> |
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
package controllers; | |
import play.*; | |
import play.mvc.*; | |
import play.mvc.Http.Header; | |
import java.util.*; | |
import java.util.Map.Entry; | |
import org.tdl.vireo.model.RoleType; |
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
package controllers; | |
import play.*; | |
import play.mvc.*; | |
import play.mvc.Http.Header; | |
import java.util.*; | |
import java.util.Map.Entry; | |
import org.tdl.vireo.model.RoleType; |
NewerOlder