Skip to content

edsnlp.utils.regex

make_pattern [source]

Create OR pattern from a list of patterns.

Parameters

PARAMETER DESCRIPTION
patterns

List of patterns to merge.

TYPE: List[str]

with_breaks

Whether to add breaks (\b) on each side, by default False

TYPE: bool DEFAULT: False

name

Name of the group, using regex ?P<> directive.

TYPE: Optional[str] DEFAULT: None

RETURNS DESCRIPTION
str

Merged pattern.

compile_regex [source]

This function tries to compile reg using the re module, and fallbacks to the regex module that is more permissive.

Parameters

PARAMETER DESCRIPTION
reg

TYPE: str

RETURNS DESCRIPTION
Union[Pattern, Pattern]