<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;

namespace Bex.Extensions
{
    internal static class UriExtensions
    {
        internal static IEnumerable<KeyValuePair<string, string>> QueryString(this Uri uri)
        {
            var uriString = uri.IsAbsoluteUri ? uri.AbsoluteUri : uri.OriginalString;

            var queryIndex = uriString.IndexOf("?", StringComparison.OrdinalIgnoreCase);

            if (queryIndex == -1)
            {
                return Enumerable.Empty<KeyValuePair<string, string>>();
            }

            var query = uriString.Substring(queryIndex + 1);

            return query.Split('&')
                .Where(x => !string.IsNullOrEmpty(x))
                .Select(x => x.Split('='))
                .Select(x => new KeyValuePair<string, string>(WebUtility.UrlDecode(x[0]), x.Length == 2 && !string.IsNullOrEmpty(x[1]) ? WebUtility.UrlDecode(x[1]) : null));
        }
    }
}<commit_msg>Use the Query property of the Uri<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;

namespace Bex.Extensions
{
    internal static class UriExtensions
    {
        internal static IEnumerable<KeyValuePair<string, string>> QueryString(this Uri uri)
        {
            if (string.IsNullOrEmpty(uri.Query))
            {
                return Enumerable.Empty<KeyValuePair<string, string>>();
            }

            var query = uri.Query.TrimStart('?');

            return query.Split('&')
                .Where(x => !string.IsNullOrEmpty(x))
                .Select(x => x.Split('='))
                .Select(x => new KeyValuePair<string, string>(WebUtility.UrlDecode(x[0]), x.Length == 2 && !string.IsNullOrEmpty(x[1]) ? WebUtility.UrlDecode(x[1]) : null));
        }
    }
}
{'fraction_non_alphanumeric': 0.13110257816785517, 'fraction_numerical': 0.005485463521667581, 'mean_word_length': 2.3966480446927374, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, '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': '4645159', 'n_tokens_mistral': 534, 'n_tokens_neox': 517, 'n_words': 105}