def postag_texts(path,procn=cpu_count()): # filling the queue of jobs (POS-dictionaries and output filenames) jobs = Queue() for fname in os.listdir(path): if os.path.splitext(fname)[-1].lower() != '.par': continue jobs.put(os.path.join(path,fname)) lock = Lock() # executing the POS tagging in parallel util.parex(jobs,processor_pos,lock,(),procn=procn,store_results=False)
def extract_cooc(path,procn=cpu_count(),add_verbs=True): # filling the queue of jobs (POS-dictionaries and output filenames) jobs = Queue() for fname in os.listdir(path): if os.path.splitext(fname)[-1].lower() != '.pos': continue dct = parse_pos(os.path.join(path,fname)) filename = os.path.join(path,os.path.splitext(fname)[0]+'.t2s') jobs.put((dct,filename)) lock = Lock() # executing the COOC extraction in parallel args = (add_verbs,) util.parex(jobs,processor_cooc,lock,args,procn=procn,store_results=False)