<commit_before>﻿using Merchant.Exceptions;
using Merchant.Extensions;
using Merchant.Interfaces;
using Merchant.Models;
using Merchant.Services;
using System;
using System.Collections.Generic;
using System.IO;

namespace Merchant
{
    internal class Program
    {
        private static ICommandParser _parser;
        private static Queue<Command> _retry = new Queue<Command>();
        private static ICommandVisitor _visitor;

        // Composition root
        private static void Init()
        {
            _visitor = new CommandVisitor(new RateCalculator(), new MapTextConverter(), new RomanNumberConverter());
            _parser = new CommandRegexParser();
        }

        public static void Main(string[] args)
        {
            Init();
            if (args.Length == 0)
            {
                Console.WriteLine("Input file required!");
                return;
            }
            string filePath = args[0];
            if (!File.Exists(filePath)) { Console.WriteLine("File does not exist!"); }
            Console.WriteLine("Processing file {0}.", args[0]);
            var lines = File.ReadLines(filePath);

            foreach (var line in lines)
            {
                var command = _parser.Parse(line);
                try
                {
                    command.Accept(_visitor);
                }
                catch (MerchantException) // Known exception
                {
                    _retry.Enqueue(command);
                }
            }

            while (_retry.NotEmpty())
            {<commit_msg>returning access in main<commit_after>﻿using Merchant.Exceptions;
using Merchant.Extensions;
using Merchant.Interfaces;
using Merchant.Models;
using Merchant.Services;
using System;
using System.Collections.Generic;
using System.IO;

namespace Merchant
{
    internal class Program
    {
        private static ICommandParser _parser;
        private static Queue<Command> _retry = new Queue<Command>();
        private static ICommandVisitor _visitor;

        // Composition root
        private static void Init()
        {
            _visitor = new CommandVisitor(new RateCalculator(), new MapTextConverter(), new RomanNumberConverter());
            _parser = new CommandRegexParser();
        }

        private static void Main(string[] args)
        {
            Init();
            if (args.Length == 0)
            {
                Console.WriteLine("Input file required!");
                return;
            }
            string filePath = args[0];
            if (!File.Exists(filePath)) { Console.WriteLine("File does not exist!"); }
            Console.WriteLine("Processing file {0}.", args[0]);
            var lines = File.ReadLines(filePath);

            foreach (var line in lines)
            {
                var command = _parser.Parse(line);
                try
                {
                    command.Accept(_visitor);
                }
                catch (MerchantException) // Known exception
                {
                    _retry.Enqueue(command);
                }
            }

            while (_retry.NotEmpty())
            {
{'fraction_non_alphanumeric': 0.09137055837563451, 'fraction_numerical': 0.0025380710659898475, 'mean_word_length': 1.6451342281879195, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7276877', 'n_tokens_mistral': 769, 'n_tokens_neox': 738, 'n_words': 199}