<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;

namespace CommandLineParser.Helpers
{
    public class KeyDetection
    {
        public const string HELP_KEY_REGEX = @"^(--help)|(-h)|(-\?)|(\\\?)$";
        public const string SHORT_KEY_REGEX = @"^-(\w)+((\=)?\w+)?$";
        public const string LONG_KEY_REGEX = @"^--[a-z]+(=(\w)+)?$";
        private static ShortKeyDetection _shortDetector;
        private static LongKeyDetection _longDetector;

        public static ShortKeyDetection GetShortKeyDetector()
        {
            if (_shortDetector == null) _shortDetector = new ShortKeyDetection();
            return _shortDetector;
        }

        public static LongKeyDetection GetLongKeyDetector()
        {
            if (_longDetector == null) _longDetector = new LongKeyDetection();
            return _longDetector;
        }

        public class ShortKeyDetection
        {
            private const string KEY_JOINS_VALUE_REGEX = @"=\w+$"; //-u=name<commit_msg>changed short-option regex to ensure it starts with a letter only (case insensitive too)<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;

namespace CommandLineParser.Helpers
{
    public class KeyDetection
    {
        public const string HELP_KEY_REGEX = @"^(--help)|(-h)|(-\?)|(\\\?)$";
        public const string SHORT_KEY_REGEX = @"^-([<KEY>*)((\=)?\w+)?$";
        public const string LONG_KEY_REGEX = @"^--[a-z]+(=(\w)+)?$";
        private static ShortKeyDetection _shortDetector;
        private static LongKeyDetection _longDetector;

        public static ShortKeyDetection GetShortKeyDetector()
        {
            if (_shortDetector == null) _shortDetector = new ShortKeyDetection();
            return _shortDetector;
        }

        public static LongKeyDetection GetLongKeyDetector()
        {
            if (_longDetector == null) _longDetector = new LongKeyDetection();
            return _longDetector;
        }

        public class ShortKeyDetection
        {
            private const string KEY_JOINS_VALUE_REGEX = @"=\w+$"; //-u=name
{'fraction_non_alphanumeric': 0.11916193801833261, 'fraction_numerical': 0.0, 'mean_word_length': 2.8327759197324416, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '7378909', 'n_tokens_mistral': 677, 'n_tokens_neox': 649, 'n_words': 158}