summaryrefslogtreecommitdiff
path: root/util/cdec2json.py
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-08-17 07:51:16 +0100
committerPatrick Simianer <p@simianer.de>2014-08-17 07:51:16 +0100
commit190f68c880eb27506669e95e2bc0493e2ec42c4c (patch)
tree26dbe66018a966613b2bf59761661131057a6ef5 /util/cdec2json.py
parent0b3cdb4ae2fa176ba74a48ff7a1616395079c151 (diff)
functional again
Diffstat (limited to 'util/cdec2json.py')
-rwxr-xr-xutil/cdec2json.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/util/cdec2json.py b/util/cdec2json.py
index adddb64..e7c8e93 100755
--- a/util/cdec2json.py
+++ b/util/cdec2json.py
@@ -15,13 +15,6 @@ def hg2json(hg, weights):
"""
res = ''
res += "{\n"
- res += '"weights":{'+"\n"
- a = []
- for i in weights:
- if i[1] != 0:
- a.append( '"%s":%s'%(i[0], i[1]) )
- res += ", ".join(a)+"\n"
- res += "},\n"
res += '"rules":[\n'
rules = []
for i in hg.edges:
@@ -35,9 +28,9 @@ def hg2json(hg, weights):
res += '"nodes":'+"\n"
res += "[\n"
a = []
- a.append( '{ "id":0, "cat":"root", "span":[-1,-1] }' )
+ a.append( '{ "id":0, "symbol":"root", "span":[-1,-1] }' )
for i in hg.nodes:
- a.append('{ "id":%d, "cat":"%s", "span":[%d,%d] }'%(i.id+1, i.cat, i.span[0], i.span[1]))
+ 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"