def conll_ner2json(input_data, **kwargs):
delimit_docs = "<STR_LIT>"<EOL>output_docs = []<EOL>for doc in input_data.strip().split(delimit_docs):<EOL><INDENT>doc = doc.strip()<EOL>if not doc:<EOL><INDENT>continue<EOL><DEDENT>output_doc = []<EOL>for sent in doc.split("<STR_LIT>"):<EOL><INDENT>sent = sent.strip()<EOL>if not sent:<EOL><INDENT>continue<EOL><DEDENT>lines = [line.strip() for line in sent.split("<STR_LIT:\n>") if line.strip()]<EOL>words, tags, chunks, iob_ents = zip(*[line.split() for line in lines])<EOL>biluo_ents = iob_to_biluo(iob_ents)<EOL>output_doc.append(<EOL>{<EOL>"<STR_LIT>": [<EOL>{"<STR_LIT>": w, "<STR_LIT>": tag, "<STR_LIT>": ent}<EOL>for (w, tag, ent) in zip(words, tags, biluo_ents)<EOL>]<EOL>}<EOL>)<EOL><DEDENT>output_docs.append(<EOL>{"<STR_LIT:id>": len(output_docs), "<STR_LIT>": [{"<STR_LIT>": output_doc}]}<EOL>)<EOL>output_doc = []<EOL><DEDENT>return output_docs<EOL>
Convert files in the CoNLL-2003 NER format into JSON format for use with
train cli.