Ejemplo n.º 1
0
        collected_features_array = article_extraction.get_as_array(collected_features_with_fixed_outliers)

        if len(collected_features_array) > 0:

            # generate directories if they don't exist
            if not os.path.exists(article_path):
                os.makedirs(article_path)
            if not os.path.exists(language_path):
                os.makedirs(language_path)

            json_writer.write_json_file(collected_features_array, article_analysis_path)

            count_features = ["ip-location","tld-location","website-language","classification-fixed","classification-general-fixed"]
            for count_feature in count_features:
                classification_general_counts = count_generation.generate_counts(collected_features_array, count_feature)
                classification_general_counts_array = count_generation.get_as_array(classification_general_counts, 20)

                article_count_path = os.path.join(article_path,"counts-"+count_feature+"-top-20.json")
                json_writer.write_json_file(classification_general_counts_array, article_count_path)

            # generate map data
            map_data = map_data_generation.generate_map_data_array(collected_features_array,"classification-general-fixed")
            article_map_data_path = os.path.join(article_path,"map-data.json")
            json_writer.write_json_file(map_data, article_map_data_path)

            # get execution date
            now = datetime.datetime.now()
            time_info = {}
            time_info["analysis-date"]= now.strftime("%Y-%m-%d")
            time_info["analysis-time"]= now.strftime("%H:%M:%S")
            json_writer.write_json_file(time_info, article_info_path)