UNPKG

fuzzy-rater

Version:

Tooling for fuzzily rating text according to some query

73 lines 3.94 kB
import { INormalizedNFANode } from "../../NFA/_types/INormalizedNFANode"; import { INormalizedNFATemplate } from "../../NFA/_types/INormalizedNFATemplate"; import { INormalizedNFATransition } from "../../NFA/_types/INormalizedNFATransition"; import { INFADFATemplate } from "./_types/INFADFATemplate"; import { INFADFATransition } from "./_types/INFADFATransition"; import { IAugmentedNFATransition } from "./_types/INFADFATransitionData"; import { INFADFAMetaGetters } from "./_types/INFADFAMetaGetters"; /** * Converts the nfa input to a dfa input * @param nodes The nodes for a nfa automaton * @returns The dfa equivalent automaton template */ export declare function convertNFATemplateToDFATemplate<N, T>(nodes: INormalizedNFATemplate<N, T>): INFADFATemplate<N, T>; /** * Converts the nfa input to a dfa input * @param nodes The nodes for a nfa automaton * @param getMeta A function to combine metadata of nodes and transitions, which can be used to more efficiently extract data later * @returns The dfa equivalent automaton template */ export declare function convertNFATemplateToDFATemplate<N, T, CN = unknown, CT = unknown>(nodes: INormalizedNFATemplate<N, T>, getMeta: INFADFAMetaGetters<N, T, CN, CT>): INFADFATemplate<N, T, CN, CT>; /** * Creates a transition, given a character and the node sets to transition from * @param template All the nfa input nodes * @param nodes The current state * @param char The character to transition on * @param getMeta An optional function to get extra metadata for the transition * @returns The transition for this character */ export declare function getCharacterTransition<N, T, CT = unknown>(template: Map<string, INormalizedNFANode<N, T>>, nodes: INormalizedNFANode<N, T>[], char: string, getMeta?: (sources: INormalizedNFATransition<T>[]) => CT): { transition: INFADFATransition<T, CT>; to: INormalizedNFANode<N, T>[]; }; /** * Retrieves the transition for all characters for which no specific transition exists * @param template All the nfa input nodes * @param nodes The current state * @param getMeta An optional function to get extra metadata for the transition * @returns The transition for the remaining characters */ export declare function getRemainingTransition<N, T, CT = unknown>(template: Map<string, INormalizedNFANode<N, T>>, nodes: INormalizedNFANode<N, T>[], getMeta?: (sources: INormalizedNFATransition<T>[]) => CT): { transition: INFADFATransition<T, CT>; to: INormalizedNFANode<N, T>[]; }; /** * Retrieves the transition characters found in the given set of nodes * @param nodes The nodes in which to look for transition characters * @returns The transition character set */ export declare function getAvailableTransitionCharacter<N, T>(nodes: INormalizedNFANode<N, T>[]): string[]; /** * Checks what nodes are reachable with the given set, by using empty transitions * @param template All the nfa input nodes * @param nodes The nodes to get the closure of, (may include duplicates, which will be removed) * @returns The reach of these nodes */ export declare function getReachableNodes<N, T>(template: Map<string, INormalizedNFANode<N, T>>, nodes: INormalizedNFANode<N, T>[]): { nodes: INormalizedNFANode<N, T>[]; emptyTransitions: IAugmentedNFATransition<T>[]; }; /** * Creates an ID to uniquely define a set of nodes, no matter what the order is * @param nodes The nodes to create the ID for * @returns The created ID */ export declare function createID<N, T>(nodes: (INormalizedNFANode<N, T> | string)[]): string; /** * Retrieves nodes given the list of IDs * @param map The map of items that the nodes are in * @param IDs The IDs of the nodes to retrieve * @returns The nodes */ export declare function getNodesFromIDs<T>(map: Map<string, T>, IDs: string[]): T[]; //# sourceMappingURL=convertNFATemplateToDFATemplate.d.ts.map