import { MetricLogProbCache } from "../lib/keyedCache.js"; import { LetterIndices } from "../lib/letterIndices.js"; import type { Wordlist } from "../lib/wordlist.js"; import type { Linker } from "../linkers/index.js"; import * as T from "../templating/index.js"; export declare const MetricLogProbs: MetricLogProbCache; type Props = { letterIndices: LetterIndices; wordlist: Wordlist; }; /** * A Metric assigns a slug to a non-negative integer. Metrics are used to build * features of the form: "has {exactly, at least} ...". * * Representing features as metrics lets us deduplicate reported features, and * makes computing features for high-cardinality metrics take less time. */ export type Metric = { /** The name of the metric; used for debugging. */ metricName: T.Inline; /** * Maximum vertex to allow in a non-strict feature. * * Pretty much all metrics are correlated with slug length. Input slugs are * on average longer than wordlist items, so they score higher on-average. * This can result in uninteresting features simply due to length; if your * answers are all fifteen letters long, it's kinda spurious if several have * at least six alphabetic bigrams. (However, if several have *exactly* six * alphabetic bigrams, that's always interesting.) * * When in doubt, 5 is a good default. */ maxNonStrict: number; /** * Constructs the name of a feature. For example: (2, true) => * "has exactly two ..." */ name: (vertex: number, strict: boolean) => T.Inline; /** Score a slug for the given metric. */ score: (slug: string, props: Props) => { /** The actual score. */ score: number; /** Returns a description of the score, for the given metric. */ describe: (vertex: number, strict: boolean) => T.Row; }; }; /** * A range of scores. If strict, this is { vertex }. Otherwise, this is * [vertex, inf). */ type FeatureRange = { vertex: number; strict: boolean; }; /** * Turns a list of scores into a list of (vertex, strict) pairs to construct * Features out of. Because some Features ranges contain others, we only need to * report the smallest Features that contain each subset of scores, because * these are the best-scoring ones. */ export declare function getFeatureRanges(metric: Metric, scores: number[]): Map; /** Metric-based linkers. */ export declare function metricLinkers(wordlist: Wordlist): Linker[]; /** * For testing purposes. Takes a list of metrics, and returns * a function that takes a slug and returns its score against each metric. */ export declare function makeMetricGetter(metrics: Metric[], wordlist: Wordlist): (slug: string) => Record; export {}; //# sourceMappingURL=index.d.ts.map