π Turl Col TypeΒΆ
This TURL dataset is a large-scale dataset based on WikiTables corpus for the task of column type annotation. Given a table T and a set of semantic types L, the task is to annotate a column in T with l β L so that all entities in the column have type l. Note that a column can have multiple types. See the full description on the dataset page: https://github.com/sunlab-osu/TURL
Tags: modality:table, urls:{'arxiv': 'https://arxiv.org/pdf/2006.14806'}, languages:['english'], category:dataset
cards.turl_col_type
TaskCard(
loader=TURLColumnTypeAnnotationLoader(),
preprocess_steps=[
Set(
fields={
"vocab": [
"royalty.noble_person",
"business.business_operation",
"protected_sites.listed_site",
"music.writer",
"people.ethnicity",
"government.government_office_or_title",
"organization.non_profit_organization",
"business.brand",
"tennis.tennis_tournament",
"cvg.cvg_genre",
"ice_hockey.hockey_position",
"sports.sports_team",
"computer.computer",
"metropolitan_transit.transit_line",
"award.award_category",
"american_football.football_conference",
"sports.professional_sports_team",
"soccer.football_world_cup",
"tv.tv_actor",
"business.industry",
"music.composition",
"people.person",
"broadcast.tv_channel",
"cricket.cricket_player",
"internet.website",
"tennis.tennis_player",
"music.media_format",
"tv.tv_personality",
"film.actor",
"film.film_genre",
"cvg.cvg_developer",
"business.job_title",
"chess.chess_player",
"tv.tv_writer",
"broadcast.broadcast",
"soccer.fifa",
"cvg.cvg_publisher",
"film.writer",
"medicine.anatomical_structure",
"astronomy.celestial_object",
"cricket.cricket_team",
"sports.golfer",
"book.periodical_subject",
"military.rank",
"spaceflight.astronaut",
"medicine.disease",
"location.province",
"location.location",
"amusement_parks.ride",
"government.general_election",
"music.musical_scale",
"music.lyricist",
"music.artist",
"location.capital_of_administrative_division",
"theater.play",
"meteorology.tropical_cyclone",
"aviation.airport",
"basketball.basketball_team",
"education.school",
"soccer.football_position",
"soccer.football_team",
"cvg.cvg_platform",
"religion.religious_leader",
"business.defunct_company",
"astronomy.asteroid",
"sports.pro_athlete",
"sports.school_sports_team",
"baseball.baseball_league",
"architecture.structure",
"sports.tournament_event_competition",
"sports.multi_event_tournament",
"music.record_label",
"travel.accommodation",
"cricket.cricket_stadium",
"ice_hockey.hockey_team",
"award.competition",
"business.consumer_company",
"people.family_member",
"biology.organism_classification",
"business.product_category",
"book.magazine",
"royalty.kingdom",
"fictional_universe.fictional_character",
"education.athletics_brand",
"military.military_unit",
"american_football.football_coach",
"broadcast.tv_station",
"government.governmental_body",
"boats.ship",
"visual_art.visual_artist",
"meteorology.tropical_cyclone_season",
"sports.sports_league",
"sports.sports_league_season",
"soccer.football_team_manager",
"boats.ship_class",
"military.military_post",
"education.educational_institution",
"sports.sports_championship",
"film.film",
"award.award_presenting_organization",
"soccer.football_award",
"broadcast.artist",
"computer.software",
"broadcast.genre",
"education.university",
"time.recurring_event",
"book.periodical",
"celebrities.celebrity",
"location.country",
"soccer.football_player",
"book.book",
"geography.river",
"medicine.drug_ingredient",
"transportation.road",
"olympics.olympic_games",
"military.military_conflict",
"chemistry.chemical_element",
"location.us_state",
"location.hud_county_place",
"award.award_ceremony",
"tv.tv_program_creator",
"architecture.venue",
"film.music_contributor",
"architecture.architectural_structure_owner",
"basketball.basketball_position",
"astronomy.constellation",
"law.court",
"rail.locomotive_class",
"book.newspaper",
"film.director",
"broadcast.radio_station",
"tv.tv_series_season",
"architecture.building",
"olympics.olympic_event_competition",
"music.instrument",
"organization.organization",
"computer.software_license",
"government.election",
"award.award",
"tv.tv_director",
"metropolitan_transit.transit_system",
"tennis.tennis_tournament_champion",
"cricket.cricket_bowler",
"aviation.airline",
"tv.tv_network",
"music.musical_group",
"government.politician",
"music.music_video_director",
"media_common.media_genre",
"comic_books.comic_book_character",
"automotive.company",
"location.administrative_division",
"government.political_party",
"location.australian_local_government_area",
"theater.theater_actor",
"music.producer",
"ice_hockey.hockey_player",
"royalty.monarch",
"sports.sports_championship_event",
"sports.sports_league_draft",
"food.food",
"military.military_person",
"geography.island",
"location.uk_constituent_country",
"tv.tv_series_episode",
"government.u_s_congressperson",
"amusement_parks.park",
"book.written_work",
"geography.body_of_water",
"tv.tv_genre",
"aviation.aircraft_owner",
"interests.collection_category",
"astronomy.star_system_body",
"tv.tv_producer",
"medicine.muscle",
"baseball.baseball_team",
"government.us_president",
"location.citytown",
"fictional_universe.fictional_organization",
"biology.organism",
"tv.tv_program",
"soccer.football_league_season",
"sports.boxer",
"military.armed_force",
"location.australian_state",
"basketball.basketball_conference",
"internet.website_owner",
"medicine.drug",
"award.award_discipline",
"location.in_district",
"business.consumer_product",
"broadcast.radio_format",
"baseball.baseball_position",
"book.periodical_publisher",
"government.government_agency",
"sports.cyclist",
"time.event",
"automotive.model",
"boats.ship_type",
"finance.currency",
"government.legislative_session",
"american_football.football_player",
"royalty.chivalric_order_member",
"law.invention",
"martial_arts.martial_artist",
"film.film_character",
"sports.sports_facility",
"music.group_member",
"location.region",
"astronomy.orbital_relationship",
"basketball.basketball_player",
"cvg.computer_videogame",
"law.legal_case",
"language.human_language",
"tv.tv_character",
"education.educational_degree",
"aviation.aircraft_model",
"business.customer",
"geography.mountain",
"location.us_county",
"music.album",
"music.composer",
"computer.operating_system",
"religion.religion",
"organization.membership_organization",
"sports.sport",
"location.uk_statistical_location",
"location.in_state",
"film.film_distributor",
"basketball.basketball_coach",
"medicine.medical_treatment",
"education.fraternity_sorority",
"metropolitan_transit.transit_stop",
"chemistry.chemical_compound",
"sports.sports_position",
"music.genre",
"award.hall_of_fame_inductee",
"sports.sports_award_type",
"exhibitions.exhibition_sponsor",
"film.film_festival_focus",
"film.production_company",
"location.jp_prefecture",
"education.field_of_study",
"award.recurring_competition",
"government.election_campaign",
"sports.sports_award_winner",
"astronomy.astronomical_discovery",
"music.performance_role",
"soccer.football_league",
"book.author",
"film.producer",
"royalty.noble_title",
"biology.animal",
"american_football.football_team",
"baseball.baseball_player",
],
},
),
],
task=Task(
input_fields={
"page_title": "str",
"section_title": "str",
"table_caption": "str",
"table": "Table",
"vocab": "List[str]",
"colname": "str",
},
reference_fields={
"annotations": "List[str]",
},
prediction_type="List[str]",
metrics=[
"metrics.f1_micro_multi_label",
"metrics.accuracy",
"metrics.f1_macro_multi_label",
],
augmentable_inputs=[
"page_title",
"section_title",
"table_caption",
"table",
"colname",
"vocab",
],
),
templates=[
InputOutputTemplate(
instruction="This is a column type annotation task. The goal of this task is to choose the correct types for one selected column of the given input table from the given candidate types. The Wikipedia page, section and table caption (if any) provide important information for choosing the correct column types.
Candidate Types: {vocab}
Output only the correct column types from the candidate list for the mentioned columns. Do not include any explanations, extra information, or introductory textβonly the final answer.
Here are some input-output examples. Read the examples carefully to figure out the mapping. The output of the last example is not given, and your job is to figure out what it is.",
input_format="
Column name: {colname}
Page Title: {page_title}
Section Title: {section_title}
Table caption: {table_caption}
Table:
{table}
Selected Column: {colname} ",
output_format="{annotations}",
postprocessors=[
"processors.take_first_non_empty_line",
"processors.lower_case",
"processors.to_list_by_comma",
],
),
],
)
[source]from unitxt.loaders import TURLColumnTypeAnnotationLoader
from unitxt.operators import Set
from unitxt.task import Task
from unitxt.templates import InputOutputTemplate
Explanation about TaskCardΒΆ
TaskCard delineates the phases in transforming the source dataset into model input, and specifies the metrics for evaluation of model output.
- Args:
- 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 TaskΒΆ
Task packs the different instance fields into dictionaries by their roles in the task.
- Args:
- input_fields (Union[Dict[str, str], List[str]]):
Dictionary with string names of instance input fields and types of respective values. In case a list is passed, each type will be assumed to be Any.
- reference_fields (Union[Dict[str, str], List[str]]):
Dictionary with string names of instance output fields and types of respective values. In case a list is passed, each type will be assumed to be Any.
- metrics (List[str]):
List of names of metrics to be used in the task.
- prediction_type (Optional[str]):
Need to be consistent with all used metrics. Defaults to None, which means that it will be set to Any.
- defaults (Optional[Dict[str, Any]]):
An optional dictionary with default values for chosen input/output keys. Needs to be consistent with names and types provided in βinput_fieldsβ and/or βoutput_fieldsβ arguments. Will not overwrite values if already provided in a given instance.
- The output instance contains three fields:
βinput_fieldsβ whose value is a sub-dictionary of the input instance, consisting of all the fields listed in Arg βinput_fieldsβ.
βreference_fieldsβ β for the fields listed in Arg βreference_fieldsβ.
βmetricsβ β to contain the value of Arg βmetricsβ
Explanation about InputOutputTemplateΒΆ
Generate field βsourceβ from fields designated as input, and fields βtargetβ and βreferencesβ from fields designated as output, of the processed instance.
Args specify the formatting strings with which to glue together the input and reference fields of the processed instance into one string (βsourceβ and βtargetβ), and into a list of strings (βreferencesβ).
Explanation about SetΒΆ
Sets specified fields in each instance, in a given stream or all streams (default), with specified values. If fields exist, updates them, if do not exist β adds 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:
# Set a value of a list consisting of βpositiveβ and βnegativeβ do field βclassesβ to each and every instance of all streams
Set(fields={"classes": ["positive","negatives"]})# In each and every instance of all streams, field βspanβ is to become a dictionary containing a field βstartβ, in which the value 0 is to be set
Set(fields={"span/start": 0}# In all instances of stream βtrainβ only, Set field βclassesβ to have the value of a list consisting of βpositiveβ and βnegativeβ
Set(fields={"classes": ["positive","negatives"], apply_to_stream=["train"]})# Set field βclassesβ to have the value of a given list, preventing 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.
References: processors.take_first_non_empty_line, metrics.f1_micro_multi_label, metrics.f1_macro_multi_label, processors.to_list_by_comma, processors.lower_case, metrics.accuracy
Read more about catalog usage here.