import type { Aff } from "../aff"; import type { CapType, CompoundPos } from "../constants"; import type { Dic } from "../dic"; /** * A word (a string) wrapped with metadata. Can be iterated, and will * coerce itself to a string. */ export declare class LKWord { /** The {@link Aff} data the word derives metadata from. */ aff: Aff; /** The {@link dic} data the word derives forms and stems from. */ dic: Dic; /** The word itself. */ word: string; /** The capitalization type of the word. */ type: CapType; /** The position of the word in a compound, if any. */ pos?: CompoundPos | undefined; constructor( /** The {@link Aff} data the word derives metadata from. */ aff: Aff, /** The {@link dic} data the word derives forms and stems from. */ dic: Dic, /** The word itself. */ word: string, /** The capitalization type of the word. */ type: CapType, /** The position of the word in a compound, if any. */ pos?: CompoundPos | undefined); /** * Reuses this instance's metadata on a new word. * * @param word - The new word string to use. */ to(word: string, captype?: CapType): LKWord; /** * Reuses this instance, but changes the compound position. * * @param pos - The new compound position. */ shift(pos: CompoundPos): LKWord; /** * Returns a new {@link LKWord} from a section of this word. * * @param from - The starting index of the section. Can be negative. * @param to - The ending index of the section. */ slice(from?: number, to?: number): LKWord; /** * Executes an ordinary text replacement operation on this word and * returns a new instance from the result. * * @param pat - The object that will search for matches in the word. * @param repl - The replacement string for the found match. */ replace(pat: { [Symbol.replace](s: string, r: string): string; }, repl?: string): LKWord; /** * Executes an ordinary text replacement operation on this word and * returns a new instance from the result. Replaces all matches, rather * than just the first one found. * * @param pat - The global `RegExp` or string to match with. * @param repl - The replacement string for the found match. */ replaceAll(pat: string | RegExp, repl?: string): LKWord; /** * Adds (concatenates) a string (or another {@link LKWord}) to this word * and returns a new instance from the result. * * @param str - The string or {@link LKWord} to add. */ add(str: string | LKWord): LKWord; /** * Gets the character at the specified index. Accepts negative numbers. * * @param n - The index of the desired character. Can be negative. */ at(n: number): string; /** The length of the word. */ get length(): number; [Symbol.toStringTag](): string; [Symbol.iterator](): Generator; [Symbol.toPrimitive](): string; }