mirror of
https://github.com/keymanapp/keyman.git
synced 2026-10-20 12:57:49 +00:00
docs(web): add documentation for new search-related interfaces
Some checks failed
Keyman Build Summary / Summarize build status checks (push) Has been cancelled
Some checks failed
Keyman Build Summary / Summarize build status checks (push) Has been cancelled
This commit is contained in:
parent
eaf419f960
commit
6084bbe687
2 changed files with 47 additions and 0 deletions
|
|
@ -1,7 +1,29 @@
|
|||
/*
|
||||
* Keyman is copyright (C) SIL Global. MIT License.
|
||||
*
|
||||
* Created by jahorton on 2026-04-02
|
||||
*
|
||||
* This file defines the type used for tracking critical graph-search properties
|
||||
* utilized during correction-search by any type compatible with the
|
||||
* `getBestMatches` algorithm.
|
||||
*/
|
||||
|
||||
import { CorrectionSearchable } from "./correction-searchable.js";
|
||||
|
||||
/**
|
||||
* Any return value from `.handleNextNode()` designed for use with the
|
||||
* `getBestMatches` method must adhere to this type interface for representing
|
||||
* completed search paths.
|
||||
*/
|
||||
export interface CorrectionResultMapping<ResultType> {
|
||||
/**
|
||||
* Represents the "searchable" object through which the completed search path last traversed.
|
||||
*/
|
||||
readonly matchingSpace: CorrectionSearchable<ResultType, CorrectionResultMapping<ResultType>>;
|
||||
|
||||
/**
|
||||
* The object representing the search path completed at the current search step.
|
||||
*/
|
||||
readonly matchedResult: ResultType;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,3 +1,13 @@
|
|||
/*
|
||||
* Keyman is copyright (C) SIL Global. MIT License.
|
||||
*
|
||||
* Created by jahorton on 2026-04-02
|
||||
*
|
||||
* This file defines the interface required of objects that represent portions
|
||||
* of a search graph or search quotient-graph compatible with the
|
||||
* `getBestMatches` algorithm.
|
||||
*/
|
||||
|
||||
import { CorrectionResultMapping } from "./correction-result-mapping.js";
|
||||
|
||||
type NullPath = {
|
||||
|
|
@ -18,9 +28,24 @@ type CompleteSearchPath<MappingType> = {
|
|||
|
||||
export type PathResult<MappingType> = NullPath | IntermediateSearchPath | CompleteSearchPath<MappingType>;
|
||||
|
||||
/**
|
||||
* Represents objects that support correction search via the `getBestMatches`
|
||||
* method, providing metadata relative to optimizing the search process for
|
||||
* their represented portion of the search-graph.
|
||||
*/
|
||||
export interface CorrectionSearchable<ResultType, ResultMapping extends CorrectionResultMapping<ResultType>> {
|
||||
/**
|
||||
* The best cost found for any search paths yet unprocessed by either this "searchable" or any of its ancestors.
|
||||
*/
|
||||
readonly currentCost: number;
|
||||
|
||||
/**
|
||||
* A list of all search path results already found that terminate at this "searchable".
|
||||
*/
|
||||
readonly previousResults: ResultMapping[];
|
||||
|
||||
/**
|
||||
* Processes the most likely currently-unprocessed search path represented by this "searchable".
|
||||
*/
|
||||
handleNextNode(): PathResult<ResultMapping>;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue