Skip to content

Main content

Dependency Head Distance Tool

Resolve one supplied dependency edge in a common token-index convention, preserving a root-head flag.

Loading tool…

Description

Return dependency head distance with a root convention.

Language-processing records depend on tokenization, indexing, null sentinels and text representation. A UTF-8 byte offset, UTF-16 index, dependency link or literal feature label can be handled precisely without inferring linguistic correctness or semantic equivalence.

Return dependency head distance with a root convention.

When to use this tool

Use Dependency Head Distance when checking a supplied linguistic annotation, span, alignment or text-offset convention.

How to use the tool and how it works

  1. Enter tokenIndex, headIndex, rootHead. 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 signedDistance, absoluteDistance, defined. Inspect defined before interpreting the associated values.

Return dependency head distance with a root convention. Require nonnegative whole token/head indexes; when rootHead, return zero distances with defined false; otherwise signedDistance = head-token and absoluteDistance its magnitude.1

Input fieldMeaning and unitsAccepted input
tokenIndexToken IndexRequired. Safe integer; minimum 0.
headIndexHead IndexRequired. Safe integer; minimum 0.
rootHeadRoot HeadRequired. Boolean.
Output fieldInterpretationReturned shape
signedDistanceSigned DistanceRequired. Safe integer.
absoluteDistanceAbsolute DistanceRequired. Safe integer.
definedFalse for the supplied rootHead convention; both distance outputs are then zero placeholders.Required. Boolean.
json
{
  "input": {
    "tokenIndex": 5,
    "headIndex": 2,
    "rootHead": false
  },
  "output": {
    "signedDistance": -3,
    "absoluteDistance": 3,
    "defined": true
  }
}

Limitations and assumptions

  • Zero at root is a placeholder rather than an actual head position; no dependency tree is validated.
  • 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.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Use the appropriate tokenizer, Unicode and annotation-format conventions and validate the complete text or tree for full linguistic processing.

References

  1. Calculation and input contract: computational-linguistics/dependency-head-distance — tool.io

Similar or alternative tools