@velvetmonkey/vault-core 2.0.99 → 2.0.101
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/types.d.ts +2 -2
- package/dist/wikilinks.js +28 -5
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -133,7 +133,7 @@ export interface ImplicitEntityConfig {
|
|
|
133
133
|
* Which patterns to use for detection
|
|
134
134
|
* @default ['proper-nouns']
|
|
135
135
|
*/
|
|
136
|
-
implicitPatterns?: Array<'proper-nouns' | 'single-caps' | 'camel-case' | 'acronyms'>;
|
|
136
|
+
implicitPatterns?: Array<'proper-nouns' | 'quoted-terms' | 'single-caps' | 'camel-case' | 'acronyms'>;
|
|
137
137
|
/**
|
|
138
138
|
* Regex patterns to exclude from implicit detection
|
|
139
139
|
* @default ['^The ', '^A ', '^An ', '^This ', '^That ', '^These ', '^Those ']
|
|
@@ -165,7 +165,7 @@ export interface ImplicitEntityMatch {
|
|
|
165
165
|
/** End position in content */
|
|
166
166
|
end: number;
|
|
167
167
|
/** Detection method used */
|
|
168
|
-
pattern: 'proper-nouns' | 'single-caps' | 'camel-case' | 'acronyms';
|
|
168
|
+
pattern: 'proper-nouns' | 'quoted-terms' | 'single-caps' | 'camel-case' | 'acronyms';
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
171
171
|
* Options for resolving alias-based wikilinks
|
package/dist/wikilinks.js
CHANGED
|
@@ -465,7 +465,7 @@ export function resolveAliasWikilinks(content, entities, options = {}) {
|
|
|
465
465
|
*/
|
|
466
466
|
const DEFAULT_IMPLICIT_CONFIG = {
|
|
467
467
|
detectImplicit: false,
|
|
468
|
-
implicitPatterns: ['proper-nouns'],
|
|
468
|
+
implicitPatterns: ['proper-nouns', 'quoted-terms'],
|
|
469
469
|
excludePatterns: ['^The ', '^A ', '^An ', '^This ', '^That ', '^These ', '^Those '],
|
|
470
470
|
minEntityLength: 3,
|
|
471
471
|
};
|
|
@@ -616,6 +616,21 @@ export function detectImplicitEntities(content, config = {}) {
|
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
+
// Pattern 3: Quoted terms (explicit entity markers)
|
|
620
|
+
// Matches "Turbopump" -> [[Turbopump]]
|
|
621
|
+
if (implicitPatterns.includes('quoted-terms')) {
|
|
622
|
+
const quotedRegex = /"([^"]{3,30})"/g;
|
|
623
|
+
let match;
|
|
624
|
+
while ((match = quotedRegex.exec(content)) !== null) {
|
|
625
|
+
const text = match[1];
|
|
626
|
+
const start = match.index;
|
|
627
|
+
const end = start + match[0].length;
|
|
628
|
+
if (!shouldExclude(text) && !isProtected(start, end)) {
|
|
629
|
+
detected.push({ text, start, end, pattern: 'quoted-terms' });
|
|
630
|
+
seenTexts.add(text.toLowerCase());
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
619
634
|
// Pattern 4: CamelCase words (TypeScript, YouTube, HuggingFace)
|
|
620
635
|
if (implicitPatterns.includes('camel-case')) {
|
|
621
636
|
const camelRegex = /\b([A-Z][a-z]+[A-Z][a-zA-Z]*)\b/g;
|
|
@@ -745,10 +760,18 @@ export function processWikilinks(content, entities, options = {}) {
|
|
|
745
760
|
let wikilink;
|
|
746
761
|
let replaceStart;
|
|
747
762
|
let replaceEnd;
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
763
|
+
if (match.pattern === 'quoted-terms') {
|
|
764
|
+
// Replace "Term" with [[Term]] (remove quotes)
|
|
765
|
+
wikilink = `[[${match.text}]]`;
|
|
766
|
+
replaceStart = match.start;
|
|
767
|
+
replaceEnd = match.end;
|
|
768
|
+
}
|
|
769
|
+
else {
|
|
770
|
+
// Replace Term with [[Term]]
|
|
771
|
+
wikilink = `[[${match.text}]]`;
|
|
772
|
+
replaceStart = match.start;
|
|
773
|
+
replaceEnd = match.end;
|
|
774
|
+
}
|
|
752
775
|
processedContent =
|
|
753
776
|
processedContent.slice(0, replaceStart) +
|
|
754
777
|
wikilink +
|
package/package.json
CHANGED