Skip to content

Instantly share code, notes, and snippets.

View Oneplus's full-sized avatar
🕡
Working

Yijia Liu Oneplus

🕡
Working
View GitHub Profile
@Oneplus
Oneplus / Makefile
Last active August 29, 2015 14:16
map vs unordered_map vs boost::flat_map
all: benchmark
benchmark: main.cc
g++ -std=c++0x -O3 -o benchmark main.cc -lboost_timer -lboost_system
@Oneplus
Oneplus / Makefile
Last active August 29, 2015 14:11
combine boost searialization with google dense hash
all: test
test: main.cc
clang++ -O2 main.cc -o test -lboost_serialization -lboost_thread -lpthread
@Oneplus
Oneplus / constituent.py
Last active August 29, 2015 14:10
patch the nltk.tree.Tree
#!/usr/bin/env python
from nltk.tree import ParentedTree
class Constituent(ParentedTree):
def __init__(self, node, children=None):
self.head_word = None
self.start = None
self.end = None
super(Constituent, self).__init__(node, children)
@Oneplus
Oneplus / chunking.py
Last active July 14, 2022 10:11
A quick Python maxent implementation with sklearn
#!/usr/bin/env python
"""
A feature extractor for chunking.
Copyright 2010,2011 Naoaki Okazaki.
"""
# Separator of field values.
separator = ' '
@Oneplus
Oneplus / log.11
Last active August 29, 2015 14:01
Logs for mallet CRF
+ java -cp ./lib/mallet-deps.jar:class/ cc.mallet.fst.SimpleTagger --model-file /dev/null --training-proportion 1.0 --train true --test lab ./examples/train.txt ./examples/test.txt
Number of features in training data: 19155
Number of predicates: 21621
Labels: O B-NP B-PP I-NP B-VP I-VP B-SBAR B-ADJP B-ADVP I-ADVP I-ADJP I-SBAR I-PP B-PRT B-LST B-INTJ I-INTJ B-CONJP I-CONJP I-PRT B-UCP I-UCP I-LST
Preparing O
O->O(O) O,O
O->B-NP(B-NP) O,B-NP
O->B-PP(B-PP) O,B-PP
O->I-NP(I-NP) O,I-NP
O->B-VP(B-VP) O,B-VP