Formatron v0.4.9
Formatron empowers everyone to control the output format of language models with minimal overhead.
|
An extractor that extracts data by matching a regex complement. More...
Public Member Functions | |
__init__ (self, str regex, str capture_name, str nonterminal) | |
Initialize the regex complement extractor. | |
typing.Optional[tuple[str, str]] | extract (self, str input_str) |
Extract the data by matching a regex complement. | |
Public Member Functions inherited from formatron.extractor.NonterminalExtractor | |
str | nonterminal (self) |
Get the nonterminal of the extractor. | |
str | kbnf_reference (self) |
Public Member Functions inherited from formatron.extractor.Extractor | |
__str__ (self) | |
typing.Optional[str] | capture_name (self) |
Get the name of the capture, or None if the extractor does not capture. | |
Protected Attributes | |
_regex | |
Protected Attributes inherited from formatron.extractor.NonterminalExtractor | |
_nonterminal | |
Protected Attributes inherited from formatron.extractor.Extractor | |
_capture_name | |
Properties | |
str | kbnf_definition (self) |
An extractor that extracts data by matching a regex complement.
formatron.formats.regex.RegexComplementExtractor.__init__ | ( | self, | |
str | regex, | ||
str | capture_name, | ||
str | nonterminal ) |
Initialize the regex complement extractor.
Reimplemented from formatron.extractor.NonterminalExtractor.
typing.Optional[tuple[str, str]] formatron.formats.regex.RegexComplementExtractor.extract | ( | self, | |
str | input_str ) |
Extract the data by matching a regex complement.
Specifically, the string until the first character in the first match of the regex is extracted if there is a match, or the entire string is extracted if there is no match.
Reimplemented from formatron.extractor.Extractor.
str formatron.formats.regex.RegexComplementExtractor.kbnf_definition | ( | self | ) |
Reimplemented from formatron.extractor.Extractor.
|
protected |