@pytest.mark.models
def test_parser_sbd_serialization_projective(EN):
 text = u"I bought a couch from IKEA It wasn't very comfortable."
 transition = [u'L-nsubj', u'S', u'L-det', u'R-dobj', u'D', u'R-prep', u'R-pobj', u'B-ROOT', u'L-nsubj', u'R-neg', u'D', u'S', u'L-advmod', u'R-acomp', u'D', u'R-punct']
 doc = EN.tokenizer(text)
 apply_transition_sequence(EN.parser, doc, transition)
 doc_serialized = Doc(EN.vocab).from_bytes(doc.to_bytes())
 assert (doc.is_parsed == True)
 assert (doc_serialized.is_parsed == True)
 assert (doc.to_bytes() == doc_serialized.to_bytes())
 assert ([s.text for s in doc.sents] == [s.text for s in doc_serialized.sents])

@ pytest . mark . models def test_parser_sbd_serialization_projective ( EN ) : text = u"I bought a couch from IKEA It wasn't very comfortable." transition = [ u'L-nsubj' , u'S' , u'L-det' , u'R-dobj' , u'D' , u'R-prep' , u'R-pobj' , u'B-ROOT' , u'L-nsubj' , u'R-neg' , u'D' , u'S' , u'L-advmod' , u'R-acomp' , u'D' , u'R-punct' ] doc = EN . tokenizer ( text ) apply_transition_sequence ( EN . parser , doc , transition ) doc_serialized = Doc ( EN . vocab ) . from_bytes ( doc . to_bytes ( ) ) assert ( doc . is_parsed == True ) assert ( doc_serialized . is_parsed == True ) assert ( doc . to_bytes ( ) == doc_serialized . to_bytes ( ) ) assert ( [ s . text for s in doc . sents ] == [ s . text for s in doc_serialized . sents ] )
test that before and after serialization .