Skip to main content

brat

Overview

brat is a web-based annotation tool that uses a simple standoff annotation format. Annotations are stored in .ann files separate from the source text (.txt files). The format defines five annotation types: text-bound annotations (T), events (E), attributes (A), relations (R), and equivalences (*). brat's format is widely used in biomedical NLP shared tasks (BioNLP-ST, GENIA, etc.).

Type-by-Type Mapping

Text-Bound Annotations (T)

Format: T{id}\t{type} {start} {end}\t{text}

brat FeatureLayers EquivalentNotes
T-annotationpub.layers.annotation.defs#annotation with anchor.textSpanA labeled span of text. {type}annotation.label; {start}/{end}anchor.textSpan.byteStart/anchor.textSpan.byteEnd. The import pipeline converts character offsets to byte offsets at import time.
Discontinuous spansanchor.tokenRefSequence with non-contiguous indicesbrat represents discontinuous spans as {start1} {end1};{start2} {end2}. Layers uses tokenRefSequence with non-contiguous tokenIndexes, or multiple character spans in features.
Entity annotationsannotationLayer(kind="span", subkind="entity-mention")Named entities, gene mentions, chemical names, etc.
Trigger annotationsannotationLayer(kind="span", subkind="frame")Event triggers (the text that evokes an event).

Events (E)

Format: E{id}\t{type}:{trigger} {role1}:{arg1} {role2}:{arg2}...

brat FeatureLayers EquivalentNotes
Eventpub.layers.annotation.defs#annotation with kind="span", subkind="frame" or subkind="predicate"Event instance with trigger span and argument roles.
Event typeannotation.labelEvent type (e.g., Phosphorylation, Binding, Gene_expression).
Event triggerannotation.anchorThe text span that triggers/evokes the event.
Event argumentsannotation.arguments[] as argumentRef{role}:{arg} pairs map to argumentRef.role and argumentRef.target (an objectRef, using localId for same-layer or recordRef+objectId for cross-layer references).
Nested eventsargumentRef pointing to another event annotationbrat allows events as arguments to other events. Layers's argumentRef can reference any annotation by UUID, supporting arbitrary nesting.

Attributes (A)

Format: A{id}\t{type} {target} {value}

brat FeatureLayers EquivalentNotes
Binary attributeannotation.features on the target annotation{type} → feature key; presence → feature value "true".
Multi-valued attributeannotation.features on the target annotation{type} → feature key; {value} → feature value.
Negationfeatures.negation = "true"Common attribute in biomedical annotation.
Speculationfeatures.speculation = "true"Hedging/uncertainty.

Relations (R)

Format: R{id}\t{type} Arg1:{arg1} Arg2:{arg2}

brat FeatureLayers EquivalentNotes
Binary relationpub.layers.annotation.defs#annotation with kind="relation"Typed relation between two annotations. {type}annotation.label; Arg1/Arg2annotation.arguments.
Directed relationargumentRef with role="source" / role="target"brat relations are directed (Arg1 → Arg2).
Undirected relationargumentRef with role="arg1" / role="arg2"Symmetric relations.
Cross-sentence relationsSupported nativelyLayers annotations can reference any annotation within the expression by UUID.

Equivalences (*)

Format: *\t{type} {id1} {id2} ...

brat FeatureLayers EquivalentNotes
Equivalence setpub.layers.annotation.clusterSetGroups of equivalent annotations (coreference, etc.). {type}clusterSet.kind; {id1} {id2}...cluster.members (an array of objectRef).

Normalization (N)

Format: N{id}\t{type} {target} {ref_db}:{ref_id}\t{text}

brat FeatureLayers EquivalentNotes
Normalizationannotation.knowledgeRefsLinks annotations to external databases. {ref_db}knowledgeRef.source; {ref_id}knowledgeRef.identifier. Used for gene/protein database links (UniProt, NCBI Gene, etc.).

Notes (#)

Format: #{id}\t{type} {target}\t{text}

brat FeatureLayers EquivalentNotes
Annotator noteannotation.features.note or separate annotationLayer(kind="span", subkind="comment")Free-text annotator comments on specific annotations.

brat Configuration

brat ConfigLayers EquivalentNotes
annotation.conf (entity/event/relation type definitions)pub.layers.ontology.ontologyType definitions with constraints.
visual.conf (display settings)Appview rendering configurationNot part of the data model; handled by the lairs.pub appview.
tools.conf (tool integration)Appview pipeline configurationNot part of the data model.
kb_shortcuts.confUI configurationNot part of the data model.

Conversion Notes

A brat .ann file converts to Layers records as follows:

  1. The .txt file becomes a pub.layers.expression.expression record
  2. T-annotations become annotations in appropriate layers (entity-mention, frame, etc.), grouped by type
  3. E-annotations become annotations with kind="span" and arguments referencing trigger and argument annotations
  4. A-annotations become features on their target annotations
  5. R-annotations become annotations in a relation layer or pub.layers.graph.defs#graphEdgeEntry entries
  6. *-annotations become clusterSet records
  7. N-annotations become knowledgeRef entries on their target annotations