def test_ds_cycle(self): """ The tree in the ds_cycle file has "woman" depend both on "arriving" and "browse." """ xc = xc_load(ds_cycle) inst = xc[0] # 1 2 4 5 7 8 9 # The woman, (after) arriving, began to browse. # (The commas count as words, hence the skipping) tgt_t = DepTree.fromstring(""" (ROOT[0] (began[7] (woman[2] (The[1]) (\(after\)[4] (arriving[5]))) (browse[9] (woman[2]) (to[8]) ) )) """, stype=DEPSTR_PTB) ds = get_ds(inst, trans(inst)) self.assertTrue(tgt_t.structurally_eq(ds)) self.assertIsNone(project_ds_tier(inst))
def test_read_proj_ds_tree(self): src_t = get_ds(self.inst2, trans(self.inst2)) tgt_w = lang(self.inst2) aln = get_trans_gloss_alignment(self.inst2) tgt_t = DepTree.fromstring(""" (ROOT[0] (glaubst[2] (Was[1]) (Du[3]) (wer[4]) (angerufen[5] (hat[6])) )) """, stype=DEPSTR_PTB) proj_t = project_ds(src_t, tgt_w, aln) self.assertTrue(proj_t.structurally_eq(tgt_t))
def test_read_ds_tree(self): ds = get_ds(self.inst1, trans(self.inst1)) r = DepTree.fromstring("""(ROOT[0] (found[2] (Someone[1]) (them[3]) (boring[4])))""", stype=DEPSTR_PTB) self.assertTrue(r.structurally_eq(ds))