UNPKG

wordmap

Version:
30 lines (29 loc) 880 B
import { Token } from "wordmap-lexer"; import PermutationIndex from "./PermutationIndex"; import StaticIndex from "./StaticIndex"; /** * A collection of indexes for the corpus. */ export default class CorpusIndex { private permutationIndex; private staticIndex; /** * Returns an index of permutation metrics. */ readonly permutations: PermutationIndex; /** * Returns an index of static metrics. */ readonly static: StaticIndex; constructor(); /** * Appends sentences to the index. * The tokens must contain positional metrics for better accuracy. * * @param {Token[][]} source * @param {Token[][]} target * @param maxSourceNgramLength * @param maxTargetNgramLength */ append(source: Token[][], target: Token[][], maxSourceNgramLength: number, maxTargetNgramLength: number): void; }