def generate_graphic_character_vocabulary(conn, min_coverage):
    """Generate a vocabulary of characters from graphic representations of
    lemmas with the specified minimal corpus coverage.

    This is the smallest vocabulary of the most frequent characters so that
    these characters together cover at least a portion of ``min_coverage`` of
    the corpus.

    :param conn: Database connection for statistics.

    :param float min_coverage: The minimal coverage.

    :return: A dictionary from characters from graphic representations of lemmas
        to their frequency rank.

    """
    if min_coverage < 0 or min_coverage > 1:
        raise ValueError('The minimum coverage must be between 0 (inclusive) and 1 (inclusive)')
    if min_coverage == 0:
        return dict()
    return {graphic_c: rank
            for graphic_c, rank in conn.cursor().execute(
                    '''SELECT graphic, rank FROM statistics
                       WHERE language = "jpn" 
                       AND form = "lemma:graphic:character" 
                       AND count >= (
                           SELECT MAX(count) FROM statistics
                           WHERE language = "jpn"
                           AND form = "lemma:graphic:character"
                           AND cumulative_count >= (
                               SELECT MAX(cumulative_count)
                               FROM statistics
                               WHERE language = "jpn" 
                               AND form = "lemma:graphic:character") * ?)''',
                    (min_coverage,))}