| 
    Formatron v0.4.11
     
     
    
   Formatron empowers everyone to control the output format of language models with minimal overhead. 
   | 
 
The module defines the JsonExtractor class, which is used to extract data from a string in JSON format.  
More...
Classes | |
| class | JsonExtractor | 
| An extractor that loads json data to an object from a string.  More... | |
Functions | |
| None | register_generate_nonterminal_def (typing.Callable[[typing.Type, str], typing.Optional[typing.Tuple[str, typing.List[typing.Tuple[typing.Type, str]]]]] generate_nonterminal_def) | 
| Register a callable to generate nonterminal definition from a type.   | |
| _register_all_predefined_types () | |
| str | _generate_kbnf_grammar (schemas.schema.Schema|collections.abc.Sequence schema, str start_nonterminal) | 
| Generate a KBNF grammar string from a schema for JSON format.   | |
Variables | |
| str | SPACE_NONTERMINAL = "[ \t\n\r]*" | 
| str | GRAMMAR_HEADER | 
| list | _type_to_nonterminals | 
The module defines the JsonExtractor class, which is used to extract data from a string in JSON format. 
      
  | 
  protected | 
      
  | 
  protected | 
| None formatron.formats.json.register_generate_nonterminal_def | ( | typing.Callable[ [typing.Type, str], typing.Optional[typing.Tuple[str, typing.List[typing.Tuple[typing.Type, str]]]]] | generate_nonterminal_def | ) | 
Register a callable to generate nonterminal definition from a type.
The callable returns (nonterminal_definition, [(sub_type, sub_nonterminal), ...]) if the type is supported by this callable, otherwise None. [(sub_type, sub_nonterminal), ...] are the types and nonterminals used in nonterminal_definition that may need to be generated in the grammar too.
| generate_nonterminal_def | A callable to generate nonterminal definition from a type. | 
| str formatron.formats.json.GRAMMAR_HEADER |