DEFINITION
Contextual Matching
Detecting sensitive data by combining structural patterns with surrounding context, instead of relying on regex alone.
In depth
Pure regular-expression detection produces too many false positives on free-form text — every nine-digit number is not a Social Security Number, every name is not a client. Contextual matching pairs a structural rule (digit format, checksum, named-entity tag) with a contextual signal (nearby keyword, document section, surrounding language). A nine-digit string near the words 'employer ID' is treated differently than the same string near 'patient SSN'. Contextual matching is the difference between a noisy detector that nobody trusts and a precise one that surfaces real risk.
Examples
- Flagging a name only when it appears within ten tokens of 'plaintiff', 'witness', or 'client'.
- Treating a Luhn-valid 16-digit number as a credit card only inside billing-related text.
- Matching ICD-10 codes only in clinical contexts, not in general technical writing.
How Locke handles contextual matching
Locke's on-device detection layers structural rules with contextual signals: keyword proximity, document type, named-entity recognition, and per-industry profiles. The result is detection that is sensitive enough to catch indirect identifiers and specific enough to avoid yellow-screen fatigue.
See the productRelated terms
- Personally Identifiable Information (PII)
Any information that can identify a specific person, either directly (name, SSN) or in combination with other data (zip code + birthdate).
- Data Masking
Replacing sensitive values with realistic-looking substitutes so the data remains usable while the originals never leave the device.
- On-Device AI
Running model inference or pre-processing entirely on the user's machine instead of sending data to a cloud service.