def simplify_tags(iob):
new_iob = []<EOL>for tag in iob:<EOL><INDENT>tag_match = re.match("<STR_LIT>", tag)<EOL>if tag_match:<EOL><INDENT>prefix = tag_match.group(<NUM_LIT:1>)<EOL>suffix = tag_match.group(<NUM_LIT:2>)<EOL>if suffix == "<STR_LIT>":<EOL><INDENT>suffix = "<STR_LIT>"<EOL><DEDENT>elif suffix == "<STR_LIT>":<EOL><INDENT>suffix = "<STR_LIT>"<EOL><DEDENT>elif suffix != "<STR_LIT>" and suffix != "<STR_LIT>" and suffix != "<STR_LIT>":<EOL><INDENT>suffix = "<STR_LIT>"<EOL><DEDENT>tag = prefix + "<STR_LIT:->" + suffix<EOL><DEDENT>new_iob.append(tag)<EOL><DEDENT>return new_iob<EOL>
Simplify tags obtained from the dataset in order to follow Wikipedia
scheme (PER, LOC, ORG, MISC). 'PER', 'LOC' and 'ORG' keep their tags, while
'GPE_LOC' is simplified to 'LOC', 'GPE_ORG' to 'ORG' and all remaining tags to
'MISC'.