/** * A class that uses a single bigint to store counts for each lowercase letter, * for fast-ish comparison. * * Idea stolen from Collective.jl: * https://github.com/rdeits/Collective.jl/blob/master/src/bitstally.jl */ export declare class LetterBitCounter { private static readonly bits; private static readonly mask; private static readonly offsets; private static readonly letterMasks; /** * This is a (26 * 5)-bit integer; each 5-bit block is a count for a letter. * Unclear how efficient this'll be for different engines... * * Note that 26 * 5 = 130, so these *mostly* fit in 128-bit integers, unless * there's more than 7 'z's. */ readonly data: bigint; constructor(data: bigint); private static toIndex; private static fromIndex; /** Create a new LetterCounter from a slug. */ static from(slug: string): LetterBitCounter; /** Count the number of times the given letter appears in this bitcounter. */ index(letter: string): number; equals(other: LetterBitCounter): boolean; add(char: string): LetterBitCounter; sub(char: string): LetterBitCounter; /** If this + result == other, return result; else null. */ transaddOf(other: LetterBitCounter): string | null; /** If this - result == other, return result; else null. */ transdeleteOf(other: LetterBitCounter): string | null; } /** A map from letter bitcounters to words with that bitcounter. */ export declare class LetterBitCounters { private letterCounters; private lengths; constructor(wordlist: string[]); /** Get the words whose bitcounter matches the given slug's bitcounter. */ get(slug: string): string[]; /** Find all substrings of the slug that anagram to a word's bitcounter. */ matchSubstring(slug: string): Generator<{ start: number; words: string[]; }>; } //# sourceMappingURL=letterBitCounter.d.ts.map