llmshield.matchers package

Subpackages

Submodules

llmshield.matchers.functions module

List of functions-based matchers used to detect entities.

Description:

This module contains utility functions used for entity validation and detection. Currently includes specialised validation algorithms such as the Luhn check for credit card validation.

Functions:

_luhn_check: Validates card numbers using the Luhn algorithm

Author:

LLMShield by brainpolo, 2025

llmshield.matchers.lists module

List of list-based matchers used to detect entities.

Description:

This module contains lists of keywords and components used for entity detection. These lists include person titles, organisation identifiers, place components, and punctuation markers that help identify and classify different types of entities in text.

Lists:

EN_PUNCTUATION: Common English punctuation marks EN_PERSON_INITIALS: Titles and honorifics for person detection EN_ORG_COMPONENTS: Corporate suffixes and identifiers EN_PLACE_COMPONENTS: Street and place name components

Author:

LLMShield by brainpolo, 2025

llmshield.matchers.regex module

List of regex-based matchers used to detect entities.

Description:

This module contains compiled regular expression patterns for detecting various types of sensitive information including email addresses, credit card numbers, IP addresses, URLs, and phone numbers. Each pattern is carefully crafted to balance accuracy and performance.

Patterns:

EMAIL_ADDRESS_PATTERN: Matches email addresses CREDIT_CARD_PATTERN: Matches credit card numbers (various formats) IP_ADDRESS_PATTERN: Matches IPv4 addresses URL_PATTERN: Matches HTTP/HTTPS URLs PHONE_NUMBER_PATTERN: Matches phone numbers (US and international)

Author:

LLMShield by brainpolo, 2025

Module contents

Entity matching modules for pattern detection and classification.

Description:

This subpackage contains various matching algorithms and utilities for detecting different types of entities in text, including regex patterns, dictionary lookups, and custom validation functions.

Submodules:

functions: Utility functions for entity validation regex: Regular expression patterns for entity detection lists: List-based patterns and collections dicts: Dictionary data files for known entities

Author:

LLMShield by brainpolo, 2025