summaryrefslogtreecommitdiff
path: root/gi/evaluation/extract_ccg_labels.py
diff options
context:
space:
mode:
authortrevor.cohn <trevor.cohn@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-16 21:45:45 +0000
committertrevor.cohn <trevor.cohn@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-16 21:45:45 +0000
commit18209d048bfc1e9a1cd3edcfb80b3741869a9c34 (patch)
treefc93cee6ec967c93cbed9b2034833c61ecccf006 /gi/evaluation/extract_ccg_labels.py
parenta900eeb513e71ecbf5de9ba545da052002184fdc (diff)
Added pictures
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@299 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'gi/evaluation/extract_ccg_labels.py')
-rw-r--r--gi/evaluation/extract_ccg_labels.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/gi/evaluation/extract_ccg_labels.py b/gi/evaluation/extract_ccg_labels.py
index 5dd6eb65..77f21004 100644
--- a/gi/evaluation/extract_ccg_labels.py
+++ b/gi/evaluation/extract_ccg_labels.py
@@ -84,8 +84,9 @@ for tline, eline in itertools.izip(tinfile, einfile):
if tline.startswith('( '):
tline = tline[2:-1].strip()
tr = tree.parse_PST(tline)
- number_leaves(tr)
- #project_heads(tr) # assumes Bikel-style head annotation for the input trees
+ if tr != None:
+ number_leaves(tr)
+ #project_heads(tr) # assumes Bikel-style head annotation for the input trees
else:
tr = None
@@ -96,7 +97,11 @@ for tline, eline in itertools.izip(tinfile, einfile):
if tr:
a = ancestor(tr, range(x,y))
- fs = frontier(a, range(x,y))
+ try:
+ fs = frontier(a, range(x,y))
+ except:
+ print >>sys.stderr, "problem with line", tline.strip(), "--", eline.strip()
+ raise
#print x, y
#print 'ancestor', a