investira.sdk 2.4.34 → 2.4.35
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/CHANGELOG.md +5 -0
- package/lib/utils/rags.js +38 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
package/lib/utils/rags.js
CHANGED
|
@@ -1,4 +1,42 @@
|
|
|
1
1
|
const rags = {
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Enriquecimento textual para embedding.
|
|
5
|
+
*
|
|
6
|
+
* Acrescenta aliases calculados para números e datas no mesmo texto da query,
|
|
7
|
+
* preservando o texto original e adicionando variantes relevantes para ampliar
|
|
8
|
+
* chance de similaridade vetorial entre formatos equivalentes.
|
|
9
|
+
*/
|
|
10
|
+
extractAliases: pText => {
|
|
11
|
+
const xBaseText = String(pText || '').trim();
|
|
12
|
+
if (!xBaseText) {
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const xAccentlessAliases = rags.extractAccentlessAliases(xBaseText);
|
|
17
|
+
const xNumericAliases = rags.extractNumericAliases(xBaseText);
|
|
18
|
+
const xDateAliases = rags.extractDateAliases(xBaseText);
|
|
19
|
+
const xAlphanumericCodeAliases = rags.extractAlphanumericCodeAliases(xBaseText);
|
|
20
|
+
const xAliasLines = [];
|
|
21
|
+
|
|
22
|
+
if (xAccentlessAliases.length) {
|
|
23
|
+
xAliasLines.push(`a_sa: ${xAccentlessAliases.join(' ')}`);
|
|
24
|
+
}
|
|
25
|
+
if (xNumericAliases.length) {
|
|
26
|
+
xAliasLines.push(`a_num: ${xNumericAliases.join(' ')}`);
|
|
27
|
+
}
|
|
28
|
+
if (xDateAliases.length) {
|
|
29
|
+
xAliasLines.push(`a_dt: ${xDateAliases.join(' ')}`);
|
|
30
|
+
}
|
|
31
|
+
if (xAlphanumericCodeAliases.length) {
|
|
32
|
+
xAliasLines.push(`a_cod: ${xAlphanumericCodeAliases.join(' ')}`);
|
|
33
|
+
}
|
|
34
|
+
if (!xAliasLines.length) {
|
|
35
|
+
return xBaseText;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return [xBaseText, ...xAliasLines].join('\n');
|
|
39
|
+
},
|
|
2
40
|
/**
|
|
3
41
|
* Extrai aliases sem acentuação para tokens com diacríticos.
|
|
4
42
|
*
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "investira.sdk",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.35",
|
|
4
4
|
"author": "Investira",
|
|
5
5
|
"description": "Investira SDK",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"type": "commonjs",
|
|
8
8
|
"registry": true,
|
|
9
|
-
"raw": "investira.sdk@2.4.
|
|
9
|
+
"raw": "investira.sdk@2.4.35",
|
|
10
10
|
"escapedName": "investira.sdk",
|
|
11
|
-
"rawSpec": "2.4.
|
|
11
|
+
"rawSpec": "2.4.35",
|
|
12
12
|
"saveSpec": null,
|
|
13
|
-
"fetchSpec": "2.4.
|
|
13
|
+
"fetchSpec": "2.4.35",
|
|
14
14
|
"homepage": "https://investira.com.br/",
|
|
15
15
|
"engines": {
|
|
16
16
|
"node": ">=11.11.0 <=18.21.0",
|