Hi,
Can Google AI OCR or the native Extract Key Phrases From Text be used to redact sensitive information on a (Liberty Create) public webpage ?
If it’s possible, could you give us a rough idea about how we would do this ?
Thanks,
Mark
Hi,
Can Google AI OCR or the native Extract Key Phrases From Text be used to redact sensitive information on a (Liberty Create) public webpage ?
If it’s possible, could you give us a rough idea about how we would do this ?
Thanks,
Mark
Hi Mark,
If the text is plain text and you have certain patterns or combinations of words you would like to censor you would only need an event action to create an alternative redacted version of the text for display, or at a push you could create a custom presenter which could do the job on the fly.
Using regex in JavaScript you could identify credit card patterns, addresses and phone numbers and replace them all with redacting characters of your choosing, ‘#’ for example.
If the information is stored in a word or pdf document that you wish to redact then you could use the integrated OCR to form a redacted transcript of the information, but not within the original documents.
function maskCreditCardNumbers(inputString) {
// Regular expression to match credit card numbers (Visa, MasterCard, American Express, Diners Club, Discover, and JCB cards)
const creditCardRegex = /^(?:4[0-9]{12}(?:[0-9]{3})?|[1-7][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[0-9]{13}|3(?:0[0-5]|[0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/;
// Replace credit card numbers with "#" characters
const maskedString = inputString.replace(creditCardRegex, "#### #### #### ####");
return maskedString;
}
// Example usage:
const originalString = "Hi here is my card number, it's Visa 4242 4242 4242 4242.";
const maskedResult = maskCreditCardNumbers(originalString);
console.log(maskedResult); // "Hi here is my card number, it's Visa #### #### #### 4242"
Hope this helps, please let me know if you need any further assistance.
Adam
Thanks very much Adam. That’s very helpful!
Mark