sparkast/lib/onesearch/NLPResult.ts
2024-04-26 22:43:47 +08:00

18 lines
548 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",
public prompt?: string | React.ReactElement
) {
}
get relevance(): number {
return this.relevanceBase * this.probability + this.confidence * this.relevanceBase * this.confidenceWeight;
}
}