import { PrefixDistribution, SuffixDistribution } from "./affixDistribution.js"; import { LetterDistribution } from "./letterDistribution.js"; import { LogNum } from "./logNum.js"; /** * Info about the words in a wordlist. * * We assume (as in `cromulence`) that words appearing in puzzles are * distributed via Zipf frequency. */ export declare class Wordlist { private cromulence; /** A map from letter bitCounters to words with that bitCounter. */ private bitCounters; /** The letter distribution of the wordlist. */ letters: LetterDistribution; /** The prefix distribution of the wordlist. */ prefixes: PrefixDistribution; /** The suffix distribution of the wordlist. */ suffixes: SuffixDistribution; constructor(wordlist: Record); static download(): Promise; /** * For testing purposes: create a wordlist from an array of words, each * equiprobable. */ static from(words: string[]): Wordlist; /** Apply a reducer to each word in the wordlist. */ reduce(initial: T, reducer: (acc: T, slug: string, zipf: number) => T): T; /** The number of wordlist items. */ get length(): number; /** * Get the log prob that a wordlist item, drawn uniformly at random, * satisfies the given property. This is NOT weighted by zipf! */ logProb(property: (slug: string) => boolean): LogNum; /** Returns true if the given slug is in the wordlist. */ isWord(slug: string, { threshold }?: { threshold?: number; }): boolean; /** Returns true if any of the given slugs are in the wordlist. */ hasWord(slugs: string[], { threshold }?: { threshold?: number; }): boolean; /** Filters for slugs in the wordlist, sorted from most common to least. */ filterWords(slugs: string[], { threshold }?: { threshold?: number; }): string[]; /** * Filters for slugs in the wordlist under the given getter, sorted from most * common to least. */ filterWordsUnder(items: T[], getSlug: (item: T) => string, { threshold }?: { threshold?: number; }): T[]; /** Returns true if the given phrase is in the wordlist. */ isPhrase(phrase: string): boolean; /** Returns the anagrams of a given slug, sorted from most common to least. */ anagrams(slug: string, { loose, threshold, }?: { loose?: boolean; threshold?: number; }): string[]; /** * Prob that, for two words, the first has a suffix equal to the second's * prefix, of the given length. */ probSharedAffix(length: number): LogNum; } //# sourceMappingURL=wordlist.d.ts.map