def appearance_per_doc_length(word, documents):
    """ Returns average amount of appearances compared to the document length (skips documents without appearance)
    and number of documents in which the word appears.

    :param word: word
    :param documents: list of dictionaries of words from documents
    :return: [appearance ratio, appearances]
    """

    # initialize appearance ratio
    avg = 0
    # initialize number of appearances
    number_appearances = 0

    for document in documents:
        # number of words in the document
        doc_length = 0
        # number of appearances of the word
        counter = 0

        # get length of doc
        for key, value in document.items():
            doc_length += value

        # count appearances of word
        if word in document.keys():
            number_appearances += 1
            counter += document[word]

        # calculate ratio
        avg += counter / doc_length

    return [avg / len(documents), number_appearances / len(documents)]