Advertisement
Guest User

Untitled

a guest
May 4th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. for sent in root[-1].findall('S'):
  2. for word in sent.findall('W'):
  3. link, pos, feats, head_token, head_pos, head_feats = get_info(word, sent)
  4. if link == 'сочин':
  5. if pos == 'CONJ' and head_pos == 'CONJ':
  6. word.attrib['DOM'] = head_token.attrib['DOM']
  7. word.attrib['LINK'] = 'cc'
  8. elif pos != 'CONJ' and head_pos != 'CONJ':
  9. word.attrib['DOM'] = head_token.attrib['DOM']
  10. word.attrib['LINK'] = 'conj'
  11. elif pos == 'CONJ' and head_pos != 'CONJ':
  12. children = collect_children(sent, word.attrib['ID'])
  13. if all(child['FEAT'] == 'CONJ' for child in children):
  14. if len(children) == 1:
  15. word.attrib['DOM'] = head_token.attrib['DOM']
  16. word.attrib['LINK'] = 'conj'
  17. elif any(child['FEAT'].split() in ['V', 'S', 'ADV', 'A', 'NUM'] for child in children):
  18. # сделать, что там надо
  19. else:
  20. word.attrib['DOM'] = head_token.attrib['DOM']
  21. word.attrib['LINK'] = 'cc'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement