<commit_before>﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using Cuemon.Reflection;

namespace Cuemon.Globalization
{
    /// <summary>
    /// This static class is designed to make <see cref="System.Globalization"/> operations easier to work with.
    /// </summary>
    public static class World
    {
        internal static readonly Lazy<IEnumerable<CultureInfo>> SpecificCultures = new Lazy<IEnumerable<CultureInfo>>(() =>
        {
            var cultures = new SortedList<string, CultureInfo>();
            var specificCultures = CultureInfo.GetCultures(CultureTypes.SpecificCultures);
            if (specificCultures != null)
            {
                foreach (var c in specificCultures)
                {
                    cultures.Add(c.DisplayName, c);
                }
                return cultures.Values;
            }

            using (var lfdSpecificCultures = Decorator.Enclose(typeof(World).Assembly).GetManifestResources("CultureInfo.SpecificCultures.dsv", ManifestResourceMatch.ContainsName).Values.Single())
            {
                using (var reader = new StreamReader(lfdSpecificCultures))
                {
                    string specificCulture;
                    while ((specificCulture = reader.ReadLine()) != null)
                    {
                        try
                        {
                            var c = new CultureInfo(specificCulture);
                            cultures.Add(c.DisplayName, c);
                        }
                        catch (CultureNotFoundException)
                        {
                            // ignored on systems not supporting the specificCulture
                        }
                    }
                }
            }
            return cultures.Values;
        });

        private static readonly Lazy<IEnumerable<RegionInfo>> SpecificRegions = new Lazy<IEnumerable<RegionInfo>>(() =>
        {
            var regions = new SortedList<string, RegionInfo>(StringComparer.OrdinalIgnoreCase);
            foreach (var c in SpecificCultures.Value)<commit_msg>Removed legacy impl. needed for dotnetcore 1<commit_after>﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;

namespace Cuemon.Globalization
{
    /// <summary>
    /// This static class is designed to make <see cref="System.Globalization"/> operations easier to work with.
    /// </summary>
    public static class World
    {
        internal static readonly Lazy<IEnumerable<CultureInfo>> SpecificCultures = new Lazy<IEnumerable<CultureInfo>>(() =>
        {
            var cultures = new SortedList<string, CultureInfo>();
            var specificCultures = CultureInfo.GetCultures(CultureTypes.SpecificCultures);
            foreach (var c in specificCultures)
            {
                cultures.Add(c.DisplayName, c);
            }
            return cultures.Values;
        });

        private static readonly Lazy<IEnumerable<RegionInfo>> SpecificRegions = new Lazy<IEnumerable<RegionInfo>>(() =>
        {
            var regions = new SortedList<string, RegionInfo>(StringComparer.OrdinalIgnoreCase);
            foreach (var c in SpecificCultures.Value)
{'fraction_non_alphanumeric': 0.08766035430665853, 'fraction_numerical': 0.00030543677458766036, 'mean_word_length': 1.9319606087735004, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2542350', 'n_tokens_mistral': 799, 'n_tokens_neox': 771, 'n_words': 188}