# alright, let's check out set intersections matches = set_matches(agree) if len(matches) > 1: logging.warning("Multiple matches found: "+str(matches)) partial_matches += 1 elif len(matches) == 1: logging.info("Match found: "+str(matches)) agreement += 1 elif len(matches) == 0: logging.error("No matches found: "+str(matches)) else: logging.critical("Something else went wrong") total += 1 logging.info(str(agreement)+" matches out of "+str(total)+" found") logging.info(str(partial_matches)+" partial matches out of "+\ str(total)+" found") logging.info("COMPLETED - Nearest highway comparisons") def write_csv_file(datasource): """ Output, (pair_id, Route) """ pass def main(): finding_roads(read_json()) if __name__ == "__main__": enable_log("highwayFinder") main()
""" logging.info("STARTED - Writing dictionary to a text file") with io.open(name + ".txt", 'w', encoding="utf-8") as f: f.write(unicode(json.dumps(dictionary, ensure_ascii=False))) f.close() logging.info("FINISHED - Writing dictionary to a text file") def metrics(others, intersectors, disjointers): """ Logging some metrics on the parse """ logging.info("Others: " + str(len(others))) logging.info("Intersectors: " + str(len(intersectors))) logging.info("Disjointers: " + str(len(disjointers))) logging.info("Total: "+str(len(others)+len(intersectors)+\ len(disjointers))) def main(): logging.info("START - Beginning the parse") # return values others, intersectors, \ disjointers = classify_pairs(lookup_pairs(open_xml()), whitelist()) output(intersectors, "intersectors") metrics(others, intersectors, disjointers) if __name__ == "__main__": enable_log("highwayParser") main()
logging.warning("Multiple matches found: " + str(matches)) partial_matches += 1 elif len(matches) == 1: logging.info("Match found: " + str(matches)) agreement += 1 elif len(matches) == 0: logging.error("No matches found: " + str(matches)) else: logging.critical("Something else went wrong") total += 1 logging.info(str(agreement) + " matches out of " + str(total) + " found") logging.info(str(partial_matches)+" partial matches out of "+\ str(total)+" found") logging.info("COMPLETED - Nearest highway comparisons") def write_csv_file(datasource): """ Output, (pair_id, Route) """ pass def main(): finding_roads(read_json()) if __name__ == "__main__": enable_log("highwayFinder") main()
name: name of text file that will be outputted containing json Returns: Writes a dictionary to a text file using json formatting. """ logging.info("STARTED - Writing dictionary to a text file") with io.open(name + ".txt", 'w', encoding="utf-8") as f: f.write(unicode(json.dumps(dictionary, ensure_ascii=False))) f.close() logging.info("FINISHED - Writing dictionary to a text file") def metrics(others, intersectors, disjointers): """ Logging some metrics on the parse """ logging.info("Others: "+str(len(others))) logging.info("Intersectors: "+str(len(intersectors))) logging.info("Disjointers: "+str(len(disjointers))) logging.info("Total: "+str(len(others)+len(intersectors)+\ len(disjointers))) def main(): logging.info("START - Beginning the parse") # return values others, intersectors, \ disjointers = classify_pairs(lookup_pairs(open_xml()), whitelist()) output(intersectors, "intersectors") metrics(others, intersectors, disjointers) if __name__ == "__main__": enable_log("highwayParser") main()