Skip to content

Instantly share code, notes, and snippets.

Jörn Hees joernhees

Block or report user

Report or block joernhees

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@joernhees
joernhees / dbpedia.jsonl
Created Nov 19, 2016
DBpedia JSON Extractor
View dbpedia.jsonl
{"comment": "Kaiserslautern ([\u02ccka\u026az\u0250s\u02c8la\u028at\u0250n]) is a city in southwest Germany, located in the Bundesland (State) of Rhineland-Palatinate (Rheinland-Pfalz) at the edge of the Palatinate Forest (Pf\u00e4lzerwald). The historic centre dates to the 9th century. It is 459 kilometres (285 miles) from Paris, 117 km (73 miles) from Frankfurt am Main, and 159 km (99 miles) from Luxembourg.", "pic": "http://commons.wikimedia.org/wiki/Special:FilePath/Kaiserslautern-Stadtwappen.svg", "uri": "http://dbpedia.org/resource/Kaiserslautern", "label": "Kaiserslautern", "areaTotal": "1.3972e+08", "types": ["http://www.w3.org/2002/07/owl#Thing", "http://www.wikidata.org/entity/Q3957", "http://www.wikidata.org/entity/Q486972", "http://dbpedia.org/ontology/PopulatedPlace", "http://dbpedia.org/ontology/Settlement", "http://dbpedia.org/ontology/Town", "http://www.w3.org/2003/01/geo/wgs84_pos#SpatialThing", "http://schema.org/Place", "http://dbpedia.org/ontology/Place", "http://dbpedia.org/ontology/Locat
@joernhees
joernhees / rdflib_hashing.py
Created Jul 21, 2015
rdflib hashing test
View rdflib_hashing.py
from multiprocessing import Process, Manager, Lock
import random
def f(d):
from rdflib import URIRef
for i in random.sample(range(1000), 1000):
k = URIRef('foo'+str(i))
with l:
if k not in d:
@joernhees
joernhees / recallPrecision.py
Created Oct 28, 2014
plot recall precision diagrams with f-measure height lines
View recallPrecision.py
# -*- coding: utf-8 -*-
"""
Script to plot recall-precision values with f-measure equi-potential lines.
Created on Dec 16, 2009
@author: Jörn Hees
"""
import scipy as sc
View scipy_arpack_tests_fail.log
$ ipython
Python 2.7.5 (default, Jun 8 2013, 00:27:06)
Type "copyright", "credits" or "license" for more information.
IPython 0.13.2 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
View SPARQLChain.py
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
'''
Created on 21.03.2013
@author: joern
'''
import sys, os
import json, csv
@joernhees
joernhees / gist:2955006
Created Jun 19, 2012
github howto reconfigure git repository if cloned original and forked later
View gist:2955006
# so let's say you cloned repo someone/project like this
git clone git://github.com/someone/project.git
# you use it and then later on discover a bug.
# to fix it you create a fork on github to which you can
# write and issue a pull request, but now your origin is
# someone/project instead of you/project .
# fix it like this:
git remote rename origin upstream
@joernhees
joernhees / sigCooccs.py
Created Mar 19, 2012
small script which calculates the significance of term co-occurrences in a document corpus
View sigCooccs.py
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
"""
Created on Mar 19, 2012
@author: Joern Hees
"""
import scipy
from scipy.stats import poisson
@joernhees
joernhees / sparqlwrapperResToRDFlib.py
Created Nov 5, 2010
converts a result's bindings to their corresponding rdflib terms, e.g. URIref, Literal, BNode
View sparqlwrapperResToRDFlib.py
# -*- coding: utf-8 -*-
'''
Created on Oct 30, 2010
@author: joern
'''
import rdflib
def sparqlJSONresultBindingsToRDFlib(resBindings):
""" Converts a result's bindings as retrieved in res["results"]["bindings"]
You can’t perform that action at this time.