@hiveai/core 0.23.0 → 0.24.0
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/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3362,10 +3362,21 @@ function pickDistinctiveToken(text) {
|
|
|
3362
3362
|
const best = [...candidates.values()].sort((a, b) => b.score - a.score)[0];
|
|
3363
3363
|
return best?.raw ?? null;
|
|
3364
3364
|
}
|
|
3365
|
+
var FILE_EXT_REF = /\.(ts|tsx|js|jsx|mjs|cjs|py|go|rs|java|kt|swift|rb|php|cs|cpp|c|h|md|json|ya?ml|toml|lock)\b/i;
|
|
3366
|
+
function isDegenerateToken(token) {
|
|
3367
|
+
if (/^[\d.\-:_]+$/.test(token)) return true;
|
|
3368
|
+
if (/\d+\s*-\s*\d+/.test(token)) return true;
|
|
3369
|
+
if (FILE_EXT_REF.test(token)) return true;
|
|
3370
|
+
const letters = (token.match(/[A-Za-z]/g) ?? []).length;
|
|
3371
|
+
const digits = (token.match(/\d/g) ?? []).length;
|
|
3372
|
+
if (digits >= 3 && letters <= 1) return true;
|
|
3373
|
+
return false;
|
|
3374
|
+
}
|
|
3365
3375
|
function isDistinctiveToken2(token, isCodeLike) {
|
|
3366
3376
|
if (token.length < 4 || token.length > 80) return false;
|
|
3367
3377
|
if (/^https?:\/\//i.test(token)) return false;
|
|
3368
3378
|
if (/^\d+$/.test(token)) return false;
|
|
3379
|
+
if (isDegenerateToken(token)) return false;
|
|
3369
3380
|
const lower = token.toLowerCase();
|
|
3370
3381
|
if (SENSOR_STOPWORDS.has(lower)) return false;
|
|
3371
3382
|
if (!/[A-Za-z]/.test(token)) return false;
|
|
@@ -3376,6 +3387,7 @@ function isBoringValue(value) {
|
|
|
3376
3387
|
if (!value || value.length > 80) return true;
|
|
3377
3388
|
const lower = value.toLowerCase();
|
|
3378
3389
|
if (lower === "true" || lower === "false") return false;
|
|
3390
|
+
if (isDegenerateToken(value)) return true;
|
|
3379
3391
|
return SENSOR_STOPWORDS.has(lower);
|
|
3380
3392
|
}
|
|
3381
3393
|
function sensorMessageFromBody(body, token) {
|