def exportToDisk(wordcounts,diskFile,keepThreshold=5):
    """
    Periodically, the wordcounter writes what it knows to disk for dictionary values below a certain frequency:
    this lets us keep the most common words continually in memory, and only write out (say) 'the' once, at the end.
    """
    commonwords = dict()
    for key in wordcounts.iterkeys():
        if keepThreshold < wordcounts[key]:
            key = key
            output = key + " " + str(wordcounts[key]) + "\n"
            diskFile.write(output)
        else:
            commonwords[key] = wordcounts[key]
    return commonwords
    logging.info("export done")
dataset/ETHPy150Open Bookworm-project/BookwormDB/bookwormDB/wordcounter.py/exportToDisk/swapped operands of `<`