Skip to content

Main content

TEI Anchor Range Length Tool

Resolve a supplied TEI anchor-offset range in one explicit counting unit without parsing XML.

Loading tool…

Description

Return span length and endpoint offsets for named anchors.

Digital editions connect textual witnesses, anchors, page images and source-specific labels. Literal identifier agreement and numerical offsets preserve a supplied convention without proving textual authority, complete coverage or correct editorial interpretation.

Return span length and endpoint offsets for named anchors.

When to use this tool

Use TEI Anchor Range Length when checking supplied edition identifiers, ordering or coordinate conventions.

How to use the tool and how it works

  1. Enter anchorIds, offsets, startAnchor, endAnchor, includeEndUnit. Keep parallel arrays aligned. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read length, startOffset, endOffset. Use the output convention below.

Return span length and endpoint offsets for named anchors. Require unique anchor IDs, aligned nonnegative nondecreasing offsets and end-anchor index >= start-anchor index; length = endOffset-startOffset, adding one when includeEndUnit.1

Input fieldMeaning and unitsAccepted input
anchorIdsAnchor IdsRequired. Array of text; maximum UTF-16 length 8192; maximum items 256.
offsetsOffsetsRequired. Array of safe integer; maximum items 256.
startAnchorStart AnchorRequired. Text; maximum UTF-16 length 8192.
endAnchorEnd AnchorRequired. Text; maximum UTF-16 length 8192.
includeEndUnitInclude End UnitRequired. Boolean.
Output fieldInterpretationReturned shape
lengthOffset difference, plus one when includeEndUnit; one must represent a discrete unit.Required. Safe integer.
startOffsetStart OffsetRequired. Safe integer.
endOffsetEnd OffsetRequired. Safe integer.
json
{
  "input": {
    "anchorIds": [
      "a",
      "b",
      "c"
    ],
    "offsets": [
      0,
      10,
      20
    ],
    "startAnchor": "a",
    "endAnchor": "c",
    "includeEndUnit": false
  },
  "output": {
    "length": 20,
    "startOffset": 0,
    "endOffset": 20
  }
}

Limitations and assumptions

  • The offset unit is supplied; inclusive addition assumes one discrete unit rather than inferring character encoding.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.

Alternative or Complementary methods

Inspect the original edition and its encoding model before treating local record agreement as meaningful textual or historical evidence.

References

  1. Calculation and input contract: digital-humanities/tei-anchor-range-length — tool.io

Similar or alternative tools