from typing import List
from typing import Dict
from typing import Tuple


def format_data_as_spacy_others(raw_data: List[Dict[str, str]]) -> Tuple[List[str], List[Dict[str, bool]]]:
    """
    Format the raw_data as the format expected by spacy.

    Parameters
    -----------
    - **raw_data**: the dataset to be formatted.

    Return
    ----------
    A Tuple containing the texts and labels in spacy format.
    The texts are a list of sentences.
    The labels are a list of Dict where each Dict has all labels as keys and a bool.
    saying if it belongs or not to given class.
    """

    texts = [td['sentence'] for td in raw_data]
    labels = [td['intent'] for td in raw_data]

    cats = [{'find-around-me': y == 'find-around-me',
             'purchase': y == 'purchase',
             'find-hotel': y == 'find-hotel',
             'provide-showtimes': y == 'provide-showtimes',
             'find-train': y == 'find-train',
             'find-flight': y == 'find-flight',
             'find-restaurant': y == 'find-restaurant'} for y in labels]

    return texts, cats