def _parse_relation(self, tag):
chunk, relation, role = None, [], []<EOL>if "<STR_LIT:;>" in tag:<EOL><INDENT>id = tag.split("<STR_LIT:*>")[<NUM_LIT:0>][-<NUM_LIT:2>:]<EOL>id = id if id.startswith("<STR_LIT:->") else "<STR_LIT>"<EOL>tag = tag.replace("<STR_LIT:;>", id + "<STR_LIT:*>")<EOL><DEDENT>if "<STR_LIT:*>" in tag:<EOL><INDENT>tag = tag.split("<STR_LIT:*>")<EOL><DEDENT>else:<EOL><INDENT>tag = [tag]<EOL><DEDENT>for s in tag:<EOL><INDENT>s = s.split("<STR_LIT:->")<EOL>n = len(s)<EOL>if n == <NUM_LIT:1>: <EOL><INDENT>chunk = s[<NUM_LIT:0>]<EOL><DEDENT>if n == <NUM_LIT:2>: <EOL><INDENT>chunk = s[<NUM_LIT:0>]; relation.append(s[<NUM_LIT:1>]); role.append(None)<EOL><DEDENT>if n >= <NUM_LIT:3>: <EOL><INDENT>chunk = s[<NUM_LIT:0>]; relation.append(s[<NUM_LIT:2>]); role.append(s[<NUM_LIT:1>])<EOL><DEDENT>if n > <NUM_LIT:1>:<EOL><INDENT>id = relation[-<NUM_LIT:1>]<EOL>if id.isdigit():<EOL><INDENT>relation[-<NUM_LIT:1>] = int(id)<EOL><DEDENT>else:<EOL><INDENT>relation[-<NUM_LIT:1>], role[-<NUM_LIT:1>] = None, id<EOL><DEDENT><DEDENT><DEDENT>return chunk, relation, role<EOL>
Parses the chunk tag, role and relation id from the token relation tag.
            - VP                => VP, [], []
            - VP-1              => VP, [1], [None]
            - ADJP-PRD          => ADJP, [None], [PRD]
            - NP-SBJ-1          => NP, [1], [SBJ]
            - NP-OBJ-1*NP-OBJ-2 => NP, [1,2], [OBJ,OBJ]
            - NP-SBJ;NP-OBJ-1   => NP, [1,1], [SBJ,OBJ]