def yield_json_corpus(fnm):
    """Function to read a JSON corpus from a file.
    A JSON corpus contains one document per line, encoded in JSON.
    Each line is yielded after it is read.

    Parameters
    ----------
    fnm: str
        The filename of the corpus.

    Returns
    -------
    generator of Text
    """
    with codecs.open(fnm, 'rb', 'ascii') as f:
        line = f.readline()
        while line != '':
            yield Text(json.loads(line))
            line = f.readline()