def compute_gwmin_scores(pyr_id, scu_file_path, peer_id, n, segmentations_file_path, best_scu_path=""): """Gets all the candidate scus for that peer & processes it into required input format | Passes that as input to gwmin and obtains output""" n = 3 peer_scus = {} if best_scu_path == "": best_scu_path = 'Sentences/Unique_Sets_new/12_10_09_MATTER.pyr/' + str( peer_id) + '/new_wtd_files/' temp_scus = get_best_scus(int(n), peer_id, best_scu_path) for k, v in temp_scus.iteritems(): peer_scus[int(k)] = v gr = generate_gwmin_input(peer_scus) max_set = get_results(2, gr, scu_file_path, pyr_id) print "--our--" + str(peer_id) our_results = process_results(max_set) modified_results = get_ngram(segmentations_file_path, best_scu_path, our_results, scu_file_path, pyr_id) for k, v in modified_results.iteritems(): print k, v results_path = os.path.join(config.results_path, str(pyr_id)) if not os.path.exists(results_path): os.makedirs(results_path) print "Creating directory", results_path write_results(pyr_id, peer_id, modified_results, os.path.join(results_path, str(peer_id) + ".output")) return our_results, peer_scus
def compute_gwmin_scores(peer_id, n, best_scu_path=""): """Gets all the candidate scus for that peer & processes it into required input format | Passes that as input to gwmin and obtains output""" n = 3 peer_scus = {} if best_scu_path == "": best_scu_path = 'Sentences/Unique_Sets_new/12_10_09_MATTER.pyr/'+str(peer_id)+'/new_wtd_files/' temp_scus = get_best_scus(int(n), peer_id, best_scu_path="") for k,v in temp_scus.iteritems(): peer_scus[int(k)] = v gr = generate_gwmin_input(peer_scus) max_set = get_results(2, gr) print "--our--"+str(peer_id) our_results = process_results(max_set) return our_results, peer_scus
def compute_gwmin_scores(pyr_id, scu_file_path, peer_id, n, segmentations_file_path, best_scu_path=""): """Gets all the candidate scus for that peer & processes it into required input format | Passes that as input to gwmin and obtains output""" n = 3 peer_scus = {} if best_scu_path == "": best_scu_path = 'Sentences/Unique_Sets_new/12_10_09_MATTER.pyr/'+str(peer_id)+'/new_wtd_files/' temp_scus = get_best_scus(int(n), peer_id, best_scu_path) for k,v in temp_scus.iteritems(): peer_scus[int(k)] = v gr = generate_gwmin_input(peer_scus) max_set = get_results(2, gr, scu_file_path, pyr_id) print "--our--"+str(peer_id) our_results = process_results(max_set) modified_results = get_ngram(segmentations_file_path, best_scu_path, our_results, scu_file_path, pyr_id) for k,v in modified_results.iteritems(): print k,v results_path = os.path.join(config.results_path, str(pyr_id)) if not os.path.exists(results_path): os.makedirs(results_path) print "Creating directory", results_path write_results(pyr_id, peer_id, modified_results, os.path.join(results_path, str(peer_id)+".output")) return our_results, peer_scus