Skip to content

Main content

Dependency One Based Head Crosswalk

Map a dependency head index with root=0 into a zero-based token index with root=-1, without validating an entire dependency tree.

Loading tool…

Description

Crosswalk a supplied one-based dependency head with a root sentinel.

Language-processing records distinguish tokens, code points, UTF-16 positions and UTF-8 byte offsets. Tag grammars and local transition checks do not validate a full annotation sequence. Log-loss units determine perplexity conversion, while identifier suffixes may be textual labels rather than ordinary decimal numbers.

Crosswalk a supplied one-based dependency head with a root sentinel.

When to use this tool

Use Dependency One Based Head Crosswalk when you already have headOneBased, tokenCount and need to crosswalk a supplied one-based dependency head with a root sentinel.

How to use the tool and how it works

  1. Enter headOneBased, tokenCount. 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 root, headZeroBased. Inspect root before interpreting the associated values.

Require safe tokenCount>=0 and headOneBased in [0,count]; root=head===0, headZeroBased=-1 for root or head-1 otherwise.1

CoNLL-U uses zero for the virtual root in the HEAD column. Converting that local index does not validate a dependency tree.2

Input fieldMeaning and unitsAccepted input
headOneBasedZero means root; otherwise a one-based head no greater than tokenCount.Required. Safe integer; minimum 0.
tokenCountToken CountRequired. Safe integer; minimum 0.
Output fieldInterpretationReturned shape
rootRootRequired. Boolean.
headZeroBasedheadOneBased-1 for nonroot, or -1 sentinel for root.Required. Safe integer.
json
{
  "input": {
    "headOneBased": 3,
    "tokenCount": 5
  },
  "output": {
    "root": false,
    "headZeroBased": 2
  }
}

Limitations and assumptions

  • Minus one is a sentinel, not an array index. No token identity, self-head, cycle, connectivity, root count or valid dependency tree is checked.
  • 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

Validate the complete corpus format, tokenizer, annotation sequence and scoring convention. Use a full parser or model evaluation when needed, preserving the exact offset unit, vocabulary and log base rather than inferring them from a local transformation.

References

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

  2. CoNLL-U Format: Word, range and empty-node identifiers — Universal Dependencies

Similar or alternative tools