Skip to content

Instantly share code, notes, and snippets.

View fnielsen's full-sized avatar

Finn Årup Nielsen fnielsen

View GitHub Profile
#!//usr/bin/env python
"""
Usage:
url_to_sentence_collector_sentences <url>
Description:
https://commonvoice.mozilla.org/sentence-collector/#/how-to
"""
from docopt import docopt
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fnielsen
fnielsen / Combining embedding methods for a word intrusion task.ipynb
Last active March 22, 2019 19:52
Jupyter notebook for a small study on embedding methods on a Danish word intrusion task
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""
Usage:
Nielsen2017Linking_camera.py
Notes
-----
This script demonstrates the use of Wikidata together with
ImageNet-based deep learning classifiers. It relates to the manuscript
"Linking ImageNet WordNet Synsets with Wikidata" from 2018.
@fnielsen
fnielsen / imagenet_label_to_wordnet_synset.txt
Created August 23, 2017 12:44
ImageNet label to wordnet synset identifier
{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',
@fnielsen
fnielsen / Federated queries with Virtuoso.py
Created May 10, 2017 12:11
Federated queries with Virtuoso
"""Federated queries with Virtuoso."""
import sys
from SPARQLWrapper import SPARQLWrapper, JSON
QUERY_WIKIDATA = """
PREFIX wd: <http://www.wikidata.org/entity/>
@fnielsen
fnielsen / mixedindexing.py
Last active November 16, 2019 04:00
Mixed indexing with integer index in Pandas DataFrame
import pandas as pd
df = pd.DataFrame([[1, 2, 's'], [3, 4, 't'], [4, 5, 'u']],
index=[-1, 0, 1], columns=['a', 'b', 'c'])
>>> df.a # Correct type
-1 1
0 3
1 4
Name: a, dtype: int64
@fnielsen
fnielsen / Nielsen2015Python_metrojet9268.ipynb
Created November 3, 2015 19:10
Plotting of Metrojet 9268 Extended Mode-S Data Decoded
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fnielsen
fnielsen / fftprimeproblem.py
Created May 7, 2015 18:42
FFT prime problem
# https://github.com/fnielsen/everything
from everything import *
import pyfftw.interfaces.scipy_fftpack
def is_prime(n):
"""https://stackoverflow.com/questions/18833759/"""
if n % 2 == 0 and n > 2:
return False