pi-memory-evolution 0.2.4 → 0.2.6

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.
@@ -61,7 +61,7 @@ export function features(text: string, includeSingle = false): Set<string> {
61
61
  const result = new Set<string>();
62
62
  let prose = redact(text).replace(/\[REDACTED[^\]\n]*\]/gu, " ");
63
63
  prose = prose.replace(LITERALS, (literal) => {
64
- const clean = literal.replace(/[.:]+$/u, "").toLowerCase();
64
+ const clean = literal.replace(/[.:]+$/u, ''); // Literal resource identity is case-sensitive, unlike prose.
65
65
  result.add(`literal:${clean}`);
66
66
  result.add(`literal:${clean.split("/").at(-1)}`);
67
67
  return " ";
@@ -94,7 +94,7 @@ export function featureOffset(text: string, feature: string): number {
94
94
  pattern.lastIndex = 0;
95
95
  return pattern.exec(prose)?.index ?? -1;
96
96
  }
97
- return prose.toLowerCase().indexOf(feature.replace(/^literal:/u, ""));
97
+ return feature.startsWith('literal:') ? text.indexOf(feature.slice(8)) : prose.toLowerCase().indexOf(feature);
98
98
  }
99
99
 
100
100
  export function validSearchTerms(value: unknown): value is string[] | undefined {