From 1e9a329c8b38c6551bbe4a72028d9500be914e07 Mon Sep 17 00:00:00 2001
From: Patrick Simianer
Date: Mon, 23 Mar 2015 11:01:11 +0100
Subject: updated examples
---
example/1020/cdec.json.gz | Bin 5379230 -> 0 bytes
example/1020/weaver.pak | Bin 15604656 -> 0 bytes
example/1391/cdec.json.gz | Bin 1226399 -> 0 bytes
example/1391/weaver.pak | Bin 3352772 -> 0 bytes
example/1495/cdec.json.gz | Bin 4186 -> 0 bytes
example/1495/weaver.pak | Bin 22670 -> 0 bytes
example/1570/cdec.json.gz | Bin 1802121 -> 0 bytes
example/1570/weaver.pak | Bin 5388695 -> 0 bytes
example/1889/cdec.json.gz | Bin 45579 -> 0 bytes
example/1889/weaver.pak | Bin 227174 -> 0 bytes
example/2002/cdec.json.gz | Bin 200453 -> 0 bytes
example/2002/weaver.pak | Bin 738937 -> 0 bytes
example/3/cdec.json.gz | Bin 327386 -> 0 bytes
example/3/in.sgm | 1 -
example/3/weaver.pak | Bin 998508 -> 0 bytes
example/429/cdec.json.gz | Bin 385743 -> 0 bytes
example/429/weaver.pak | Bin 1228069 -> 0 bytes
example/748/cdec.json.gz | Bin 648 -> 0 bytes
example/748/weaver.pak | Bin 431 -> 0 bytes
example/cdec/cdec2json.py | 93 +++++++++++++++++++++++
example/cdec/default.ini | 2 +-
example/cdec/passthrough.ini | 2 +-
example/cdec2json.py | 100 -------------------------
example/glue/in.sgm | 1 -
example/run | 172 +++++++++++++++++++++++++++++--------------
example/toy/in-test.sgm | 1 -
example/toy/in.sgm | 1 -
example/toy/toy.json | 28 +++++++
example/toy/weights | 3 -
example/toy/weights.toy | 3 +
30 files changed, 243 insertions(+), 164 deletions(-)
delete mode 100644 example/1020/cdec.json.gz
delete mode 100644 example/1020/weaver.pak
delete mode 100644 example/1391/cdec.json.gz
delete mode 100644 example/1391/weaver.pak
delete mode 100644 example/1495/cdec.json.gz
delete mode 100644 example/1495/weaver.pak
delete mode 100644 example/1570/cdec.json.gz
delete mode 100644 example/1570/weaver.pak
delete mode 100644 example/1889/cdec.json.gz
delete mode 100644 example/1889/weaver.pak
delete mode 100644 example/2002/cdec.json.gz
delete mode 100644 example/2002/weaver.pak
delete mode 100644 example/3/cdec.json.gz
delete mode 100644 example/3/in.sgm
delete mode 100644 example/3/weaver.pak
delete mode 100644 example/429/cdec.json.gz
delete mode 100644 example/429/weaver.pak
delete mode 100644 example/748/cdec.json.gz
delete mode 100644 example/748/weaver.pak
create mode 100755 example/cdec/cdec2json.py
delete mode 100755 example/cdec2json.py
delete mode 100644 example/glue/in.sgm
delete mode 100644 example/toy/in-test.sgm
delete mode 100644 example/toy/in.sgm
create mode 100644 example/toy/toy.json
delete mode 100644 example/toy/weights
create mode 100644 example/toy/weights.toy
diff --git a/example/1020/cdec.json.gz b/example/1020/cdec.json.gz
deleted file mode 100644
index e3ff24f..0000000
Binary files a/example/1020/cdec.json.gz and /dev/null differ
diff --git a/example/1020/weaver.pak b/example/1020/weaver.pak
deleted file mode 100644
index 5b33440..0000000
Binary files a/example/1020/weaver.pak and /dev/null differ
diff --git a/example/1391/cdec.json.gz b/example/1391/cdec.json.gz
deleted file mode 100644
index 824bfc8..0000000
Binary files a/example/1391/cdec.json.gz and /dev/null differ
diff --git a/example/1391/weaver.pak b/example/1391/weaver.pak
deleted file mode 100644
index cc24919..0000000
Binary files a/example/1391/weaver.pak and /dev/null differ
diff --git a/example/1495/cdec.json.gz b/example/1495/cdec.json.gz
deleted file mode 100644
index ac0f3da..0000000
Binary files a/example/1495/cdec.json.gz and /dev/null differ
diff --git a/example/1495/weaver.pak b/example/1495/weaver.pak
deleted file mode 100644
index 8307d51..0000000
Binary files a/example/1495/weaver.pak and /dev/null differ
diff --git a/example/1570/cdec.json.gz b/example/1570/cdec.json.gz
deleted file mode 100644
index 4fa5096..0000000
Binary files a/example/1570/cdec.json.gz and /dev/null differ
diff --git a/example/1570/weaver.pak b/example/1570/weaver.pak
deleted file mode 100644
index f337dd2..0000000
Binary files a/example/1570/weaver.pak and /dev/null differ
diff --git a/example/1889/cdec.json.gz b/example/1889/cdec.json.gz
deleted file mode 100644
index 74b6f3e..0000000
Binary files a/example/1889/cdec.json.gz and /dev/null differ
diff --git a/example/1889/weaver.pak b/example/1889/weaver.pak
deleted file mode 100644
index b62bc80..0000000
Binary files a/example/1889/weaver.pak and /dev/null differ
diff --git a/example/2002/cdec.json.gz b/example/2002/cdec.json.gz
deleted file mode 100644
index 6ca177d..0000000
Binary files a/example/2002/cdec.json.gz and /dev/null differ
diff --git a/example/2002/weaver.pak b/example/2002/weaver.pak
deleted file mode 100644
index 9b2fccd..0000000
Binary files a/example/2002/weaver.pak and /dev/null differ
diff --git a/example/3/cdec.json.gz b/example/3/cdec.json.gz
deleted file mode 100644
index 6049a2c..0000000
Binary files a/example/3/cdec.json.gz and /dev/null differ
diff --git a/example/3/in.sgm b/example/3/in.sgm
deleted file mode 100644
index a609b54..0000000
--- a/example/3/in.sgm
+++ /dev/null
@@ -1 +0,0 @@
-offizielle prognosen sind von nur 3 prozent ausgegangen , meldete bloomberg .
diff --git a/example/3/weaver.pak b/example/3/weaver.pak
deleted file mode 100644
index 8d93900..0000000
Binary files a/example/3/weaver.pak and /dev/null differ
diff --git a/example/429/cdec.json.gz b/example/429/cdec.json.gz
deleted file mode 100644
index a5fe5ad..0000000
Binary files a/example/429/cdec.json.gz and /dev/null differ
diff --git a/example/429/weaver.pak b/example/429/weaver.pak
deleted file mode 100644
index ba00865..0000000
Binary files a/example/429/weaver.pak and /dev/null differ
diff --git a/example/748/cdec.json.gz b/example/748/cdec.json.gz
deleted file mode 100644
index ca169b3..0000000
Binary files a/example/748/cdec.json.gz and /dev/null differ
diff --git a/example/748/weaver.pak b/example/748/weaver.pak
deleted file mode 100644
index 26276f5..0000000
Binary files a/example/748/weaver.pak and /dev/null differ
diff --git a/example/cdec/cdec2json.py b/example/cdec/cdec2json.py
new file mode 100755
index 0000000..66bc8b4
--- /dev/null
+++ b/example/cdec/cdec2json.py
@@ -0,0 +1,93 @@
+#!/usr/bin/env python2
+
+import cdec
+import sys, argparse
+import json, gzip
+
+def hg2json(hg, weights):
+ """
+ hackishly output a JSON representation of a cdec hypegraph
+
+ TODO: cdec now uses boost's serialization instead of JSON
+ (github repo @b88176dc4fd53480e77d601ff63bf5300cf8fc7f
+ still uses the old format)
+ """
+ res = ''
+ res += "{\n"
+ # rules
+ res += '"rules":[\n'
+ rules = []
+ for i in hg.edges:
+ s = json.dumps(str(i.trule))
+ try:
+ rules.index(s)
+ except:
+ rules.append(s)
+ res += ",\n".join(rules)
+ res += "\n],\n"
+ # nodes
+ res += '"nodes":'+"\n"
+ res += "[\n"
+ a = []
+ a.append('{ "id":0, "symbol":"root", "span":[-1,-1] }')
+ for i in hg.nodes:
+ a.append('{ "id":%d, "symbol":"%s", "span":[%d,%d] }'%(i.id+1, i.cat, i.span[0], i.span[1]))
+ res += ",\n".join(a)+"\n"
+ res += "],\n"
+ # edges
+ res += '"edges":'+"\n"
+ res += "[\n"
+ a = []
+ for i in hg.edges:
+ s = "{"
+ s += '"head":%d'%(i.head_node.id+1)
+ s += ', "rule":%s'%(rules.index(json.dumps(str(i.trule))))
+ # tails
+ if len(list(i.tail_nodes)) > 0:
+ s += ', "tails":[ %s ],'%(",".join([str(n.id+1) for n in i.tail_nodes]))
+ else:
+ s += ', "tails":[ 0 ],'
+ s += ' "score":%s }'%(i.prob)
+ a.append(s)
+ res += ",\n".join(a)+"\n"
+ res += "]\n"
+ res += "}\n"
+ return res
+
+def main():
+ parser = argparse.ArgumentParser(description='get a nice json representation of cdec hypergraphs')
+ parser.add_argument('-c', '--config', required=True, help='decoder configuration')
+ parser.add_argument('-w', '--weights', required=True, help='feature weights')
+ parser.add_argument('-g', '--grammar', required=False, help='grammar')
+ args = parser.parse_args()
+ with open(args.config) as config:
+ config = config.read()
+ decoder = cdec.Decoder(config)
+ decoder.read_weights(args.weights)
+ ins = sys.stdin.readline().strip()
+ if args.grammar:
+ if args.grammar.split('.')[-1] == 'gz':
+ with gzip.open(args.grammar) as grammar:
+ grammar = grammar.read()
+ else:
+ with open(args.grammar) as grammar:
+ grammar = grammar.read()
+ hg = decoder.translate(ins, grammar=grammar)
+ else:
+ hg = decoder.translate(ins)
+
+ sys.stderr.write("input:\n '%s'\n"%(ins))
+ sys.stderr.write("viterbi translation:\n '%s'\n"%(hg.viterbi()))
+ num_nodes = 0
+ for i in hg.nodes: num_nodes+=1
+ sys.stderr.write("# nodes = %s\n"%(num_nodes))
+ num_edges = 0
+ for i in hg.edges: num_edges+=1
+ sys.stderr.write("# edges = %s\n"%(num_edges))
+ sys.stderr.write("viterbi score = %s\n"%(round(hg.viterbi_features().dot(decoder.weights), 2)))
+
+ print hg2json(hg, decoder.weights).encode('utf-8')
+
+if __name__=="__main__":
+ main()
+
diff --git a/example/cdec/default.ini b/example/cdec/default.ini
index 10ea512..8174118 100644
--- a/example/cdec/default.ini
+++ b/example/cdec/default.ini
@@ -1,3 +1,3 @@
formalism=scfg
intersection_strategy=full
-scfg_max_span_limit=999999999
+scfg_max_span_limit=2147483647 # std::numeric_limits::max() on my machine
diff --git a/example/cdec/passthrough.ini b/example/cdec/passthrough.ini
index d9280ad..15ed4b6 100644
--- a/example/cdec/passthrough.ini
+++ b/example/cdec/passthrough.ini
@@ -1,4 +1,4 @@
formalism=scfg
intersection_strategy=full
-scfg_max_span_limit=999999999
+scfg_max_span_limit=2147483647 # std::numeric_limits::max() on my machine
add_pass_through_rules=true
diff --git a/example/cdec2json.py b/example/cdec2json.py
deleted file mode 100755
index cd2a846..0000000
--- a/example/cdec2json.py
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/usr/bin/env python2
-
-import cdec
-import sys, argparse
-import json
-import gzip
-
-
-#FIXME new format
-# strings?
-# map?
-def hg2json(hg, weights):
- """
- output a JSON representation of a cdec hypegraph
- """
- res = ''
- res += "{\n"
- res += '"rules":[\n'
- rules = []
- for i in hg.edges:
- s = json.dumps(str(i.trule))
- try:
- rules.index(s)
- except:
- rules.append(s)
- res += ",\n".join(rules)
- res += "\n],\n"
- res += '"nodes":'+"\n"
- res += "[\n"
- a = []
- a.append( '{ "id":0, "symbol":"root", "span":[-1,-1] }' )
- for i in hg.nodes:
- a.append('{ "id":%d, "symbol":"%s", "span":[%d,%d] }'%(i.id+1, i.cat, i.span[0], i.span[1]))
- res += ",\n".join(a)+"\n"
- res += "],\n"
- res += '"edges":'+"\n"
- res += "[\n"
- a = []
- for i in hg.edges:
- s = "{"
- s += '"head":%d'%(i.head_node.id+1)
- s += ', "rule":%s'%(rules.index(json.dumps(str(i.trule))))
- # f
- #xs = ' "f":{'
- #b = []
- #for j in i.feature_values:
- # b.append( '"%s":%s'%(j[0], j[1]) )
- #xs += ", ".join(b)
- #xs += "},"
- # tails
- if len(list(i.tail_nodes)) > 0:
- s += ', "tails":[ %s ],'%(",".join([str(n.id+1) for n in i.tail_nodes]))
- else:
- s += ', "tails":[ 0 ],'
- #s += xs
- s += ' "score":%s }'%(i.prob)
- a.append(s)
- res += ",\n".join(a)+"\n"
- res += "]\n"
- res += "}\n"
- return res
-
-def main():
- parser = argparse.ArgumentParser(description='get a proper json representation of cdec hypergraphs')
- parser.add_argument('-c', '--config', required=True, help='decoder configuration')
- parser.add_argument('-w', '--weights', required=True, help='feature weights')
- parser.add_argument('-g', '--grammar', required=False, help='grammar')
- args = parser.parse_args()
- with open(args.config) as config:
- config = config.read()
- decoder = cdec.Decoder(config)
- decoder.read_weights(args.weights)
- ins = sys.stdin.readline().strip()
- if args.grammar:
- if args.grammar.split('.')[-1] == 'gz':
- with gzip.open(args.grammar) as grammar:
- grammar = grammar.read()
- else:
- with open(args.grammar) as grammar:
- grammar = grammar.read()
- hg = decoder.translate(ins, grammar=grammar)
- else:
- hg = decoder.translate(ins)
-
- sys.stderr.write( "input:\n '%s'\n"%(ins) )
- sys.stderr.write( "viterbi translation:\n '%s'\n"%(hg.viterbi()) )
- num_nodes = 0
- for i in hg.nodes: num_nodes+=1
- sys.stderr.write( "# nodes = %s\n"%(num_nodes) )
- num_edges = 0
- for i in hg.edges: num_edges+=1
- sys.stderr.write( "# edges = %s\n"%(num_edges) )
- sys.stderr.write( "viterbi score = %s\n"%(round(hg.viterbi_features().dot(decoder.weights), 2)) )
-
- print hg2json(hg, decoder.weights)
-
-
-if __name__=="__main__":
- main()
-
diff --git a/example/glue/in.sgm b/example/glue/in.sgm
deleted file mode 100644
index 2f1a89b..0000000
--- a/example/glue/in.sgm
+++ /dev/null
@@ -1 +0,0 @@
-lebensmittel schuld an europäischer inflation
diff --git a/example/run b/example/run
index 4440634..5149115 100755
--- a/example/run
+++ b/example/run
@@ -1,65 +1,127 @@
#!/bin/zsh -x
-CDEC_BIN=~/src/cdec-dtrain/decoder/cdec
-CDEC_MINIMAL_BIN=~/src/cdec-dtrain/decoder/minimal_decoder
-WEAVER_PROTOTYPE_BIN=../prototype/weaver.rb
-FAST_WEAVER_BIN=../fast_weaver
+ CDEC=~/src/cdec_json_serialization/decoder/cdec
+ CDEC_MINIMAL=~/src/cdec_json_serialization/decoder/minimal_decoder
+WEAVER_PROTOTYPE=../prototype/weaver_proto.rb
+ FAST_WEAVER=../bin/fast_weaver
+ CDEC2JSON=./cdec/cdec2json.py
+ MAKE_PAK=../bin/make_pak
+# 1020 \
for example in \
+ 1391 \
+ 1495 \
+ 1570 \
+ 1889 \
+ 2002 \
3 \
+ 429 \
+ 748 \
; do
-mkdir -p $example/output
-
-$CDEC_BIN -c cdec/default.ini -w weights/weights -n \
- -g $example/grammar < $example/in \
- > $example/output/cdec.nothing.out \
- 2>$example/output/cdec.nothing.err
-$CDEC_BIN -c cdec/default.ini -w weights/weights \
- -g $example/grammar < $example/in \
- > $example/output/cdec.glue.out \
- 2>$example/output/cdec.glue.err
-$CDEC_BIN -c cdec/passthrough.ini -w weights/weights -n \
- -g $example/grammar < $example/in \
- > $example/output/cdec.passthrough.out \
- 2>$example/output/cdec.passthrough.err
-$CDEC_BIN -c cdec/default.ini -w weights/weights \
- -g $example/grammar < $example/in \
- > $example/output/cdec.default.out \
- 2>$example/output/cdec.default.err
-$CDEC_BIN -c cdec/default.ini -w weights/weights.0 \
- -g $example/grammar < $example/in \
- > $example/output/cdec.default-0.out \
- 2>$example/output/cdec.default-0.err
-
-$CDEC_MINIMAL_BIN $example/cdec.json.gz weights/weights \
- > $example/output/cdec-minimal.out \
- 2>$example/output/cdec-minimal.err
-$CDEC_MINIMAL_BIN $example/cdec.json.gz weights/weights.0 \
- > $example/output/cdec-minimal.0.out \
- 2>$example/output/cdec-minimal.0.err
-
-$FAST_WEAVER_BIN $example/weaver.pak \
- > $example/output/fast_weaver.out \
- 2>$example/output/fast_weaver.err
-
-$WEAVER_PROTOTYPE_BIN -w weights/weights -g $example/grammar -i $example/in \
- > $example/output/weaver-prototype.nothing.out \
- 2>$example/output/weaver-prototype.nothing.err
-$WEAVER_PROTOTYPE_BIN -w weights/weights -g $example/grammar -i $example/in -l \
- > $example/output/weaver-prototype.glue.out \
- 2>$example/output/weaver-prototype.glue.err
-$WEAVER_PROTOTYPE_BIN -w weights/weights -g $example/grammar -i $example/in -p \
- > $example/output/weaver-prototype.passthrough.out \
- 2>$example/output/weaver-prototype.passthrough.err
-$WEAVER_PROTOTYPE_BIN -w weights/weights -g $example/grammar -i $example/in \
- -l -p \
- > $example/output/weaver-prototype.default.out \
- 2>$example/output/weaver-prototype.default.err
-$WEAVER_PROTOTYPE_BIN -w weights/weights.0 -g $example/grammar -i $example/in \
- -l -p \
- > $example/output/weaver-prototype.default-0.out \
- 2>$example/output/weaver-prototype.default-0.err
+OUT_DIR=$example/output
+mkdir -p $OUT_DIR
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# cdec
+#
+$CDEC \
+ -c cdec/default.ini \
+ -w weights/weights \
+ -g $example/grammar \
+ -O $OUT_DIR \
+ < $example/in \
+ > $OUT_DIR/cdec.out \
+ 2>$OUT_DIR/cdec.err
+mv $OUT_DIR/0.json.gz $OUT_DIR/cdec.json.gz
+
+# +passthrough
+$CDEC \
+ -c cdec/passthrough.ini \
+ -w weights/weights \
+ -g $example/grammar \
+ -O $OUT_DIR \
+ < $example/in \
+ > $OUT_DIR/cdec.passthrough.out \
+ 2>$OUT_DIR/cdec.passthrough.err
+mv $OUT_DIR/0.json.gz $OUT_DIR/cdec.passthrough.json.gz
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# cdec2json
+#
+$CDEC2JSON \
+ -c cdec/default.ini \
+ -w weights/weights \
+ -g $example/grammar \
+ < $example/in \
+ > $OUT_DIR/cdec2json.json \
+ 2>$OUT_DIR/cdec2json.err
+
+# +passthrough
+$CDEC2JSON \
+ -c cdec/passthrough.ini \
+ -w weights/weights \
+ -g $example/grammar \
+ < $example/in \
+ > $OUT_DIR/cdec2json.passthrough.json \
+ 2>$OUT_DIR/cdec2json.passthrough.err
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# cdec minimal_decoder
+#
+$CDEC_MINIMAL \
+ $OUT_DIR/cdec.json.gz \
+ weights/weights \
+ > $OUT_DIR/cdec_minimal.out \
+ 2>$OUT_DIR/cdec_minimal.err
+
+$CDEC_MINIMAL \
+ $OUT_DIR/cdec.passthrough.json.gz \
+ weights/weights \
+ > $OUT_DIR/cdec_minimal.passthrough.out \
+ 2>$OUT_DIR/cdec_minimal.passthrough.err
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# fast_weaver
+#
+# make pak files first
+$MAKE_PAK \
+ $OUT_DIR/cdec2json.json \
+ $OUT_DIR/weaver.pak
+$MAKE_PAK \
+ $OUT_DIR/cdec2json.passthrough.json \
+ $OUT_DIR/weaver.passthrough.pak
+
+$FAST_WEAVER \
+ $OUT_DIR/weaver.pak \
+ > $OUT_DIR/fast_weaver.out \
+ 2>$OUT_DIR/fast_weaver.err
+
+$FAST_WEAVER \
+ $OUT_DIR/weaver.passthrough.pak \
+ > $OUT_DIR/fast_weaver.passthrough.out \
+ 2>$OUT_DIR/fast_weaver.passthrough.err
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# weaver prototype
+#
+$WEAVER_PROTOTYPE \
+ -w weights/weights \
+ -g $example/grammar \
+ -i $example/in \
+ -l \
+ > $OUT_DIR/weaver_proto.out \
+ 2>$OUT_DIR/weaver_proto.err
+
+# +passthrough
+$WEAVER_PROTOTYPE \
+ -w weights/weights \
+ -g $example/grammar \
+ -i $example/in \
+ -l \
+ -p \
+ > $OUT_DIR/weaver_proto.passthrough.out \
+ 2>$OUT_DIR/weaver_proto.passthrough.err
done
diff --git a/example/toy/in-test.sgm b/example/toy/in-test.sgm
deleted file mode 100644
index a13f93c..0000000
--- a/example/toy/in-test.sgm
+++ /dev/null
@@ -1 +0,0 @@
-ich sah ein kleines haus
diff --git a/example/toy/in.sgm b/example/toy/in.sgm
deleted file mode 100644
index 561d346..0000000
--- a/example/toy/in.sgm
+++ /dev/null
@@ -1 +0,0 @@
-ich sah ein kleines haus
diff --git a/example/toy/toy.json b/example/toy/toy.json
new file mode 100644
index 0000000..c1b5c55
--- /dev/null
+++ b/example/toy/toy.json
@@ -0,0 +1,28 @@
+{
+"weights":{"logp":2.0,"use_house":0.0,"use_shell":1.0},
+"nodes":
+[
+{ "id":-1, "cat":"root", "span":[-1,-1] },
+{ "id":0, "cat":"NP", "span":[0,1] },
+{ "id":1, "cat":"V", "span":[1,2] },
+{ "id":2, "cat":"JJ", "span":[3,4] },
+{ "id":3, "cat":"NN", "span":[3,5] },
+{ "id":4, "cat":"NP", "span":[2,5] },
+{ "id":5, "cat":"VP", "span":[1,5] },
+{ "id":6, "cat":"S", "span":[0,5] }
+],
+"edges":
+[
+{ "head":0, "rule":"[NP] ||| ich ||| i", "tails":[-1], "f":{"logp":-0.5,"use_i":1.0} },
+{ "head":1, "rule":"[V] ||| sah ||| saw", "tails":[-1], "f":{"logp":-0.25,"use_saw":1.0} },
+{ "head":2, "rule":"[JJ] ||| kleines ||| small", "tails":[-1], "f":{"logp":0.0,"use_small":1.0} },
+{ "head":2, "rule":"[JJ] ||| kleines ||| little", "tails":[-1], "f":{"logp":0.0,"use_little":1.0} },
+{ "head":3, "rule":"[NN] ||| kleines haus ||| small house", "tails":[-1], "f":{"logp":0.0,"use_house":1.0} },
+{ "head":3, "rule":"[NN] ||| kleines haus ||| little house", "tails":[-1], "f":{"logp":0.0,"use_house":1.0} },
+{ "head":3, "rule":"[NN] ||| [JJ,1] haus ||| [JJ,1] shell", "tails":[2], "f":{"logp":0.0,"use_shell":1.0} },
+{ "head":3, "rule":"[NN] ||| [JJ,1] haus ||| [JJ,1] house", "tails":[2], "f":{"logp":0.0,"use_house":1.0} },
+{ "head":4, "rule":"[NP] ||| ein [NN,1] ||| a [NN,1]", "tails":[3], "f":{"logp":0.0,"use_a":1.0} },
+{ "head":5, "rule":"[VP] ||| [V,1] [NP,2] ||| [V,1] [NP,2]", "tails":[1, 4], "f":{"logp":0.0} },
+{ "head":6, "rule":"[S] ||| [NP,1] [VP,2] ||| [NP,1] [VP,2]", "tails":[0, 5], "f":{"logp":0.0} }
+]
+}
diff --git a/example/toy/weights b/example/toy/weights
deleted file mode 100644
index 70075b7..0000000
--- a/example/toy/weights
+++ /dev/null
@@ -1,3 +0,0 @@
-logp 2
-use_house 0
-use_shell 1
diff --git a/example/toy/weights.toy b/example/toy/weights.toy
new file mode 100644
index 0000000..70075b7
--- /dev/null
+++ b/example/toy/weights.toy
@@ -0,0 +1,3 @@
+logp 2
+use_house 0
+use_shell 1
--
cgit v1.2.3