def avg_w2v_semantic_similarity(docs, N):
    """Compute average semantic similarity between adjacent sentences.

    This is using word2vec :cite:`mikolov2013word2vec` model based on SPACY
    implementation. The semantic similarity is based on
    :cite:`foltz1998measurement` approach to compute text coherence.

    :param docs: Docs generator provided by SPACY API
    :type docs: Doc Generator
    :param N: Number of sentences
    :type N: int
    :return: Average sentence similarity (cosine)
    :rtype: float
    """
    if N <= 1:
        raise RuntimeError('N of sentences should be > 1, {} was provided'.
            format(N))
    avg_sim = 0
    prev_doc = next(docs)
    done = False
    while not done:
        try:
            curr_doc = next(docs)
            avg_sim += prev_doc.similarity(curr_doc)
            prev_doc = curr_doc
        except StopIteration:
            done = True
    return avg_sim / float(N - 1)
