from typing import List
from typing import Tuple
from typing import Set


def create_vocabulary(sentences: List[str], split_words: bool=True)->Tuple[Set[str], int]:
    """
    Generate a vocabulary from a list of sentences
    :param sentences:
    :param split_words: if True, splits sentence into words else use whole sentence as index (used for relations)
    :return:
    """
    vocabulary = set()
    max_length = -1

    for sentence in sentences:

        if split_words:
            words = sentence.lower().split()
            vocabulary.update(words)

            if len(words) > max_length:
                max_length = len(words)

        else:
            vocabulary.add(sentence.lower())
            max_length = 1

    return vocabulary, max_length