|
Formatron v0.4.9
Formatron empowers everyone to control the output format of language models with minimal overhead.
|
An extractor that extracts a literal string. More...
Public Member Functions | |
| __init__ (self, str literal) | |
| Initialize the literal extractor. | |
| typing.Optional[tuple[str, str]] | extract (self, str input_str) |
Extract the literal from the input string, or None if the literal is not found. | |
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 | |
| _literal | |
Protected Attributes inherited from formatron.extractor.Extractor | |
| _capture_name | |
Properties | |
| str | kbnf_reference (self) |
| str | kbnf_definition (self) |
An extractor that extracts a literal string.
Definition at line 143 of file extractor.py.
| formatron.extractor.LiteralExtractor.__init__ | ( | self, | |
| str | literal ) |
Initialize the literal extractor.
It never captures since capturing a literal is redundant.
| literal | The literal string to extract. |
Reimplemented from formatron.extractor.Extractor.
Definition at line 151 of file extractor.py.
| typing.Optional[tuple[str, str]] formatron.extractor.LiteralExtractor.extract | ( | self, | |
| str | input_str ) |
Extract the literal from the input string, or None if the literal is not found.
Reimplemented from formatron.extractor.Extractor.
Definition at line 158 of file extractor.py.
| str formatron.extractor.LiteralExtractor.kbnf_definition | ( | self | ) |
Reimplemented from formatron.extractor.Extractor.
Definition at line 185 of file extractor.py.
| str formatron.extractor.LiteralExtractor.kbnf_reference | ( | self | ) |
Reimplemented from formatron.extractor.Extractor.
Definition at line 172 of file extractor.py.
|
protected |
Definition at line 153 of file extractor.py.