entity-predictor 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -63,7 +63,8 @@ Output:
63
63
  {
64
64
  entity: "STATE BANK OF INDIA",
65
65
  confidence: 1,
66
- confidenceLevel: "Trustable"
66
+ confidenceLevel: "Trustable",
67
+ input: "sbi"
67
68
  }
68
69
  */
69
70
  ```
@@ -141,7 +142,7 @@ predictor.addEntity("PUNJAB NATIONAL BANK", ["PNB"]);
141
142
 
142
143
  - `input`: String to search for.
143
144
  - `threshold`: (Optional) Minimum confidence score (default `0.6`).
144
- - **Returns**: Best match object, `{ entity: "UNKNOWN", ... }` if no match found, or `null` if input is invalid.
145
+ - **Returns**: Best match object `{ entity: string, confidence: number, input: string, ... }`, `{ entity: "UNKNOWN", input: string, ... }` if no match found, or `null` if input is invalid.
145
146
 
146
147
  ### `predictTop(input, limit, threshold)`
147
148
 
package/index.d.ts CHANGED
@@ -13,6 +13,7 @@ export interface PredictionResult {
13
13
  entity: string;
14
14
  confidence: number;
15
15
  confidenceLevel: "Trustable" | "High Confidence" | "Moderate Confidence" | "Low Confidence";
16
+ input: string;
16
17
  }
17
18
 
18
19
  export class EntityPredictor {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "entity-predictor",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Lightweight, Zero Dependency Node.js library for entity name prediction and normalization.",
5
5
  "types": "index.d.ts",
6
6
  "type": "module",
package/src/predictor.js CHANGED
@@ -127,6 +127,7 @@ export class EntityPredictor {
127
127
  entity: "UNKNOWN",
128
128
  confidence: 0,
129
129
  confidenceLevel: "Low Confidence",
130
+ input,
130
131
  };
131
132
  }
132
133
 
@@ -151,6 +152,7 @@ export class EntityPredictor {
151
152
  entity: this.candidateToEntity[index],
152
153
  confidence: Number(rating?.rating?.toFixed(2)),
153
154
  confidenceLevel: this._getConfidenceLevel(rating?.rating),
155
+ input,
154
156
  }))
155
157
  .filter((m) => m.confidence >= threshold)
156
158
  .sort((a, b) => b.confidence - a.confidence);