Skip to content

Main content

Word Alignment Fertility Count Tool

Count distinct target IDs for one source token while preserving explicit null-alignment metadata.

Loading tool…

Description

Count distinct nonnull targets aligned to one source token.

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.

Count distinct nonnull targets aligned to one source token.

When to use this tool

Use Word Alignment Fertility Count when checking a supplied linguistic annotation, span, alignment or text-offset convention.

How to use the tool and how it works

  1. Enter sourceTokenId, alignedSourceIds, targetIds, nullAligned. 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 fertility, hasNullAlignment. Inspect hasNullAlignment before interpreting the associated values.

Count distinct nonnull targets aligned to one source token. Require aligned arrays, nonempty sourceTokenId and nonempty nonnull target IDs; fertility deduplicates matching nonnull targets, hasNullAlignment separately checks matching null records.1

Input fieldMeaning and unitsAccepted input
sourceTokenIdSource Token IdRequired. Text; maximum UTF-16 length 8192.
alignedSourceIdsAligned Source IdsRequired. Array of text; maximum UTF-16 length 8192; maximum items 256.
targetIdsTarget IdsRequired. Array of text; maximum UTF-16 length 8192; maximum items 256.
nullAlignedNull AlignedRequired. Array of boolean; maximum items 256.
Output fieldInterpretationReturned shape
fertilityFertilityRequired. Safe integer.
hasNullAlignmentHas Null AlignmentRequired. Boolean.
json
{
  "input": {
    "sourceTokenId": "s1",
    "alignedSourceIds": [
      "s1",
      "s1",
      "s1",
      "s2"
    ],
    "targetIds": [
      "t1",
      "t1",
      "",
      "t2"
    ],
    "nullAligned": [
      false,
      false,
      true,
      false
    ]
  },
  "output": {
    "fertility": 1,
    "hasNullAlignment": true
  }
}

Limitations and assumptions

  • Null labels and alignments are supplied; the count is not inferred from text or a complete alignment model.
  • 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

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/word-alignment-fertility-count — tool.io

Similar or alternative tools