πŸ“„ Numeric NlgΒΆ

NumericNLG is a dataset for numerical table-to-text generation using pairs of a table and a paragraph of a table description with richer inference from scientific papers.

Tags: modality:table, urls:{'arxiv': 'https://aclanthology.org/2021.acl-long.115/'}, languages:['english']

Note

ID: cards.numeric_nlg | Type: TaskCard

{
    "__description__": "NumericNLG is a dataset for numerical table-to-text generation using pairs of a table and a paragraph of a table description with richer inference from scientific papers.",
    "__tags__": {
        "languages": [
            "english"
        ],
        "modality": "table",
        "urls": {
            "arxiv": "https://aclanthology.org/2021.acl-long.115/"
        }
    },
    "__type__": "task_card",
    "loader": {
        "__type__": "load_hf",
        "path": "kasnerz/numericnlg"
    },
    "preprocess_steps": [
        {
            "__type__": "set",
            "fields": {
                "type_of_input_a": "table",
                "type_of_input_b": "caption",
                "type_of_output": "description"
            }
        },
        {
            "__type__": "map_html_table_to_json",
            "field": "table_html_clean",
            "to_field": "table_out"
        },
        {
            "__type__": "serialize_table_as_markdown",
            "field": "table_out",
            "to_field": "input_a"
        },
        {
            "__type__": "rename_fields",
            "field": "description",
            "to_field": "output"
        },
        {
            "__type__": "rename_fields",
            "field": "caption",
            "to_field": "input_b"
        }
    ],
    "task": "tasks.generation.from_pair",
    "templates": "templates.generation.from_pair.all"
}

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 LoadHFΒΆ

Loads datasets from the Huggingface Hub.

It supports loading with or without streaming, and 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. 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 SerializeTableAsMarkdownΒΆ

Markdown Table Serializer.

Markdown table format is used in GitHub code primarily. Format: |col1|col2|col3| |---|β€”|---| |A|4|1| |I|2|1| …

Explanation about MapHTMLTableToJSONΒΆ

Converts HTML table format to the basic one (JSON).

JSON format {

β€œheader”: [β€œcol1”, β€œcol2”], β€œrows”: [[β€œrow11”, β€œrow12”], [β€œrow21”, β€œrow22”], [β€œrow31”, β€œrow32”]]

}

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 RenameFieldsΒΆ

Renames fields.

Move value from one field to another, potentially, if field name contains a /, from one branch into another. Remove the from field, potentially part of it in case of / in from_field.

Examples:

RenameFields(field_to_field={β€œb”: β€œc”}) will change inputs [{β€œa”: 1, β€œb”: 2}, {β€œa”: 2, β€œb”: 3}] to [{β€œa”: 1, β€œc”: 2}, {β€œa”: 2, β€œc”: 3}]

RenameFields(field_to_field={β€œb”: β€œc/d”}) will change inputs [{β€œa”: 1, β€œb”: 2}, {β€œa”: 2, β€œb”: 3}] to [{β€œa”: 1, β€œc”: {β€œd”: 2}}, {β€œa”: 2, β€œc”: {β€œd”: 3}}]

RenameFields(field_to_field={β€œb”: β€œb/d”}) will change inputs [{β€œa”: 1, β€œb”: 2}, {β€œa”: 2, β€œb”: 3}] to [{β€œa”: 1, β€œb”: {β€œd”: 2}}, {β€œa”: 2, β€œb”: {β€œd”: 3}}]

RenameFields(field_to_field={β€œb/c/e”: β€œb/d”}) will change inputs [{β€œa”: 1, β€œb”: {β€œc”: {β€œe”: 2, β€œf”: 20}}}] to [{β€œa”: 1, β€œb”: {β€œc”: {β€œf”: 20}, β€œd”: 2}}]

References: tasks.generation.from_pair, templates.generation.from_pair.all

Read more about catalog usage here.