def write_brat(docgraph, output_dir, layer='mmax', show_relations=True):
    dg.util.create_dir(output_dir)
    doc_name = os.path.basename(docgraph.name)
    with codecs.open(os.path.join(output_dir, (doc_name + '.txt')), 'wb', encoding='utf-8') as txtfile:
        txtfile.write(dg.get_text(docgraph))
    anno_str = brat_output(docgraph, layer=layer, show_relations=show_relations)
    with codecs.open(os.path.join(output_dir, 'annotation.conf'), 'wb', encoding='utf-8') as annotation_conf:
        annotation_conf.write(ANNOTATION_CONF)
    with codecs.open(os.path.join(output_dir, (doc_name + '.ann')), 'wb', encoding='utf-8') as annfile:
        annfile.write(anno_str)
def write_brat(docgraph, output_dir, layer='mmax', show_relations=True):
    dg.util.create_dir(output_dir)
    doc_name = os.path.basename(docgraph.name)
    with codecs.open(os.path.join(output_dir, (doc_name + '.txt')), 'wb', encoding='utf-8') as txtfile:
        txtfile.write(dg.get_text(docgraph))
    anno_str = brat_output(docgraph, layer=layer, show_relations=show_relations)
    with codecs.open(os.path.join(output_dir, 'annotation.conf'), 'wb', encoding='utf-8') as annotation_conf:
        annotation_conf.write(ANNOTATION_CONF)
    with codecs.open(os.path.join(output_dir, (doc_name + '.ann')), 'wb', encoding='utf-8') as annfile:
        annfile.write(anno_str)