sparkast/lib/onesearch/NLPResult.ts
2024-04-26 18:11:29 +08:00

17 lines
496 B
TypeScript

export class NLPResult {
constructor(
public suggestion: string | null,
public intention: string | null,
public probability: number,
public confidence: number,
public relevanceBase: number = 2000,
public confidenceWeight: number = 0.2,
public type: string = "text",
) {
}
get relevance(): number {
return this.relevanceBase * this.probability + this.confidence * this.relevanceBase * this.confidenceWeight;
}
}