Skip to content

Instantly share code, notes, and snippets.

View kilian-gebhardt's full-sized avatar

Kilian Gebhardt kilian-gebhardt

View GitHub Profile
### Keybase proof
I hereby claim:
* I am kilian-gebhardt on github.
* I am kiliangebhardt (https://keybase.io/kiliangebhardt) on keybase.
* I have a public key whose fingerprint is 469C 4086 09DE E64B 7FA2 5E6B 5997 9FB6 5043 87BD
To claim this, I am signing this object:
@kilian-gebhardt
kilian-gebhardt / MinMaxHeap.py
Last active May 19, 2024 11:55
Min-max heap in Python
class MinMaxHeap(object):
"""
Implementation of a Min-max heap following Atkinson, Sack, Santoro, and
Strothotte (1986): https://doi.org/10.1145/6617.6621
"""
def __init__(self, reserve=0):
self.a = [None] * reserve
self.size = 0
def __len__(self):
#ifndef MINMAXHEAP_H
#define MINMAXHEAP_H
#include <vector>
#include <stdint.h>
// see https://stackoverflow.com/a/24748637
inline int uint64_log2(uint64_t n)
{
#define S(k) if (n >= (UINT64_C(1) << k)) { i += k; n >>= k; }
@kilian-gebhardt
kilian-gebhardt / ingestion_helper.py
Last active May 11, 2019 16:24
script for ingestion of LREC 2016
#!/bin/python3
import bibtexparser
import subprocess
import sys, os
OUTPUT_ROOT = sys.argv[1]
ACL = "anthology/L/L16"
OUTPUT_DIR = os.path.join(OUTPUT_ROOT, ACL)
try:
@kilian-gebhardt
kilian-gebhardt / ingest_IWPT_1989.py
Created June 24, 2019 15:44
Automate the creation of IWPT 1989 proceedings and metadata
#!/bin/python
import re
import subprocess
MATCHLINE = re.compile(r'^(</li>)?<li>(.*)[,.].*\.\s+(.*)\; p\. ([0-9]+)-([0-9]+)\.$')
counter = 0
ID='W89-01%02i'
@kilian-gebhardt
kilian-gebhardt / sigf.py
Created October 15, 2019 10:18 — forked from dustalov/sigf.py
An implementation of the sigf toolkit for randomization tests in Python 3
#!/usr/bin/env python
# This is an MIT-licensed implementation of the sigf toolkit
# for randomization tests: https://nlpado.de/~sebastian/software/sigf.shtml
from random import getrandbits
import sys
def randomized_test(model1, model2, score, trials):
print('# score(model1) = %f' % score(model1), file=sys.stderr)
#!/usr/bin/env python3
"""
Takes a conference TSV file and, optionally, a conference metadata
file, and creates the Anthology XML in the ACL Anthology repository.o
This file can then be added to the repo and committed.
Example usage:
- First, fork [the ACL Anthology](https://github.com/acl-org/acl-anthology) to your Github account, and clone it to your drive
- Grab one of the [conference TSV files](https://drive.google.com/drive/u/0/folders/1hC7FDlsXWVM2HSYgdluz01yotdEd0zW8)