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

namespace Parser.Tests
{
    /// <summary>
    /// Serializer using the great JSON.NET
    /// </summary>
    public class JsonNetSerializer : ISerializer
    {

        public static ISerializer Instance => new JsonNetSerializer();

        #region Implementation of ISerialization

        public void SerializeObject(StringBuilder sb, object value, IFormatProvider formatProvider)
        {
            sb.AppendFormat(formatProvider, "{0}", JsonConvert.SerializeObject(value));
        }

        #endregion
    }
}<commit_msg>extra render options for json.net<commit_after>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace Parser.Tests
{
    /// <summary>
    /// Serializer using the great JSON.NET
    /// </summary>
    public class JsonNetSerializer : ISerializer
    {
        private readonly bool _singleQuote;
        private readonly bool _alwaysQuote;
        private JsonSerializer _serializer;

        /// <summary>Initializes a new instance of the <see cref="T:System.Object" /> class.</summary>
        public JsonNetSerializer(bool singleQuote, bool alwaysQuote)
        {
            _singleQuote = singleQuote;
            _alwaysQuote = alwaysQuote;
            _serializer = new JsonSerializer();
        }


        public static ISerializer Instance => new JsonNetSerializer(false, false);

        #region Implementation of ISerialization

        public void SerializeObject(StringBuilder sb, object value, IFormatProvider formatProvider)
        {
            var stringWriter = new StringWriter(sb, formatProvider);
            using (var writer = new JsonTextWriter(stringWriter))
            {
                writer.QuoteName = !_alwaysQuote;
                if (_singleQuote)
                {
                    writer.QuoteChar = '\'';
                }
                _serializer.Serialize(writer, value);
            }
        }

        #endregion
    }
}
{'fraction_non_alphanumeric': 0.0847535697835099, 'fraction_numerical': 0.00046061722708429296, 'mean_word_length': 2.3674418604651164, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 12, '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': '2478182', 'n_tokens_mistral': 553, 'n_tokens_neox': 537, 'n_words': 147}