__author__ = 'blaz'


def tokens(rdr):
    """Yields subsequent tokens from a reader"""
    while True:
        tok = rdr.get_next_token()
        if not tok:
            break
        yield tok


def sentences(rdr):
    """Yields subsequent sentences from a reader."""
    while True:
        sent = rdr.get_next_sentence()
        if not sent:
            break
        yield sent


def chunks(rdr):
    """Yields subsequent sentences from a reader."""
    while True:
        chunk = rdr.get_next_chunk()
        if not chunk:
            break
        yield chunk