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)
Beispiel #2
0
 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)
Beispiel #3
0
def test_as_nbest_list():
    sr1 = parser.SentRep(['These', 'are', 'tokens', '.'])
    parses = parser.parse(sr1)
    print parser.asNBestList(parses, 'test_as_nbest_list_sentence')
Beispiel #4
0
 def __str__(self):
     return parser.asNBestList(self._parses)
Beispiel #5
0
def test_as_nbest_list():
    sr1 = parser.SentRep(['These', 'are', 'tokens', '.'])
    parses = parser.parse(sr1, thread_slot)
    print parser.asNBestList(parses)
Beispiel #6
0
def test_as_nbest_list():
    sr1 = parser.SentRep(['These', 'are', 'tokens', '.'])
    parses = parser.parse(sr1, thread_slot)
    print parser.asNBestList(parses)
Beispiel #7
0
def test_as_nbest_list():
    sr1 = parser.SentRep(['These', 'are', 'tokens', '.'])
    parses = parser.parse(sr1)
    print parser.asNBestList(parses, 'test_as_nbest_list_sentence')
Beispiel #8
0
def test_as_nbest_list():
    sr1 = parser.SentRep(["These", "are", "tokens", "."])
    parses = parser.parse(sr1)
    print parser.asNBestList(parses, "test_as_nbest_list_sentence")