fuzzy-rater
Version:
Tooling for fuzzily rating text according to some query
48 lines • 1.86 kB
TypeScript
import { IDFATrace } from "./_types/IDFATrace";
import { INormalizedDFANode } from "./_types/INormalizedDFANode";
import { INormalizedDFATemplate } from "./_types/INormalizedDFATemplate";
import { INormalizedDFATransition } from "./_types/INormalizedDFATransition";
export declare const remainingCode = "re";
/**
* A class to represent deterministic finite automata and their operations
*/
export declare class DFA<N, T> {
protected nodes: INormalizedDFANode<N, T>[];
protected traceTransitions: Record<string, {
state: number;
metadata: T;
}>[];
protected transitions: Record<string, number>[];
protected initial: number;
/**
* Creates a new DFA according to the given template
* @param template The template of the DFA
*/
constructor(template: INormalizedDFATemplate<N, T>);
/**
* Retrieves the character code of a given transition
* @param transition The transition to get a code for the transition character for
* @returns The character code
*/
protected getCharacterCode(transition: INormalizedDFATransition<T>): string;
/**
* Initializes the DFA structure
* @param template The DFA template
*/
protected initialize(template: INormalizedDFATemplate<N, T>): void;
/**
* Executes the DFA on the given input, and returns the metadata of the final node, if any
* @param input The input to execute the DFA on
* @returns The metadata
*/
execute(input: string): undefined | N;
/**
* Executes the DFA on the given input, and returns the metadata of the trace
* @param input The input to execute the DFA on
* @returns The metadata
*/
executeTraced(input: string): {
finished: boolean;
} & IDFATrace<N, T>;
}
//# sourceMappingURL=DFA.d.ts.map