/**
 * @copyright Sister Software
 * @license AGPL-3.0
 * @author Teffen Ellis, et al.
 */
import { type Classification, type ClassificationMatch, ClassificationsMatchMap } from "mailwoman/core/classification";
import { Displayable } from "../resources/debugging.js";
import { Alpha3bLanguageCode } from "../resources/languages/index.js";
import { LibPostalLanguageCode } from "../resources/libpostal.js";
import { Graph } from "./Graph.js";
export interface SpanCreationOptions {
    start?: number;
    classifications?: Iterable<Classification>;
    children?: Iterable<Span>;
}
declare const kSpanID: unique symbol;
export interface SerializedSpan {
    [kSpanID]: number;
    body: string;
    start: number;
    end: number;
    normalized: string;
    classifications: ClassificationMatch[];
    children: SerializedSpan[];
    phrases: SerializedSpan[];
}
/**
 * A span of text, i.e. a token or a phrase.
 */
export declare class Span extends Graph<Span> {
    #private;
    /**
     * The start index of the span.
     */
    start: number;
    /**
     * The end index of the span.
     */
    end: number;
    /**
     * The unique identifier for this span.
     */
    protected static IDCounter: number;
    /**
     * The unique identifier for this span.
     */
    readonly [kSpanID]: number;
    get id(): number;
    /**
     * The normalized body of the span.
     */
    normalized: string;
    /**
     * Classifications for this span.
     */
    readonly classifications: ClassificationsMatchMap;
    /**
     * Boolean-like indications that hint at the nature of the span.
     *
     * Unlike classifications, these are not exposed in the final output.
     */
    get flags(): ReadonlySet<SpanFlag>;
    is(classification: Classification): boolean;
    static from(input?: string, options?: SpanCreationOptions): Span;
    static from(input: Span, options?: Omit<SpanCreationOptions, "start">): Span;
    static from(input: Span | string, options?: SpanCreationOptions): Span;
    constructor(body?: string, start?: number);
    get body(): string;
    /**
     * Set the body of the Span
     */
    set body(nextBody: string);
    /**
     * Predicate to determine if this Span intersects another Span
     */
    intersects(that: Pick<Span, "start" | "end">): boolean;
    /**
     * Predicate to determine if this Span covers another Span
     */
    covers(that: Pick<Span, "start" | "end">): boolean;
    /**
     * Returns the distance between two Spans
     *
     * @todo Use graph to find prev and next spans for a more accurate result
     *
     * @todo Or base 'distance' on word distance (slop) rather than characters
     */
    distance(that: Pick<Span, "start" | "end">): number;
    /**
     * Returns the coverage of the span, i.e. the number of characters covered by the span and its
     * children.
     */
    get coverage(): number;
    /**
     * The combined languages of the span's children.
     */
    get languages(): Displayable<ReadonlySet<LibPostalLanguageCode | Alpha3bLanguageCode>>;
    /**
     * Serialize the span to JSON.
     */
    toJSON(): SerializedSpan;
    toString(): string;
    /**
     * Connect siblings in the graph.
     */
    static connectSiblings(...spans: Span[]): Span[];
}
export type SpanFlag = "ends_with_period" | "numeric" | "alpha" | "alphanumeric" | "numeral" | "punctuation";
/**
 * Patterns to test and apply classifications to spans.
 *
 * Note that order here is important, as the first pattern that matches will be used.
 */
export declare const PatternMatchers: readonly [pattern: RegExp, flag: SpanFlag][];
export {};
//# sourceMappingURL=Span.d.ts.map