MCPcopy Create free account
hub / github.com/SillyTavern/Extension-WebSearch / processInputText

Function processInputText

index.js:441–458  ·  view source on GitHub ↗

* Pre-process search query input text. * @param {string} text Input text * @returns {string} Processed text

(text)

Source from the content-addressed store, hash-verified

439 * @returns {string} Processed text
440 */
441function processInputText(text) {
442 // Convert to lowercase
443 text = text.toLowerCase();
444 // Remove punctuation
445 text = text.replace(/[\\.,@#!?$%&;:{}=_~[\]]/g, '');
446 // Remove double quotes (including region-specific ones)
447 text = text.replace(/["“”]/g, '');
448 // Remove carriage returns
449 text = text.replace(/\r/g, '');
450 // Replace newlines with spaces
451 text = text.replace(/[\n]+/g, ' ');
452 // Collapse multiple spaces into one
453 text = text.replace(/\s+/g, ' ');
454 // Trim
455 text = text.trim();
456
457 return text;
458}
459
460/**
461 * Checks if the provided link is allowed to be visited or blacklisted.

Callers 1

extractSearchQueryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected