It seems this won't work with unicode because you cast `nbest_list_item.ptb_parse` to str. What is the type of `nbest_list_item.ptb_parse`? This may raise an exception for non-ascii data.