Fixed recursion problem

This commit is contained in:
Luka 2019-12-21 15:39:42 +01:00
parent 0b3cad90df
commit f1bba0e58f

View File

@ -27,6 +27,8 @@ import timeit
from multiprocessing import Pool from multiprocessing import Pool
from pathlib import Path from pathlib import Path
import gzip import gzip
import sys
sys.setrecursionlimit(25000)
def save_zipped_pickle(obj, filename, protocol=-1): def save_zipped_pickle(obj, filename, protocol=-1):
with gzip.open(filename, 'wb') as f: with gzip.open(filename, 'wb') as f:
@ -378,7 +380,7 @@ def count_trees(cpu_cores, all_trees, query_tree, create_output_string_functs, f
# else: # else:
# result_dict[r_k] = r_v # result_dict[r_k] = r_v
# 1.02 s (16 cores) # 1.02 s (16 cores)
if cpu_cores > 1: if cpu_cores > 0:
# input_data = (tree, query_tree, create_output_string_functs, filters) # input_data = (tree, query_tree, create_output_string_functs, filters)
all_unigrams = p.map(get_unigrams, [(tree, query_tree, create_output_string_functs, filters) for tree in all_trees]) all_unigrams = p.map(get_unigrams, [(tree, query_tree, create_output_string_functs, filters) for tree in all_trees])
for unigrams in all_unigrams: for unigrams in all_unigrams: