Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for sent in root[-1].findall('S'):
- for word in sent.findall('W'):
- link, pos, feats, head_token, head_pos, head_feats = get_info(word, sent)
- if link == 'сочин':
- if pos == 'CONJ' and head_pos == 'CONJ':
- word.attrib['DOM'] = head_token.attrib['DOM']
- word.attrib['LINK'] = 'cc'
- elif pos != 'CONJ' and head_pos != 'CONJ':
- word.attrib['DOM'] = head_token.attrib['DOM']
- word.attrib['LINK'] = 'conj'
- elif pos == 'CONJ' and head_pos != 'CONJ':
- children = collect_children(sent, word.attrib['ID'])
- if all(child['FEAT'] == 'CONJ' for child in children):
- if len(children) == 1:
- word.attrib['DOM'] = head_token.attrib['DOM']
- word.attrib['LINK'] = 'conj'
- elif any(child['FEAT'].split() in ['V', 'S', 'ADV', 'A', 'NUM'] for child in children):
- # сделать, что там надо
- else:
- word.attrib['DOM'] = head_token.attrib['DOM']
- word.attrib['LINK'] = 'cc'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement