Skip to content

Instantly share code, notes, and snippets.

View hankcs's full-sized avatar
🐼
Dark circles everyday

hankcs

🐼
Dark circles everyday
View GitHub Profile
"""
Holds the stub data (concerning the smcalflow application) to test the system.
"""
from collections import namedtuple
from datetime import timedelta
from opendf.defs import get_system_date
CURRENT_RECIPIENT_ID = 1007
@hankcs
hankcs / test.ipynb
Last active March 24, 2022 17:04
test_jupyter
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/bin/bash
function usage {
cat <<EOF
----------------------------------------------------------------------------------------------------
Usage:
-----
@hankcs
hankcs / skeleton2conll.sh
Last active November 26, 2020 22:36
Patch conll12 script to support single language conversion
#!/bin/bash
function usage {
cat <<EOF
----------------------------------------------------------------------------------------------------
Usage:
-----
@hankcs
hankcs / ontonotes_to_conll.sh
Last active August 17, 2022 10:41
This script downloads and compiles the Ontonotes 2012 data into conll format. Modified from https://github.com/allenai/allennlp/blob/c4c532d25e012dbe6ab1ac14bca75e53e0acc621/scripts/compile_coref_data.sh
#!/bin/bash
# This script downloads and compiles the Ontonotes 2012 data in a helpful format
# for co-reference resolution. It generates 3 files: {train, dev, test}.english.v4_gold_conll,
# as well as a directory 'conll-2012' which contains the raw extracted data.
# The script downloads and runs some python scripts which require python 2.X.
ONTONOTES_PATH=$1
LANGUAGE=$2
@hankcs
hankcs / compile_coref_data.sh
Created July 10, 2020 01:04
CoNLL Ontonotes 2012 data preprocessing, adopted from AllenNLP
#!/bin/bash
# This script downloads and compiles the Ontonotes 2012 data in a helpful format
# for co-reference resolution. It generates 3 files: {train, dev, test}.english.v4_gold_conll,
# as well as a directory 'conll-2012' which contains the raw extracted data.
# The script downloads and runs some python scripts which require python 2.X.
ONTONOTES_PATH=$1
if [ ! -n "$ONTONOTES_PATH" ] ; then
@hankcs
hankcs / restore_collapse_edges.py
Created May 6, 2020 16:02
Script to restore empty nodes for IWPT 2020
# -*- coding:utf-8 -*-
def load_conll_to_str(path):
"""
Load a conll file to a list of strings, each string represents a sentence in conll format
:rtype: list
"""
with open(path) as src:
text = src.read()
@hankcs
hankcs / OOV.py
Created November 23, 2017 03:26
OOV recognition trick in convseg
# -*- coding:utf-8 -*-
# Filename: OOV.py
# Author:hankcs
# Date: 2017-11-21 17:51
def load_words(path, dict):
with open(path) as src:
for line in src:
dict.update(line.split())
cmake -DCMAKE_BUILD_TYPE=RELEASE ..
make
@hankcs
hankcs / iso2usb.sh
Last active May 6, 2016 22:20
Bootable ISO to USB disk for Mac OSX
#!/bin/bash
##
# AUTHOR: Andy Savage <andy@savage.hk>
# GITHUB: www.github.com/hongkongkiwi
# DESCRIPTION: This script is for converting ISO files and burning them to a USB drive
##
HELP="USAGE: iso2usb blah.iso /dev/disk#"