summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md7
-rw-r--r--example/3/cdec.ini5
-rw-r--r--example/3/in (renamed from example/3/3.in)0
-rw-r--r--example/toy/cdec.ini2
-rw-r--r--example/toy/grammar-test24
-rw-r--r--example/toy/toy-cdec.json (renamed from example/toy/toy1.json)0
-rwxr-xr-xutil/cdec2json.py (renamed from util/cdec_hg_to_json.py)2
7 files changed, 20 insertions, 20 deletions
diff --git a/README.md b/README.md
index 98065f1..edf89bd 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,12 @@
-nothing to see here
+not much to see here, yet
(SCFG machine translation decoder in ruby, currently implements CKY+ parsing and hypergraph viterbi)
helpful stuff
* https://github.com/jweese/thrax/wiki/Glue-grammar
+ * http://aclweb.org/aclwiki/index.php?title=Hypergraph_Format
todo
- * animate?
- * to json
+====
+ * animate parsing?
* integrate with HG
diff --git a/example/3/cdec.ini b/example/3/cdec.ini
index 23c6ad3..ee65b4e 100644
--- a/example/3/cdec.ini
+++ b/example/3/cdec.ini
@@ -1,6 +1,5 @@
formalism=scfg
-grammar=grammars/grammar.3.gz
intersection_strategy=full
-#grammar=grammar-test
+grammar=grammars/grammar.3.gz
#add_pass_through_rules=true
-#weights=weights
+
diff --git a/example/3/3.in b/example/3/in
index ee3509c..ee3509c 100644
--- a/example/3/3.in
+++ b/example/3/in
diff --git a/example/toy/cdec.ini b/example/toy/cdec.ini
index 8276d9b..f12de54 100644
--- a/example/toy/cdec.ini
+++ b/example/toy/cdec.ini
@@ -1,5 +1,5 @@
formalism=scfg
+intersection_strategy=full
grammar=grammar
#grammar=grammar-test
#add_pass_through_rules=true
-#weights=weights
diff --git a/example/toy/grammar-test b/example/toy/grammar-test
index 4027c71..18900ae 100644
--- a/example/toy/grammar-test
+++ b/example/toy/grammar-test
@@ -1,22 +1,22 @@
-[S] ||| [B,1] ||| [1] ||| logp=0
-[S] ||| ich [V,1] ein [JJ,2] haus ||| i [1] a [2] ||| logp=0
+[S] ||| [B,1] ||| [B,1] ||| logp=0
+[S] ||| ich [V,1] ein [JJ,2] haus ||| i [V,1] a [JJ,2] ||| logp=0
[S] ||| ich sah ein kleines haus ||| i saw a small house ||| logp=0
-[S] ||| ich sah ein [JJ,1] ||| i saw a [1] ||| logp=0
-[B] ||| [C,1] ||| [1] ||| logp=0
-[C] ||| [Q,1] ||| [1] ||| logp=0
-[Q] ||| [NP,1] [VP,2] ||| [1] [2] ||| logp=0
+[S] ||| ich sah ein [JJ,1] ||| i saw a [JJ,1] ||| logp=0
+[B] ||| [C,1] ||| [C,1] ||| logp=0
+[C] ||| [Q,1] ||| [Q,1] ||| logp=0
+[Q] ||| [NP,1] [VP,2] ||| [NP,1] [VP,2] ||| logp=0
[NP] ||| ich ||| i ||| logp=-0.5 use_i=1.0
-[NP] ||| ein [NN,1] ||| a [1] ||| logp=0 use_a=1.0
-[NN] ||| [JJ,1] haus ||| [1] house ||| logp=0 use_house=1
-[NN] ||| [JJ,1] haus ||| [1] shell ||| logp=0 use_shell=1
-[JJ] ||| [H,1] ||| [1] ||| logp=0
+[NP] ||| ein [NN,1] ||| a [NN,1] ||| logp=0 use_a=1.0
+[NN] ||| [JJ,1] haus ||| [JJ,1] house ||| logp=0 use_house=1
+[NN] ||| [JJ,1] haus ||| [JJ,1] shell ||| logp=0 use_shell=1
+[JJ] ||| [H,1] ||| [H,1] ||| logp=0
[H] ||| kleines [Z,1] ||| small [1] ||| logp=0
-[Z] ||| [I,1] ||| [1] ||| logp=0
+[Z] ||| [I,1] ||| [I,1] ||| logp=0
[I] ||| haus ||| house ||| logp=0
[JJ] ||| kleines ||| small ||| logp=0 use_small=1.0
[JJ] ||| kleines ||| little ||| logp=0 use_little=1.0
[JJ] ||| grosses ||| big ||| logp=0
[JJ] ||| grosses ||| large ||| logp=0
-[VP] ||| [V,1] [NP,2] ||| [1] [2] ||| logp=0
+[VP] ||| [V,1] [NP,2] ||| [V,1] [NP,2] ||| logp=0
[V] ||| sah ||| saw ||| logp=-0.25 use_saw=1.0
[V] ||| fand ||| found ||| logp=0
diff --git a/example/toy/toy1.json b/example/toy/toy-cdec.json
index c58c249..c58c249 100644
--- a/example/toy/toy1.json
+++ b/example/toy/toy-cdec.json
diff --git a/util/cdec_hg_to_json.py b/util/cdec2json.py
index 2fcc409..76e2cd4 100755
--- a/util/cdec_hg_to_json.py
+++ b/util/cdec2json.py
@@ -3,10 +3,10 @@
import cdec
import sys, argparse
+
def hg2json(hg, weights):
"""
output a JSON representation of a cdec hypegraph
- (see http://aclweb.org/aclwiki/index.php?title=Hypergraph_Format )
"""
res = ''
res += "{\n"