コード例 #1
0
def load_bitmap(file) :
    words = open(file).readlines()
    words = map(lambda x: x.strip(), words)
    bmap  = Bitmap(2**20)
    for word in words :
        hashes = make_hashes(word)
        for hash in hashes :
            bmap.setBit(hash)
    return bmap
コード例 #2
0
ファイル: spellcheck.py プロジェクト: patiljeevanr/pa-dude
def loadBitmap(file):
    # generate bitmap from lexicon file (one word per line)
    words = open(file).readlines()
    words = map(lambda x: x.strip(), words)  # no newlines please
    bmap = Bitmap(2**20)
    for word in words:
        hashes = makeHashes(word)
        for hash in hashes:
            bmap.setBit(hash)
    return bmap
コード例 #3
0
ファイル: spellcheck.py プロジェクト: MSingh3012/Spellchecker
def loadBitmap(file) :
    # generate bitmap from lexicon file (one word per line)
    words = open(file).readlines()
    words = map(lambda x: x.strip(), words) # no newlines please
    bmap  = Bitmap(2**20)
    for word in words :
        hashes = makeHashes(word)
        for hash in hashes :
            bmap.setBit(hash)
    return bmap