def corpus_to_vw(corpus):
    """Convert corpus to Vowpal Wabbit format.

    Parameters
    ----------
    corpus : iterable of list of (int, int)
        Collection of texts in BoW format.


    Notes
    -----

    Vowpal Wabbit format ::

        | 4:7 14:1 22:8 6:3
        | 14:22 22:4 0:1 1:3
        | 7:2 8:2


    Yields
    ------
    str
        Corpus in Vowpal Wabbit, line by line.

    """
    for entries in corpus:
        line = ['|']
        for word_id, count in entries:
            line.append('{0}:{1}'.format(word_id, count))
        yield ' '.join(line)
