def compute_counts(corpus):
    """Compute the word counts and probs for a given corpus

    corpus: list of sentences

    returns: dict of words, containing counts & probs
    """
    words = {}
    size = 0

    # Let's count words first
    for line in corpus:
        for token in line.split():
            if token in words:
                words[token]['count'] += 1
            else:
                words[token] = {}
                words[token]['count'] = 1
            size += 1

    # Then we compute all the probs once we know the final size
    for k in words.keys():
        words[k]['prob'] = words[k]['count'] / size

    return words