blob: cc6dd61a4760662785bd759689307588aee9252c [file] [log] [blame]
export * from './utils';
/** Options for ROUGE-N evaluation */
export interface RougeNOptions {
/** The size of the ngram used (default: 1) */
n?: number;
/** The beta value used for the f-measure (default: 1.0) */
beta?: number;
/** Whether comparison is case-sensitive (default: true) */
caseSensitive?: boolean;
/** Custom ngram generator function */
nGram?: (tokens: string[], n: number) => string[];
/** Custom string tokenizer */
tokenizer?: (input: string) => string[];
}
/** Options for ROUGE-S (skip-bigram) evaluation */
export interface RougeSOptions {
/** The beta value used for the f-measure (default: 1.0) */
beta?: number;
/** Whether comparison is case-sensitive (default: true) */
caseSensitive?: boolean;
/** Maximum skip distance between words (default: Infinity) */
maxSkip?: number;
/** Custom skip-bigram generator function */
skipBigram?: (tokens: string[], maxSkip?: number) => string[];
/** Custom string tokenizer */
tokenizer?: (input: string) => string[];
}
/** Options for ROUGE-L (LCS) evaluation */
export interface RougeLOptions {
/** The beta value used for the f-measure (default: 1.0) */
beta?: number;
/** Whether comparison is case-sensitive (default: true) */
caseSensitive?: boolean;
/** Custom LCS function */
lcs?: (a: string[], b: string[]) => string[];
/** Custom sentence segmenter */
segmenter?: (input: string) => string[];
/** Custom string tokenizer */
tokenizer?: (input: string) => string[];
}
/**
* Computes the ROUGE-N score for a candidate summary.
*
* Configuration object schema and defaults:
* ```
* {
* n: 1 // The size of the ngram used
* beta: 1.0 // The beta value used for the f-measure
* caseSensitive: true // Whether comparison is case-sensitive
* nGram: <inbuilt function>, // The ngram generator function
* tokenizer: <inbuilt function> // The string tokenizer
* }
* ```
*
* `nGram` has a type signature of ((Array<string>, number) => Array<string>)
* `tokenizer` has a type signature of ((string) => Array<string)
*
* @method n
* @param {string} cand The candidate summary to be evaluated
* @param {string} ref The reference summary to be evaluated against
* @param {Object} opts Configuration options (see example)
* @return {number} The ROUGE-N F-score
*/
export declare function n(cand: string, ref: string, opts?: RougeNOptions): number;
/**
* Computes the ROUGE-S score for a candidate summary.
*
* Configuration object schema and defaults:
* ```
* {
* beta: 1.0 // The beta value used for the f-measure
* caseSensitive: true // Whether comparison is case-sensitive
* maxSkip: Infinity // Maximum skip distance between words
* skipBigram: <inbuilt function>, // The skip-bigram generator function
* tokenizer: <inbuilt function> // The string tokenizer
* }
* ```
*
* `skipBigram` has a type signature of ((Array<string>, number) => Array<string>)
* `tokenizer` has a type signature of ((string) => Array<string)
*
* @method s
* @param {string} cand The candidate summary to be evaluated
* @param {string} ref The reference summary to be evaluated against
* @param {Object} opts Configuration options (see example)
* @return {number} The ROUGE-S score
*/
export declare function s(cand: string, ref: string, opts?: RougeSOptions): number;
/**
* Computes the ROUGE-L score for a candidate summary
*
* Configuration object schema and defaults:
* ```
* {
* beta: 1.0 // The beta value used for the f-measure
* caseSensitive: true // Whether comparison is case-sensitive
* lcs: <inbuilt function> // The least common subsequence function
* segmenter: <inbuilt function>, // The sentence segmenter
* tokenizer: <inbuilt function> // The string tokenizer
* }
* ```
*
* `lcs` has a type signature of ((Array<string>, Array<string>) => Array<string>)
* `segmenter` has a type signature of ((string) => Array<string)
* `tokenizer` has a type signature of ((string) => Array<string)
*
* @method l
* @param {string} cand The candidate summary to be evaluated
* @param {string} ref The reference summary to be evaluated against
* @param {Object} opts Configuration options (see example)
* @return {number} The ROUGE-L score
*/
export declare function l(cand: string, ref: string, opts?: RougeLOptions): number;
//# sourceMappingURL=rouge.d.ts.map