Formatron v0.4.9
Formatron empowers everyone to control the output format of language models with minimal overhead.
|
An extractor that extracts data corresponding to a nonterminal. More...
Public Member Functions | |
__init__ (self, str nonterminal, typing.Optional[str] capture_name=None) | |
Initialize the nonterminal extractor. | |
Public Member Functions inherited from formatron.extractor.Extractor | |
typing.Optional[tuple[str, typing.Any]] | extract (self, str input_str) |
Extract data from the input string, or None if the extraction failed. | |
__str__ (self) | |
str | kbnf_definition (self) |
typing.Optional[str] | capture_name (self) |
Get the name of the capture, or None if the extractor does not capture. | |
Protected Attributes | |
_nonterminal | |
Protected Attributes inherited from formatron.extractor.Extractor | |
_capture_name | |
Properties | |
str | nonterminal (self) |
Get the nonterminal of the extractor. | |
str | kbnf_reference (self) |
An extractor that extracts data corresponding to a nonterminal.
Definition at line 98 of file extractor.py.
formatron.extractor.NonterminalExtractor.__init__ | ( | self, | |
str | nonterminal, | ||
typing.Optional[str] | capture_name = None ) |
Initialize the nonterminal extractor.
Reimplemented from formatron.extractor.Extractor.
Reimplemented in formatron.extractor.ChoiceExtractor, formatron.extractor.SubstringExtractor, formatron.formats.json.JsonExtractor, formatron.formats.regex.RegexComplementExtractor, and formatron.formats.regex.RegexExtractor.
Definition at line 103 of file extractor.py.
str formatron.extractor.NonterminalExtractor.kbnf_reference | ( | self | ) |
Reimplemented from formatron.extractor.Extractor.
Definition at line 134 of file extractor.py.
str formatron.extractor.NonterminalExtractor.nonterminal | ( | self | ) |
Get the nonterminal of the extractor.
Definition at line 121 of file extractor.py.
|
protected |
Definition at line 106 of file extractor.py.