unitxt.templates module
- class unitxt.templates.MultiLabelTemplate(*argv, **kwargs)
Bases:
InputOutputTemplate- postprocessors: List[str] = ['processors.to_list_by_comma']
- class unitxt.templates.MultiReferenceTemplate(*argv, **kwargs)
Bases:
InputOutputTemplate
- class unitxt.templates.OutputQuantizingTemplate(*argv, **kwargs)
Bases:
InputOutputTemplate
- class unitxt.templates.SpanLabelingBaseTemplate(*argv, **kwargs)
Bases:
MultiLabelTemplate
- class unitxt.templates.SpanLabelingJsonTemplate(*argv, **kwargs)
Bases:
SpanLabelingBaseTemplate- postprocessors: List[str] = ['processors.load_json', 'processors.dict_of_lists_to_value_key_pairs']
- class unitxt.templates.SpanLabelingTemplate(*argv, **kwargs)
Bases:
SpanLabelingBaseTemplate- escape_characters: List[str] = [':', ',']
- postprocessors: List[str] = ['processors.to_span_label_pairs']
- class unitxt.templates.Template(*argv, **kwargs)
Bases:
StreamInstanceOperatorThe role of template is to take the fields of every instance and verbalize it.
Meaning the template is taking the instance and generating source, target and references.
- class unitxt.templates.TemplatesList(*argv, **kwargs)
Bases:
ListCollection
- class unitxt.templates.YesNoTemplate(*argv, **kwargs)
Bases:
TemplateA template for generating binary Yes/No questions asking whether an input text is of a specific class.
- input_format:
Defines the format of the question.
- class_field:
Defines the field that contains the name of the class that this template asks of.
- label_field:
Defines the field which contains the true label of the input text. If a gold label is equal to the value in class_name, then the correct output is self.yes_answer (by default, “Yes”). Otherwise the correct output is self.no_answer (by default, “No”).
- yes_answer:
The output value for when the gold label equals self.class_name. Defaults to “Yes”.
- no_answer:
The output value for when the gold label differs from self.class_name. Defaults to “No”.
- unitxt.templates.escape_chars(s, chars_to_escape)