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 Tkinter import * | |
root = Tk() | |
canvas = Canvas(root, width=400, height=200) | |
canvas.pack() | |
canvas.create_oval(10, 10, 110, 60, fill="grey") | |
canvas.create_text(60, 35, text="Oval") | |
canvas.create_rectangle(10, 100, 110, 150, outline="blue") | |
canvas.create_text(60, 125, text="Rectangle") | |
canvas.create_line(60, 60, 60, 100, width=3) |
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
{0: {'id': '01440764-n', | |
'label': 'tench, Tinca tinca', | |
'uri': 'http://wordnet-rdf.princeton.edu/wn30/01440764-n'}, | |
1: {'id': '01443537-n', | |
'label': 'goldfish, Carassius auratus', | |
'uri': 'http://wordnet-rdf.princeton.edu/wn30/01443537-n'}, | |
2: {'id': '01484850-n', | |
'label': 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias', | |
'uri': 'http://wordnet-rdf.princeton.edu/wn30/01484850-n'}, | |
3: {'id': '01491361-n', |
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 | |
from itertools import * | |
from pylab import * | |
from nltk.corpus import brown | |
from string import lower | |
from collections import Counter | |
# The data: token counts from the Brown corpus | |
tokens_with_count = Counter(imap(lower, brown.words())) |
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
"""Federated queries with Virtuoso.""" | |
import sys | |
from SPARQLWrapper import SPARQLWrapper, JSON | |
QUERY_WIKIDATA = """ | |
PREFIX wd: <http://www.wikidata.org/entity/> |
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
documents = [ dict( | |
email=open("conference/%d.txt" % n).read().strip(), | |
category='conference') for n in range(1,372) ] | |
documents.extend([ dict( | |
email=open("job/%d.txt" % n).read().strip(), | |
category='job') for n in range(1,275)]) | |
documents.extend([ dict( | |
email=open("spam/%d.txt" % n).read().strip(), | |
category='spam') for n in range(1,799) ]) |
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/env python | |
""" | |
Usage: | |
url_to_sentence_collector_sentences <url> | |
Description: | |
https://commonvoice.mozilla.org/sentence-collector/#/how-to | |
""" | |
from docopt import docopt |
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 | |
# | |
# (originally entered at https://gist.github.com/1035399) | |
# | |
# License: GPLv3 | |
# | |
# To download the AFINN word list do: | |
# wget http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/6010/zip/imm6010.zip | |
# unzip imm6010.zip | |
# |
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 shelve | |
import multiprocessing | |
import os | |
filename = "tmp.shelve" | |
N = 4 | |
end = 10000 | |
def insert((offset, jump, end, filename)): |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# $Id: Nielsen2012Python_case.py,v 1.2 2012/09/02 16:55:25 fn Exp $ | |
# Define a url as a Python string (note we are only getting 100 documents) | |
url = "http://wikilit.referata.com/" + \ | |
"wiki/Special:Ask/" + \ | |
"-5B-5BCategory:Publications-5D-5D/" + \ | |
"-3FHas-20author%3DAuthor(s)/-3FYear/" + \ | |
"-3FPublished-20in/-3FAbstract/-3FHas-20topic%3DTopic(s)/" + \ | |
"-3FHas-20domain%3DDomain(s)/" + \ | |
"format%3D-20csv/limit%3D-20100/offset%3D0" |
NewerOlder