def main(): parser = argparse.ArgumentParser() parser.add_argument("--project", "-p", help="Project path", required=True) parser.add_argument("--stop_words", "-s", help="Path to stopwords file") parser.add_argument("--k_topics", "-k", help="Number of topics for given project") parser.add_argument( "--resolution", "-r", help= "Resolution number parameter in Louvain community detection. A value in range of 0.3 to 1 is advised. A smaller resolution will identify smaller communities and vice versa. By default the whole range is tested and communities for each community saved." ) parser.add_argument( "--metrics", "-m", help= "Execute metrics for a given project name after normal parsing and execution (relative path to set root path) (At the current time it does NOT work independently from the identification process)", action="store_true") parser.add_argument("--draw", "-d", help="Enable plotting of graphs", action="store_true") parser.add_argument("--lda-plotting", "-l", help="Enable plotting of LDA topics", action="store_true") args = parser.parse_args() Settings.DRAW = True if args.draw else False Settings.LDA_PLOTTING = True if args.lda_plotting else False Settings.K_TOPICS = int(args.k_topics) if args.k_topics else None Settings.RESOLUTION = float(args.resolution) if args.resolution else None Settings.set_stop_words(args.stop_words) print(f"Setting Directory as: {Settings.DIRECTORY}") if args.project: project_name = str(args.project.split('/')[-1]) project_path = str(args.project) Settings.PROJECT_PATH = project_path Settings.PROJECT_NAME = project_name # cluster_results = (clusters, modularity, resolution) clusters_results = identify_clusters_in_project( project_name, project_path) metrics = Metrics() for cluster in clusters_results: Settings.create_id() # TODO: Refactor MetricExecutor into ProcessResultOutput and MetricExecutor, currently sharing many responsabilities metric_executor = MetricExecutor() metric_executor.add_project(project_name, str(cluster[0])) metric_executor.dump_to_json_file() if args.metrics: # TODO: refactor metrics.set_metric_executor(metric_executor) metrics.set_cluster_results(clusters_results) metrics.calculate() if args.metrics: metrics.save()