def table(sentence, fill=<NUM_LIT:1>, placeholder="<STR_LIT:->"):
tags  = [WORD, POS, IOB, CHUNK, ROLE, REL, PNP, ANCHOR, LEMMA]<EOL>tags += [tag for tag in sentence.token if tag not in tags]<EOL>def format(token, tag):<EOL><INDENT>if   tag == WORD   : s = token.string<EOL>elif tag == POS    : s = token.type<EOL>elif tag == IOB    : s = token.chunk and (token.index == token.chunk.start and "<STR_LIT:B>" or "<STR_LIT:I>")<EOL>elif tag == CHUNK  : s = token.chunk and token.chunk.type<EOL>elif tag == ROLE   : s = token.chunk and token.chunk.role<EOL>elif tag == REL    : s = token.chunk and token.chunk.relation and str(token.chunk.relation)<EOL>elif tag == PNP    : s = token.chunk and token.chunk.pnp and token.chunk.pnp.type<EOL>elif tag == ANCHOR : s = token.chunk and token.chunk.anchor_id<EOL>elif tag == LEMMA  : s = token.lemma<EOL>else               : s = token.custom_tags.get(tag)<EOL>return s or placeholder<EOL><DEDENT>def outline(column, fill=<NUM_LIT:1>, padding=<NUM_LIT:3>, align="<STR_LIT:left>"):<EOL><INDENT>n = max([len(x) for x in column]+[fill])<EOL>if align == "<STR_LIT:left>"  : return [x+"<STR_LIT:U+0020>"*(n-len(x))+"<STR_LIT:U+0020>"*padding for x in column]<EOL>if align == "<STR_LIT:right>" : return ["<STR_LIT:U+0020>"*(n-len(x))+x+"<STR_LIT:U+0020>"*padding for x in column]<EOL><DEDENT>columns = [[format(token, tag) for token in sentence] for tag in tags]<EOL>columns[<NUM_LIT:3>] = [columns[<NUM_LIT:3>][i]+(iob == "<STR_LIT:I>" and "<STR_LIT>" or "<STR_LIT>") for i, iob in enumerate(columns[<NUM_LIT:2>])]<EOL>del columns[<NUM_LIT:2>]<EOL>for i, header in enumerate(['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT:id>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']+tags[<NUM_LIT:9>:]):<EOL><INDENT>columns[i].insert(<NUM_LIT:0>, "<STR_LIT>")<EOL>columns[i].insert(<NUM_LIT:0>, header.upper())<EOL><DEDENT>for i, column in enumerate(columns):<EOL><INDENT>columns[i] = outline(column, fill+<NUM_LIT:10>*(i==<NUM_LIT:0>), align=("<STR_LIT:left>","<STR_LIT:right>")[i==<NUM_LIT:0>])<EOL><DEDENT>if not MBSP:<EOL><INDENT>del columns[<NUM_LIT:6>] <EOL><DEDENT>return "<STR_LIT:\n>".join(["<STR_LIT>".join([x[i] for x in columns]) for i in range(len(columns[<NUM_LIT:0>]))])<EOL>
Returns a string where the tags of tokens in the sentence are organized in outlined columns.