UNPKG

generate-words-freqmap

Version:
35 lines (31 loc) 1.3 kB
import { freqMapType } from 'fullfiller-common/src/types'; /** * @property emphasizeBy `wordsToEmphasize` will have their weight multiplied by this number. * @property wordsQuantityMin Return should have at least this quantity of words, otherwise error. * @property tierWeightMin Filter out from return any tier which weight is less than this number. * @property tierWeightMax Filter out from return any tier which weight is more than this number. * @property mergePosteriorTiersAt Merge at this tier all posterior tiers (tiers w/ higher weight). * @property caseInsensitive If `true`, all words will be converted to lowercase. */ type optionsType = { emphasizeBy: number; wordsQuantityMin: number; tierWeightMin: number; tierWeightMax: number; mergePosteriorTiersAt: number; caseInsensitive: boolean; }; /** * Generate `freqMap` from `wordsArray`. * @param wordsArray * @param wordsToEmphasize Subset of `wordsArray` to emphasize. * @param optionsArg Miscellaneous options. * @throws Error if `freqMap` has less words than required by `options.wordsQuantityMin`. * @returns freqMap. */ declare function generateFreqMap( wordsArray: string[], wordsToEmphasize?: string[], optionsArg?: Partial<optionsType> ): freqMapType; export { generateFreqMap as default };