def test_doc_api_merge_children(en_tokenizer):
 text = u'WKRO played songs by the beach boys all night'
 doc = en_tokenizer(text)
 assert (len(doc) == 9)
 doc.merge(doc[4].idx, (doc[6].idx + len(doc[6])), u'NAMED', u'LEMMA', u'TYPE')
 for word in doc:
  if (word.i < word.head.i):
   assert (word in list(word.head.lefts))
  elif (word.i > word.head.i):
   assert (word in list(word.head.rights))

def test_doc_api_merge_children ( en_tokenizer ) : text = u'WKRO played songs by the beach boys all night' doc = en_tokenizer ( text ) assert ( len ( doc ) == 9 ) doc . merge ( doc [ 4 ] . idx , ( doc [ 6 ] . idx + len ( doc [ 6 ] ) ) , u'NAMED' , u'LEMMA' , u'TYPE' ) for word in doc : if ( word . i < word . head . i ) : assert ( word in list ( word . head . lefts ) ) elif ( word . i > word . head . i ) : assert ( word in list ( word . head . rights ) )
test that attachments work correctly after merging .