def __str__(self): if self._reranked: from cStringIO import StringIO combined = StringIO() combined .write('%d dummy\n' % len(self.parses)) for parse in self.parses: combined.write('%s %s\n%s\n' % \ (parse.reranker_score, parse.parser_score, parse.ptb_parse)) combined.seek(0) return combined.read() else: return parser.asNBestList(self._parses)
def __str__(self): if self._reranked: from cStringIO import StringIO combined = StringIO() combined.write('%d dummy\n' % len(self.parses)) for parse in self.parses: combined.write('%s %s\n%s\n' % \ (parse.reranker_score, parse.parser_score, parse.ptb_parse)) combined.seek(0) return combined.read() else: return parser.asNBestList(self._parses)
def test_as_nbest_list(): sr1 = parser.SentRep(['These', 'are', 'tokens', '.']) parses = parser.parse(sr1) print parser.asNBestList(parses, 'test_as_nbest_list_sentence')
def __str__(self): return parser.asNBestList(self._parses)
def test_as_nbest_list(): sr1 = parser.SentRep(['These', 'are', 'tokens', '.']) parses = parser.parse(sr1, thread_slot) print parser.asNBestList(parses)
def test_as_nbest_list(): sr1 = parser.SentRep(["These", "are", "tokens", "."]) parses = parser.parse(sr1) print parser.asNBestList(parses, "test_as_nbest_list_sentence")