TECHNOLOGY

doccano relation data: preserve span endpoints when rebuilding the entity table

In this article
THE QUICK TAKE

A relation links identified spans; reordering or recreating entities requires an explicit endpoint mapping rather than a match on surface text.

Treat relations as a graph over spans

A company name appears in the opening sentence and again in a quotation. A relation annotation may refer only to the quoted occurrence. The doccano client reference describes relation endpoints through from_id and to_id, identifying spans. Joining relations by the entity’s visible text discards that distinction. Keep the document identity, span identity and relation direction together when constructing a model-facing representation from the annotation database.

Build identity mappings before rewriting rows

Suppose a converter sorts entities by their starting position and assigns fresh identifiers. Preserve an old-to-new span map while rebuilding the table, then transform every relation endpoint through that map. Array position is an implementation detail, not a stable entity identity. Check that each endpoint resolves inside the intended example. If a filtered entity disappears, the corresponding edge needs an explicit exclusion decision; silently pointing it to a neighboring row invents an annotation.

Keep entity and relation types separate

The doccano import implementation builds relation-extraction data using distinct span and relation type collections. Preserve that distinction in conversion logic. An organization entity type and an employed-by relation type belong to different parts of the supervision. Renaming both through a shared category dictionary can accidentally replace a relation label with an entity label that happens to use the same local identifier.

Inspect the selected export contract

The official tutorial makes export a separate workflow step. Inspect the export formats available for the installed project and choose one that represents its relation annotations. A file containing valid entity spans does not prove that relation edges survived. Reimport a pilot containing repeated names, directed relations and an entity without an edge. Compare the graph by mapped identities rather than demanding that a fresh database reproduce the original internal identifiers.

Validate text and edges together

Use the exact reviewed text when interpreting span boundaries. After conversion, inspect the source and target substrings for every pilot relation, as well as its type and direction. The guides to FUNSD entity relations and Unicode offset integrity describe related graph and text risks. A complete handoff preserves which occurrence was connected to which other occurrence, not merely how many entities and relations the files contain.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles