synonym-optimizer
Version:
Finds the text which has the least number of repetitions
31 lines (30 loc) • 1.42 kB
TypeScript
/**
* @license
* Copyright 2019 Ludan Stoecklé
* SPDX-License-Identifier: Apache-2.0
*/
interface WordsWithPos {
[key: string]: number[];
}
interface IdenticalsMap {
[key: string]: string;
}
export interface DebugHolder {
filteredAlt?: string[] | null;
identicals?: string[][] | null;
identicalsMap?: IdenticalsMap | null;
wordsWithPos?: WordsWithPos | null;
score?: number | null;
}
export declare class SynOptimizer {
private languageSyn;
constructor(language: string);
getStopWords(stopWordsToAdd: string[] | null | undefined, stopWordsToRemove: string[] | null | undefined, stopWordsOverride: string[] | null | undefined): string[];
scoreAlternative(alternative: string, stopWordsToAdd: string[] | null | undefined, stopWordsToRemove: string[] | null | undefined, stopWordsOverride: string[] | null | undefined, identicals: string[][] | null | undefined, debugHolder: DebugHolder | null | undefined): number;
getStemmedWords(text: string, stopwords: string[]): string[];
getBest(alternatives: string[], stopWordsToAdd: string[], stopWordsToRemove: string[], stopWordsOverride: string[], identicals: string[][]): number;
getScore(wordsWithPos: WordsWithPos): number;
stemWord(word: string): string;
getWordsWithPos(words: string[], identicals: string[][] | null | undefined, debugHolder: DebugHolder | null | undefined): WordsWithPos;
}
export {};