๐ atisยถ
Note
ID: cards.atis | Type: TaskCard
{
"loader": {
"path": "tuetschek/atis",
"type": "load_hf"
},
"preprocess_steps": [
{
"delimiter": " ",
"field_to_field": {
"slots": "labels",
"text": "tokens"
},
"type": "split_strip"
},
{
"begin_labels": [
"B-aircraft_code",
"B-airline_code",
"B-airline_name",
"B-airport_code",
"B-airport_name",
"B-arrive_date.date_relative",
"B-arrive_date.day_name",
"B-arrive_date.day_number",
"B-arrive_date.month_name",
"B-arrive_date.today_relative",
"B-arrive_time.end_time",
"B-arrive_time.period_mod",
"B-arrive_time.period_of_day",
"B-arrive_time.start_time",
"B-arrive_time.time",
"B-arrive_time.time_relative",
"B-city_name",
"B-class_type",
"B-connect",
"B-cost_relative",
"B-day_name",
"B-day_number",
"B-days_code",
"B-depart_date.date_relative",
"B-depart_date.day_name",
"B-depart_date.day_number",
"B-depart_date.month_name",
"B-depart_date.today_relative",
"B-depart_date.year",
"B-depart_time.end_time",
"B-depart_time.period_mod",
"B-depart_time.period_of_day",
"B-depart_time.start_time",
"B-depart_time.time",
"B-depart_time.time_relative",
"B-economy",
"B-fare_amount",
"B-fare_basis_code",
"B-flight_days",
"B-flight_mod",
"B-flight_number",
"B-flight_stop",
"B-flight_time",
"B-fromloc.airport_code",
"B-fromloc.airport_name",
"B-fromloc.city_name",
"B-fromloc.state_code",
"B-fromloc.state_name",
"B-meal",
"B-meal_code",
"B-meal_description",
"B-mod",
"B-month_name",
"B-or",
"B-period_of_day",
"B-restriction_code",
"B-return_date.date_relative",
"B-return_date.day_name",
"B-return_date.day_number",
"B-return_date.month_name",
"B-return_date.today_relative",
"B-return_time.period_mod",
"B-return_time.period_of_day",
"B-round_trip",
"B-state_code",
"B-state_name",
"B-stoploc.airport_name",
"B-stoploc.city_name",
"B-stoploc.state_code",
"B-time",
"B-time_relative",
"B-today_relative",
"B-toloc.airport_code",
"B-toloc.airport_name",
"B-toloc.city_name",
"B-toloc.country_name",
"B-toloc.state_code",
"B-toloc.state_name",
"B-transport_type"
],
"inside_labels": [
"I-aircraft_code",
"I-airline_code",
"I-airline_name",
"I-airport_code",
"I-airport_name",
"I-arrive_date.date_relative",
"I-arrive_date.day_name",
"I-arrive_date.day_number",
"I-arrive_date.month_name",
"I-arrive_date.today_relative",
"I-arrive_time.end_time",
"I-arrive_time.period_mod",
"I-arrive_time.period_of_day",
"I-arrive_time.start_time",
"I-arrive_time.time",
"I-arrive_time.time_relative",
"I-city_name",
"I-class_type",
"I-connect",
"I-cost_relative",
"I-day_name",
"I-day_number",
"I-days_code",
"I-depart_date.date_relative",
"I-depart_date.day_name",
"I-depart_date.day_number",
"I-depart_date.month_name",
"I-depart_date.today_relative",
"I-depart_date.year",
"I-depart_time.end_time",
"I-depart_time.period_mod",
"I-depart_time.period_of_day",
"I-depart_time.start_time",
"I-depart_time.time",
"I-depart_time.time_relative",
"I-economy",
"I-fare_amount",
"I-fare_basis_code",
"I-flight_days",
"I-flight_mod",
"I-flight_number",
"I-flight_stop",
"I-flight_time",
"I-fromloc.airport_code",
"I-fromloc.airport_name",
"I-fromloc.city_name",
"I-fromloc.state_code",
"I-fromloc.state_name",
"I-meal",
"I-meal_code",
"I-meal_description",
"I-mod",
"I-month_name",
"I-or",
"I-period_of_day",
"I-restriction_code",
"I-return_date.date_relative",
"I-return_date.day_name",
"I-return_date.day_number",
"I-return_date.month_name",
"I-return_date.today_relative",
"I-return_time.period_mod",
"I-return_time.period_of_day",
"I-round_trip",
"I-state_code",
"I-state_name",
"I-stoploc.airport_name",
"I-stoploc.city_name",
"I-stoploc.state_code",
"I-time",
"I-time_relative",
"I-today_relative",
"I-toloc.airport_code",
"I-toloc.airport_name",
"I-toloc.city_name",
"I-toloc.country_name",
"I-toloc.state_code",
"I-toloc.state_name",
"I-transport_type"
],
"labels": [
"aircraft_code",
"airline_code",
"airline_name",
"airport_code",
"airport_name",
"arrive_date.date_relative",
"arrive_date.day_name",
"arrive_date.day_number",
"arrive_date.month_name",
"arrive_date.today_relative",
"arrive_time.end_time",
"arrive_time.period_mod",
"arrive_time.period_of_day",
"arrive_time.start_time",
"arrive_time.time",
"arrive_time.time_relative",
"city_name",
"class_type",
"connect",
"cost_relative",
"day_name",
"day_number",
"days_code",
"depart_date.date_relative",
"depart_date.day_name",
"depart_date.day_number",
"depart_date.month_name",
"depart_date.today_relative",
"depart_date.year",
"depart_time.end_time",
"depart_time.period_mod",
"depart_time.period_of_day",
"depart_time.start_time",
"depart_time.time",
"depart_time.time_relative",
"economy",
"fare_amount",
"fare_basis_code",
"flight_days",
"flight_mod",
"flight_number",
"flight_stop",
"flight_time",
"fromloc.airport_code",
"fromloc.airport_name",
"fromloc.city_name",
"fromloc.state_code",
"fromloc.state_name",
"meal",
"meal_code",
"meal_description",
"mod",
"month_name",
"or",
"period_of_day",
"restriction_code",
"return_date.date_relative",
"return_date.day_name",
"return_date.day_number",
"return_date.month_name",
"return_date.today_relative",
"return_time.period_mod",
"return_time.period_of_day",
"round_trip",
"state_code",
"state_name",
"stoploc.airport_name",
"stoploc.city_name",
"stoploc.state_code",
"time",
"time_relative",
"today_relative",
"toloc.airport_code",
"toloc.airport_name",
"toloc.city_name",
"toloc.country_name",
"toloc.state_code",
"toloc.state_name",
"transport_type"
],
"outside_label": "O",
"type": "iob_extractor"
},
{
"field_to_field": {
"spans/*/end": "spans_ends",
"spans/*/label": "labels",
"spans/*/start": "spans_starts"
},
"get_default": [],
"not_exist_ok": true,
"type": "copy_fields"
},
{
"fields": {
"class_type": "entity type",
"classes": [
"aircraft_code",
"airline_code",
"airline_name",
"airport_code",
"airport_name",
"arrive_date.date_relative",
"arrive_date.day_name",
"arrive_date.day_number",
"arrive_date.month_name",
"arrive_date.today_relative",
"arrive_time.end_time",
"arrive_time.period_mod",
"arrive_time.period_of_day",
"arrive_time.start_time",
"arrive_time.time",
"arrive_time.time_relative",
"city_name",
"class_type",
"connect",
"cost_relative",
"day_name",
"day_number",
"days_code",
"depart_date.date_relative",
"depart_date.day_name",
"depart_date.day_number",
"depart_date.month_name",
"depart_date.today_relative",
"depart_date.year",
"depart_time.end_time",
"depart_time.period_mod",
"depart_time.period_of_day",
"depart_time.start_time",
"depart_time.time",
"depart_time.time_relative",
"economy",
"fare_amount",
"fare_basis_code",
"flight_days",
"flight_mod",
"flight_number",
"flight_stop",
"flight_time",
"fromloc.airport_code",
"fromloc.airport_name",
"fromloc.city_name",
"fromloc.state_code",
"fromloc.state_name",
"meal",
"meal_code",
"meal_description",
"mod",
"month_name",
"or",
"period_of_day",
"restriction_code",
"return_date.date_relative",
"return_date.day_name",
"return_date.day_number",
"return_date.month_name",
"return_date.today_relative",
"return_time.period_mod",
"return_time.period_of_day",
"round_trip",
"state_code",
"state_name",
"stoploc.airport_name",
"stoploc.city_name",
"stoploc.state_code",
"time",
"time_relative",
"today_relative",
"toloc.airport_code",
"toloc.airport_name",
"toloc.city_name",
"toloc.country_name",
"toloc.state_code",
"toloc.state_name",
"transport_type"
],
"text_type": "text"
},
"type": "add_fields"
}
],
"task": "tasks.span_labeling.extraction",
"templates": "templates.span_labeling.extraction.all",
"type": "task_card"
}
Explanation about TaskCardยถ
TaskCard delineates the phases in transforming the source dataset into a model-input, and specifies the metrics for evaluation of model-output.
- Attributes:
loader: specifies the source address and the loading operator that can access that source and transform it into a unitxt multistream.
preprocess_steps: list of unitxt operators to process the data source into a model-input.
task: specifies the fields (of the already (pre)processed instance) making the inputs, the fields making the outputs, and the metrics to be used for evaluating the model output.
templates: format strings to be applied on the input fields (specified by the task) and the output fields. The template also carries the instructions and the list of postprocessing steps, to be applied to the model output.
Explanation about CopyFieldsยถ
Copies values from specified fields to specified fields.
- Args (of parent class):
field_to_field (Union[List[List], Dict[str, str]]): A list of lists, where each sublist contains the source field and the destination field, or a dictionary mapping source fields to destination fields.
- Examples:
An input instance {โaโ: 2, โbโ: 3}, when processed by CopyField(field_to_field={โaโ: โbโ} would yield {โaโ: 2, โbโ: 2}, and when processed by CopyField(field_to_field={โaโ: โcโ} would yield {โaโ: 2, โbโ: 3, โcโ: 2}
with field names containing / , we can also copy inside the field: CopyFields(field_to_field={โa/0โ: โaโ}) would process instance {โaโ: [1, 3]} into {โaโ: 1}
Explanation about AddFieldsยถ
Adds specified fields to each instance in a given stream or all streams (default) If fields exist, updates them.
- Args:
- fields (Dict[str, object]): The fields to add to each instance.
Use โ/โ to access inner fields
use_deepcopy (bool) : Deep copy the input value to avoid later modifications
- Examples:
# Add a โclassesโ field with a value of a list โpositiveโ and โnegativeโ to all streams AddFields(fields={โclassesโ: [โpositiveโ,โnegativesโ]})
# Add a โstartโ field under the โspanโ field with a value of 0 to all streams AddFields(fields={โspan/startโ: 0}
# Add a โclassesโ field with a value of a list โpositiveโ and โnegativeโ to โtrainโ stream AddFields(fields={โclassesโ: [โpositiveโ,โnegativesโ], apply_to_stream=[โtrainโ]})
# Add a โclassesโ field on a given list, prevent modification of original list # from changing the instance. AddFields(fields={โclassesโ: alist}), use_deepcopy=True) # if now alist is modified, still the instances remain intact.
Explanation about IobExtractorยถ
A class designed to extract entities from sequences of text using the Inside-Outside-Beginning (IOB) tagging convention. It identifies entities based on IOB tags and categorizes them into predefined labels such as Person, Organization, and Location.
- Attributes:
labels (List[str]): A list of entity type labels, e.g., [โPersonโ, โOrganizationโ, โLocationโ]. begin_labels (List[str]): A list of labels indicating the beginning of an entity, e.g., [โB-PERโ, โB-ORGโ, โB-LOCโ]. inside_labels (List[str]): A list of labels indicating the continuation of an entity, e.g., [โI-PERโ, โI-ORGโ, โI-LOCโ]. outside_label (str): The label indicating tokens outside of any entity, typically โOโ.
The extraction process identifies spans of text corresponding to entities and labels them according to their entity type. Each span is annotated with a start and end character offset, the entity text, and the corresponding label.
Example of instantiation and usage: ```python operator = IobExtractor(
labels=[โPersonโ, โOrganizationโ, โLocationโ], begin_labels=[โB-PERโ, โB-ORGโ, โB-LOCโ], inside_labels=[โI-PERโ, โI-ORGโ, โI-LOCโ], outside_label=โOโ,
)
- instance = {
โlabelsโ: [โB-PERโ, โI-PERโ, โOโ, โB-ORGโ, โI-ORGโ], โtokensโ: [โJohnโ, โDoeโ, โworksโ, โatโ, โOpenAIโ]
} processed_instance = operator.process(instance) print(processed_instance[โspansโ]) # Output: [{โstartโ: 0, โendโ: 8, โtextโ: โJohn Doeโ, โlabelโ: โPersonโ}, โฆ] ```
For more details on the IOB tagging convention, see: https://en.wikipedia.org/wiki/Inside-outside-beginning_(tagging)
References: templates.span_labeling.extraction.all, tasks.span_labeling.extraction
Read more about catalog usage here.