<commit_before># regtemplate
Python class for parsing a template into a regex, used for matching into name-value pairs.

## Usage

### Basic usage example:
````
template = RegTemplate('some/dir')

# Parse a template from a file inside the base directory
template.parse_template_from_file('file_inside_some_dir.txt')

# Or parse from a string:
# template.parse('template string here')

# Match an output string against the template. Name/value pairs are returned.
pairs = template.match('some output text')
<commit_msg>Updated readme with pointer to examples<commit_after># regtemplate
Python class for parsing a template into a regex, used for matching into name-value pairs.

## Usage

See also examples in the examples folder.

### Basic usage example:
````
template = RegTemplate('some/dir')

# Parse a template from a file inside the base directory
template.parse_template_from_file('file_inside_some_dir.txt')

# Or parse from a string:
# template.parse('template string here')

# Match an output string against the template. Name/value pairs are returned.
pairs = template.match('some output text')

{'fraction_non_alphanumeric': 0.08778280542986425, 'fraction_numerical': 0.0, 'mean_word_length': 5.248587570621469, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1932690', 'n_tokens_mistral': 303, 'n_tokens_neox': 292, 'n_words': 126}