Skip to content

Main content

Corpus Character Offset Newline Adjustment

Adjust an explicit offset when each counted preceding LF becomes CRLF, adding one code unit per supplied preceding newline.

Loading tool…

Description

Adjust a supplied source offset for preceding one-unit newline expansions.

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.

Adjust a supplied source offset for preceding one-unit newline expansions.

When to use this tool

Use Corpus Character Offset Newline Adjustment when you already have originalOffset, precedingExpandedNewlines and need to adjust a supplied source offset for preceding one-unit newline expansions.

How to use the tool and how it works

  1. Enter originalOffset, precedingExpandedNewlines. 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 adjustedOffset. Use the output convention below.

Require nonnegative safe originalOffset and precedingExpandedNewlines<=offset; add them with BigInt and export a safe integer.1

Input fieldMeaning and unitsAccepted input
originalOffsetOriginal OffsetRequired. Safe integer; minimum 0.
precedingExpandedNewlinesPreceding Expanded NewlinesRequired. Safe integer; minimum 0.
Output fieldInterpretationReturned shape
adjustedOffsetExact originalOffset+precedingExpandedNewlines; each newline contributes one extra unit, with safe numeric export.Required. Safe integer.
json
{
  "input": {
    "originalOffset": 20,
    "precedingExpandedNewlines": 3
  },
  "output": {
    "adjustedOffset": 23
  }
}

Limitations and assumptions

  • Each counted expansion contributes exactly one index unit. No source/newline scan, offset-unit convention or actual span is verified; unsafe exports are rejected.
  • 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/corpus-character-offset-newline-adjustment — tool.io

Similar or alternative tools