import re


def format_row(row):
    """Formats the row

    Args:
        row (string): The row of the file.

    Returns:
        dict: The dictionary containing the following attributes:
            - query (string): The query.
            - document (string): The document.
            - relevance (integer): The relevance label.

    """
    splitted_values = re.split(r"\t+", row)

    if len(splitted_values) == 3:
        rel, query, document = splitted_values
        return {
            "query": query.strip(),
            "document": document.strip(),
            "relevance": 1 if int(rel.strip()) > 0 else 0,
        }
    else:
        return None