change test_nonproj.py to not use zip inside numpy.asarray

This commit is contained in:
Wolfgang Seeker 2016-03-03 19:42:09 +01:00
parent 72b8df0684
commit 49f9d1c085
1 changed files with 2 additions and 1 deletions

View File

@ -59,7 +59,8 @@ def deprojectivize(proj_heads, deco_labels, EN):
sent = EN.tokenizer.tokens_from_list(['whatever'] * slen) sent = EN.tokenizer.tokens_from_list(['whatever'] * slen)
rel_proj_heads = [ head-i for i,head in enumerate(proj_heads) ] rel_proj_heads = [ head-i for i,head in enumerate(proj_heads) ]
labelids = [ EN.vocab.strings[label] for label in deco_labels ] labelids = [ EN.vocab.strings[label] for label in deco_labels ]
parse = numpy.asarray(zip(rel_proj_heads,labelids), dtype=numpy.int32) pairs = zip(rel_proj_heads,labelids)
parse = numpy.asarray(pairs, dtype=numpy.int32)
sent.from_array([HEAD,DEP],parse) sent.from_array([HEAD,DEP],parse)
PseudoProjectivity.deprojectivize(sent) PseudoProjectivity.deprojectivize(sent)
parse = sent.to_array([HEAD,DEP]) parse = sent.to_array([HEAD,DEP])