def text_id_dbm():
    """
    This quickly creates a key-value store for textids: storing on disk
    dramatically reduces memory consumption for bookworms of over 
    1 million documents.
    """
    dbm = anydbm.open(".bookworm/texts/textids.dbm","c")
    for file in os.listdir(".bookworm/texts/textids"):
        for line in open(".bookworm/texts/textids/" + file):
            line = line.rstrip("\n")
            splat = line.split("\t")
            try:
                dbm[splat[1]] = splat[0]
            except __HOLE__:
                if line=="":
                    # It's OK to have a blank line, let's say.
                    continue
                else:
                    raise
dataset/ETHPy150Open Bookworm-project/BookwormDB/bookwormDB/CreateDatabase.py/text_id_dbm