<commit_before>//===--- Results.cpp - Results Output Functionality ---===//
//
// This file is part of the Election Method Mathematics Application (EMMA) project.
//
// Copyright (c) 2015 - 2016 <NAME> and the EMMA project authors
// Licensed under the GNU Affero General Public License, version 3.0.
//
// See the file called "LICENSE" included with this distribution for license information.
//
//===----------------------------------------------------------------------===//
//
// Functionality relating to reproting results.
// In general, all functionality will eventually pass thru here
// in the process of outputting results.
//
//===----------------------------------------------------------------------===//

#include <iostream>
#include "Results.h"
#include "Logging.h"
#include "Printing.h"

namespace Results {
  static void outputElectionNumber(const unsigned election_index);
  static void outputHonestyFraction(const Simulation::Election election);
  static void outputNumberOfCandidates(const Simulation::Election election);
  static void outputNumberOfVoters(const Simulation::Election election);
  static void outputTrueCondorcetData(const Simulation::Election election);

  void output(const Data::Generated::Scenarios* scenarios) {
    std::cout << __func__ << " is not fully implemented yet" << std::endl;
    Logging::log("outputing requested results");
    for (unsigned election_index = 0;
         scenarios->size() > election_index;
         election_index++) {
      outputElectionNumber(election_index);
      outputNumberOfVoters(scenarios->at(election_index));
      outputNumberOfCandidates(scenarios->at(election_index));
      outputHonestyFraction(scenarios->at(election_index));
      outputTrueCondorcetData(scenarios->at(election_index));
    }
  }

  static void outputElectionNumber(const unsigned election_index) {
    Printing::printAsOneLine("Election #", election_index + 1);
  }

  static void outputHonestyFraction(const Simulation::Election election) {
    Printing::printAsOneLine("Honesty fraction: ", election.honestyFraction());
  }

  static void outputNumberOfCandidates(const Simulation::Election election) {
    Printing::printAsOneLine("# of Candidates: ", election.ballotSize());
  }

  static void outputNumberOfVoters(const Simulation::Election election) {
    Printing::printAsOneLine("# of Voters: ", election.electorateSize());
  }

  static void outputTrueCondorcetData(const Simulation::Election election) {
    Simulation::CondorcetCandidate the_Candidate =
      election.theTrueCondorcetCandidate();
    std::string identification_string;
    if (the_Candidate.exists() == true) {
      identification_string = "#";
      identification_string += std::to_string(the_Candidate.identifier());
    } else {
      identification_string = "Does Not Exist";
    }
    Printing::printAsOneLine("True Condorcet Candidate: ",
                             identification_string);
  }
}<commit_msg>better report grouping in support of what is to come<commit_after>//===--- Results.cpp - Results Output Functionality ---===//
//
// This file is part of the Election Method Mathematics Application (EMMA) project.
//
// Copyright (c) 2015 - 2016 <NAME> and the EMMA project authors
// Licensed under the GNU Affero General Public License, version 3.0.
//
// See the file called "LICENSE" included with this distribution for license information.
//
//===----------------------------------------------------------------------===//
//
// Functionality relating to reproting results.
// In general, all functionality will eventually pass thru here
// in the process of outputting results.
//
//===----------------------------------------------------------------------===//

#include <iostream>
#include "Results.h"
#include "Logging.h"
#include "Printing.h"

namespace Results {
  static void outputGeneralInformation(const unsigned election_index,
                                       const Simulation::Election election);
  static void outputResults(const Simulation::Election election,
                            const bool weighted = true);

  void output(const Data::Generated::Scenarios* scenarios) {
    std::cout << __func__ << " is not fully implemented yet" << std::endl;
    Logging::log("outputing requested results");
    for (unsigned election_index = 0;
         scenarios->size() > election_index;
         election_index++) {
      outputGeneralInformation(election_index,
                               scenarios->at(election_index));
      outputResults(scenarios->at(election_index));
      outputResults(scenarios->at(election_index), false);
    }
  }

  static void outputElectionNumber(const unsigned election_index);
  static void outputHonestyFraction(const Simulation::Election election);
  static void outputNumberOfCandidates(const Simulation::Election election);
  static void outputNumberOfVoters(const Simulation::Election election);
  static void outputGeneralInformation(const unsigned election_index,
                                       const Simulation::Election election) {
      outputElectionNumber(election_index);
      outputNumberOfVoters(election);
      outputNumberOfCandidates(election);
      outputHonestyFraction(election);
  }

  static void outputElectionNumber(const unsigned election_index) {
    Printing::printAsOneLine("Election #", election_index + 1);
  }

  static void outputHonestyFraction(const Simulation::Election election) {
    Printing::printAsOneLine("Honesty fraction: ", election.honestyFraction());
  }

  static void outputNumberOfCandidates(const Simulation::Election election) {
    Printing::printAsOneLine("# of Candidates: ", election.ballotSize());
  }

  static void outputNumberOfVoters(const Simulation::Election election) {
    Printing::printAsOneLine("# of Voters: ", election.electorateSize());
  }

  static void outputTrueCondorcetData(const Simulation::Election election,
                                      const bool weighted);
  static void outputWeightingDescription(const bool weighted);

  static void outputResults(const Simulation::Election election,
                            const bool weighted) {
    outputWeightingDescription(weighted);
    outputTrueCondorcetData(election, weighted);
  }

  static void outputTrueCondorcetData(const Simulation::Election election,
                                      const bool weighted) {
    Simulation::CondorcetCandidate the_Candidate =
      election.theTrueCondorcetCandidate();
    std::string identification_string;
    if (the_Candidate.exists() == true) {
      identification_string = "#";
      identification_string += std::to_string(the_Candidate.identifier());
    } else {
      identification_string = "Does Not Exist";
    }
    Printing::printAsOneLine("True Condorcet Candidate: ",
                             identification_string);
  }

  static void outputWeightingDescription(const bool weighted) {
    std::string text;
    if (weighted) {
      text = "Weighted Results";
    } else {
      text = "Unweighted Results";
    }
    text += ":";
    Printing::printAsOneLine(text);
  }
}
{'fraction_non_alphanumeric': 0.14078762306610407, 'fraction_numerical': 0.0033755274261603376, 'mean_word_length': 3.1487747957992998, 'pattern_counts': {'":': 1, '<': 19, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5787791', 'n_tokens_mistral': 1870, 'n_tokens_neox': 1792, 'n_words': 458}