<commit_before>#include "Filesystem.hh"
#include "Node.hh"
#include "Pump.hh"
#include "Processes.hh"

#include <algorithm>
#include <fstream>
#include <iostream>
#include <regex>
#include <map>
#include <queue>
#include <set>
#include <stdexcept>
#include <string>

namespace pump
{

namespace detail
{

Edge makeEdge( const std::string& sourceDescription, const std::string& targetDescription )
{
  std::regex reDescription( "([^\\.]+)\\.([[:digit:]]+)" );
  std::smatch matches;

  Edge edge;

  if( std::regex_match( sourceDescription, matches, reDescription ) )
  {
    edge.source          = matches[1];
    edge.sourcePortIndex = static_cast<unsigned>( std::stoul( matches[2] ) );
  }

  if( std::regex_match( targetDescription, matches, reDescription ) )
  {
    edge.target          = matches[1];
    edge.targetPortIndex = static_cast<unsigned>( std::stoul( matches[2] ) );
  }

  return edge;
}

}

void Pump::load( const std::string& filename )
{
  std::ifstream in( filename );
  if( !in )
    throw std::runtime_error( "Unable to read input file" );

  std::regex reNode( "[[:space:]]*([[:alnum:]]+):[[:space:]]+([^[:space:]]+)" );
  std::regex reEdge( "[[:space:]]*([^[:space:]]+)[[:space:]]*->[[:space:]]*([^[:space:]]+)" );

  std::string line;

  while( std::getline( in, line ) )
  {
    if( line.empty() || line.front() == '#' )
      continue;<commit_msg>Updated node description to permit harness execution<commit_after>#include "Filesystem.hh"
#include "Node.hh"
#include "Pump.hh"
#include "Processes.hh"

#include <algorithm>
#include <fstream>
#include <iostream>
#include <regex>
#include <map>
#include <queue>
#include <set>
#include <stdexcept>
#include <string>

namespace pump
{

namespace detail
{

Edge makeEdge( const std::string& sourceDescription, const std::string& targetDescription )
{
  std::regex reDescription( "([^\\.]+)\\.([[:digit:]]+)" );
  std::smatch matches;

  Edge edge;

  if( std::regex_match( sourceDescription, matches, reDescription ) )
  {
    edge.source          = matches[1];
    edge.sourcePortIndex = static_cast<unsigned>( std::stoul( matches[2] ) );
  }

  if( std::regex_match( targetDescription, matches, reDescription ) )
  {
    edge.target          = matches[1];
    edge.targetPortIndex = static_cast<unsigned>( std::stoul( matches[2] ) );
  }

  return edge;
}

}

void Pump::load( const std::string& filename )
{
  std::ifstream in( filename );
  if( !in )
    throw std::runtime_error( "Unable to read input file" );

  std::regex reNode( "[[:space:]]*([[:alnum:]]+):[[:space:]]+(.+)[[:space:]]*$" );
  std::regex reEdge( "[[:space:]]*([^[:space:]]+)[[:space:]]*->[[:space:]]*([^[:space:]]+)" );

  std::string line;

  while( std::getline( in, line ) )
  {
    if( line.empty() || line.front() == '#' )
      continue;
{'fraction_non_alphanumeric': 0.2083780880773362, 'fraction_numerical': 0.0028643036161833156, 'mean_word_length': 4.5, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3879950', 'n_tokens_mistral': 990, 'n_tokens_neox': 963, 'n_words': 209}