sparkast/lib/onesearch/NLPResult.ts
2024-06-17 03:11:17 +08:00

18 lines
570 B
TypeScript

export class NLPResult {
constructor(
public suggestion: string | null = null,
public intention: string | null = null,
public probability: number = 0,
public confidence: number = 0,
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;
}
}