def show_triple(tokens, text, triple):
 (nsubj, verb, dobj) = triple
 nsubj_text = phrase_text_for_head(tokens, text, nsubj)
 verb_text = tokens[verb]['text']['content']
 dobj_text = phrase_text_for_head(tokens, text, dobj)
 left = textwrap.wrap(nsubj_text, width=28)
 mid = textwrap.wrap(verb_text, width=10)
 right = textwrap.wrap(dobj_text, width=28)
 print (((((('+' + (30 * '-')) + '+') + (12 * '-')) + '+') + (30 * '-')) + '+')
 for (l, m, r) in zip(left, mid, right):
  print '| {:<28s} | {:<10s} | {:<28s} |'.format((l or ''), (m or ''), (r or ''))

def show_triple ( tokens , text , triple ) : ( nsubj , verb , dobj ) = triple nsubj_text = phrase_text_for_head ( tokens , text , nsubj ) verb_text = tokens [ verb ] [ 'text' ] [ 'content' ] dobj_text = phrase_text_for_head ( tokens , text , dobj ) left = textwrap . wrap ( nsubj_text , width = 28 ) mid = textwrap . wrap ( verb_text , width = 10 ) right = textwrap . wrap ( dobj_text , width = 28 ) print ( ( ( ( ( ( '+' + ( 30 * '-' ) ) + '+' ) + ( 12 * '-' ) ) + '+' ) + ( 30 * '-' ) ) + '+' ) for ( l , m , r ) in zip ( left , mid , right ) : print '| {:<28s} | {:<10s} | {:<28s} |' . format ( ( l or '' ) , ( m or '' ) , ( r or '' ) )
prints the given triple .