def _create_documents_per_words(freq_matrix: dict) -> dict:
    """
    Returns a dictionary of words and the number of documents in which they
    appear.
    :param freq_matrix: The frequency matrix to be summarized.
    :return: A dictionary of words and the number of documents in which they appear.
    """
    doc_per_words = dict()
    for sentence, freq_table in freq_matrix.items():
        for word, frequency in freq_table.items():
            if word in doc_per_words:
                doc_per_words[word] += 1
            else:
                doc_per_words[word] = 1
    return doc_per_words