Ejemplo n.º 1
0
def create_edge_ngrams():
    start = time.time()
    pool = Pool()
    count = 0
    chunk = []
    for key in DB.scan_iter(match='w|*'):
        count += 1
        chunk.append(key)
        if count % 10000 == 0:
            pool.map(index_ngram_key, chunk)
            print("Done", count, time.time() - start)
            chunk = []
    if chunk:
        pool.map(index_ngram_key, chunk)
    pool.close()
    pool.join()
    print('Done', count, 'in', time.time() - start)
Ejemplo n.º 2
0
def create_edge_ngrams(*args):
    start = time.time()
    pool = Pool()
    count = 0
    chunk = []
    for key in DB.scan_iter(match='w|*'):
        count += 1
        chunk.append(key)
        if count % 10000 == 0:
            pool.map(index_ngram_key, chunk)
            print("Done", count, time.time() - start)
            chunk = []
    if chunk:
        pool.map(index_ngram_key, chunk)
    pool.close()
    pool.join()
    print('Done', count, 'in', time.time() - start)
Ejemplo n.º 3
0
def create_edge_ngrams(*args):
    pattern = '{}*'.format(dbkeys.TOKEN_PREFIX)
    parallelize(index_ngram_keys,
                DB.scan_iter(match=pattern),
                chunk_size=10000,
                throttle=1000)
Ejemplo n.º 4
0
def create_edge_ngrams(*args):
    parallelize(index_ngram_key,
                DB.scan_iter(match='w|*'),
                prefix="Computing ngrams",
                throttle=1000)
Ejemplo n.º 5
0
def create_edge_ngrams(*args):
    parallelize(index_ngram_key, DB.scan_iter(match='w|*'),
                prefix="Computing ngrams", throttle=1000)
Ejemplo n.º 6
0
def create_edge_ngrams(*args):
    parallelize(index_ngram_keys,
                DB.scan_iter(match='w|*'),
                chunk_size=10000,
                throttle=1000)