π AtisΒΆ
Tags: region:us
cards.atis
type: TaskCard
loader:
type: LoadHF
path: tuetschek/atis
preprocess_steps:
- type: SplitStrip
delimiter:
field_to_field:
slots: labels
text: tokens
- type: IobExtractor
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
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
outside_label: O
- type: Copy
field_to_field:
spans/*/start: spans_starts
spans/*/end: spans_ends
spans/*/label: labels
get_default: []
not_exist_ok: True
- type: Set
fields:
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
task: tasks.span_labeling.extraction
templates: templates.span_labeling.extraction.all
[source]Explanation about TaskCardΒΆ
TaskCard delineates the phases in transforming the source dataset into 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 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 LoadHFΒΆ
Loads datasets from the HuggingFace Hub.
It supports loading with or without streaming, and it can filter datasets upon loading.
- Args:
path: The path or identifier of the dataset on the HuggingFace Hub. name: An optional dataset name. data_dir: Optional directory to store downloaded data. split: Optional specification of which split to load. data_files: Optional specification of particular data files to load. revision: Optional. The revision of the dataset. Often the commit id. Use in case you want to set the dataset version. streaming: Bool indicating if streaming should be used. filtering_lambda: A lambda function for filtering the data after loading. num_proc: Optional integer to specify the number of processes to use for parallel dataset loading.
- Example:
Loading glueβs mrpc dataset
load_hf = LoadHF(path='glue', name='mrpc')
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)
Explanation about SetΒΆ
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 Set(fields={βclassesβ: [βpositiveβ,βnegativesβ]})
# Add a βstartβ field under the βspanβ field with a value of 0 to all streams Set(fields={βspan/startβ: 0}
# Add a βclassesβ field with a value of a list βpositiveβ and βnegativeβ to βtrainβ stream Set(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. Set(fields={βclassesβ: alist}), use_deepcopy=True) # if now alist is modified, still the instances remain intact.
Explanation about CopyΒΆ
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 Copy(field_to_field={βaβ: βbβ} would yield {βaβ: 2, βbβ: 2}, and when processed by Copy(field_to_field={βaβ: βcβ} would yield {βaβ: 2, βbβ: 3, βcβ: 2}
with field names containing / , we can also copy inside the field: Copy(field=βa/0β,to_field=βaβ) would process instance {βaβ: [1, 3]} into {βaβ: 1}
References: templates.span_labeling.extraction.all, tasks.span_labeling.extraction
Read more about catalog usage here.