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 +3 -2
- package/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/predictor.js +2 -0
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
package/package.json
CHANGED
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);
|