UNPKG

wordmap

Version:
33 lines (32 loc) 1.34 kB
import Algorithm from "../Algorithm"; import CorpusIndex from "../index/CorpusIndex"; import Prediction from "../structures/Prediction"; /** * Determines how unique the n-gram is. */ export default class Uniqueness extends Algorithm { /** * Performs the uniqueness calculation. * This is the pure algorithm code. * @param sourceNgramFrequency - source n-gram frequency in the static corpus * @param targetNgramFrequency - target n-gram frequency in the static corpus * @param sourceTokenLength - length of the source text in units of {@link Token} * @param targetTokenLength - length of the target text in units of {@link Token} * @param phrasePlausibility - the likely hood that the n-gram is a phrase. Produced by {@link PhrasePlausibility} */ static calc(sourceNgramFrequency: number, targetNgramFrequency: number, sourceTokenLength: number, targetTokenLength: number, phrasePlausibility: number): number; /** * Calculates the uniqueness of the n-gram * @param p * @param cIndex */ private static calcUniqueness; /** * Calculates the uniqueness of the n-gram based on the lemma * @param p * @param cIndex */ private static calcLemmaUniqueness; name: string; execute(prediction: Prediction, cIndex: CorpusIndex): Prediction; }