alice-and-bot 1.0.94 → 1.0.95
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/components.js +26 -9
- package/package.json +1 -1
package/components.js
CHANGED
|
@@ -3462,10 +3462,10 @@ var trim = (characters) => (str) => {
|
|
|
3462
3462
|
return str.substring(start, end + 1);
|
|
3463
3463
|
};
|
|
3464
3464
|
|
|
3465
|
-
// deno:https://jsr.io/@uri/silly-nlp/0.2.
|
|
3465
|
+
// deno:https://jsr.io/@uri/silly-nlp/0.2.16/src/index.ts
|
|
3466
3466
|
var import_npm_levenshtein_search_0_1 = __toESM(require__());
|
|
3467
3467
|
|
|
3468
|
-
// deno:https://jsr.io/@uri/silly-nlp/0.2.
|
|
3468
|
+
// deno:https://jsr.io/@uri/silly-nlp/0.2.16/src/stopWords.ts
|
|
3469
3469
|
var stopWords = [
|
|
3470
3470
|
"i",
|
|
3471
3471
|
"me",
|
|
@@ -3598,7 +3598,7 @@ var stopWords = [
|
|
|
3598
3598
|
"now"
|
|
3599
3599
|
];
|
|
3600
3600
|
|
|
3601
|
-
// deno:https://jsr.io/@uri/silly-nlp/0.2.
|
|
3601
|
+
// deno:https://jsr.io/@uri/silly-nlp/0.2.16/src/index.ts
|
|
3602
3602
|
var regExpLocations = (pattern, input) => {
|
|
3603
3603
|
const locations = [];
|
|
3604
3604
|
let match;
|
|
@@ -3758,7 +3758,12 @@ var isWordLike = (s) => s.length >= 2 && /^[A-Z]?[a-z]+$/.test(s) && /[aeiouy]/i
|
|
|
3758
3758
|
var isAllCapsWord = (s) => /^[A-Z]{2,5}$/.test(s) || s.length >= 2 && s.length <= 12 && /^[A-Z]+$/.test(s) && /[AEIOUY]/.test(s) && !/[BCDFGHJKLMNPQRSTVWXZ]{5,}/.test(s);
|
|
3759
3759
|
var isKnownWord = (word) => commonWebTerms.has(word.toLowerCase()) || isWordLike(word);
|
|
3760
3760
|
var isPureCamelWord = (p) => /^[A-Z]{2,5}$/.test(p) || isWordLike(p);
|
|
3761
|
-
var
|
|
3761
|
+
var isShortLowerAbbrev = (s) => /^[a-z]{1,4}$/.test(s);
|
|
3762
|
+
var isShortAcronym = (p) => isShortLowerAbbrev(p) || /^[A-Z][a-z]{1,3}$/.test(p);
|
|
3763
|
+
var isWordPlusDigits = (s) => letIn(/^([A-Za-z]+)(\d{1,3})$/.exec(s), (m) => m ? /^[A-Z][a-z]{0,3}$/.test(m[1]) || /^[a-z]{1,3}$/.test(m[1]) || /^[A-Z]{2,5}$/.test(m[1]) || m[1].length <= 10 && isWordLike(m[1]) || /^[A-Z]{2}[a-z]{2,6}$/.test(m[1]) : false);
|
|
3764
|
+
var isShortTechLabel = (s) => s.length <= 12 && !/^[0-9a-f]{6,}$/i.test(s) && (isWordPlusDigits(s) || /^[A-Za-z]\d{1,2}[a-z]{1,3}$/.test(s) || /^[A-Za-z][a-z]{1,6}\d[a-z]{2,6}$/.test(s));
|
|
3765
|
+
var isAuxCamelPart = (p) => /^[A-Z]$/.test(p) || isShortAcronym(p) || isShortTechLabel(p);
|
|
3766
|
+
var isLongWord = (p) => p.length >= 3 && isWordLike(p);
|
|
3762
3767
|
var isCamelCaseIdentifier = (token) => {
|
|
3763
3768
|
if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(token)) return false;
|
|
3764
3769
|
const parts = token.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(" ");
|
|
@@ -3768,8 +3773,16 @@ var isCamelCaseIdentifier = (token) => {
|
|
|
3768
3773
|
return false;
|
|
3769
3774
|
}
|
|
3770
3775
|
const pureCount = parts.filter(isPureCamelWord).length;
|
|
3771
|
-
const
|
|
3772
|
-
|
|
3776
|
+
const auxCount = parts.length - pureCount;
|
|
3777
|
+
const allCapsCount = parts.filter((p) => /^[A-Z]{2,5}$/.test(p)).length;
|
|
3778
|
+
if (allCapsCount > 1) return false;
|
|
3779
|
+
const wordChars = parts.filter(isLongWord).reduce((n, p) => n + p.length, 0);
|
|
3780
|
+
if (wordChars < token.length * 0.5) return false;
|
|
3781
|
+
if (parts.length === 2) {
|
|
3782
|
+
return parts.some((p) => p.length >= 4 && isWordLike(p)) && auxCount === 1;
|
|
3783
|
+
}
|
|
3784
|
+
const longWordCount = parts.filter(isLongWord).length;
|
|
3785
|
+
return longWordCount >= 2 && auxCount <= 2;
|
|
3773
3786
|
};
|
|
3774
3787
|
var isSlugWord = (s) => isKnownWord(s) || isAllCapsWord(s) || isCamelCaseIdentifier(s);
|
|
3775
3788
|
var isNumericSegment = (s) => /^\d+$/.test(s);
|
|
@@ -3778,13 +3791,17 @@ var isLongRandomSegment = (s) => s.length >= 12 && (characterClasses(s) >= 2 ||
|
|
|
3778
3791
|
var dictionarySlug = (token) => {
|
|
3779
3792
|
if (token.includes("+") || isUuid(token)) return false;
|
|
3780
3793
|
if (isKnownWord(token) || isCamelCaseIdentifier(token)) return true;
|
|
3781
|
-
|
|
3794
|
+
const normalized = token.startsWith("~/") ? token.slice(2) : token;
|
|
3795
|
+
return letIn(normalized.split(/[-_.:/]+/).filter((s) => s.length > 0), (segments) => {
|
|
3782
3796
|
if (segments.length < 2) return false;
|
|
3783
3797
|
const wordCount = segments.filter(isSlugWord).length;
|
|
3784
3798
|
if (wordCount === 0) return false;
|
|
3785
|
-
const nonWordOrNumeric = segments.filter((s) => !isSlugWord(s) && !isNumericSegment(s));
|
|
3799
|
+
const nonWordOrNumeric = segments.filter((s) => !isSlugWord(s) && !isNumericSegment(s) && !isShortLowerAbbrev(s));
|
|
3786
3800
|
if (nonWordOrNumeric.length === 0) return true;
|
|
3787
|
-
|
|
3801
|
+
if (nonWordOrNumeric.length === 1 && !isLongRandomSegment(nonWordOrNumeric[0])) {
|
|
3802
|
+
return wordCount >= 2 || isShortTechLabel(nonWordOrNumeric[0]);
|
|
3803
|
+
}
|
|
3804
|
+
return wordCount >= 2 && nonWordOrNumeric.length <= 2 && nonWordOrNumeric.every(isShortTechLabel);
|
|
3788
3805
|
});
|
|
3789
3806
|
};
|
|
3790
3807
|
var shannonEntropy = (token) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alice-and-bot",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.95",
|
|
4
4
|
"description": "A chat network for agents. Open-source, end-to-end encrypted messaging SDK, React chat UI, and embeddable widgets for AI agents and humans.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|