<commit_before>﻿using Utf8Json;

namespace Nest
{
	internal class RelationNameFormatter : IJsonFormatter<RelationName>
	{
		public RelationName Deserialize(ref JsonReader reader, IJsonFormatterResolver formatterResolver)
		{
			if (reader.GetCurrentJsonToken() == JsonToken.String)
			{
				RelationName relationName = reader.ReadString();
				return relationName;
			}

			return null;
		}

		public void Serialize(ref JsonWriter writer, RelationName value, IJsonFormatterResolver formatterResolver)
		{
			if (value == null)
			{
				writer.WriteNull();
				return;
			}

			var settings = formatterResolver.GetConnectionSettings();
			writer.WriteString(settings.Inferrer.RelationName(value));
		}
	}
}
<commit_msg>Support RelationName as dictionary key<commit_after>﻿using Utf8Json;

namespace Nest
{
	internal class RelationNameFormatter : IJsonFormatter<RelationName>, IObjectPropertyNameFormatter<RelationName>
	{
		public RelationName Deserialize(ref JsonReader reader, IJsonFormatterResolver formatterResolver)
		{
			if (reader.GetCurrentJsonToken() == JsonToken.String)
			{
				RelationName relationName = reader.ReadString();
				return relationName;
			}

			return null;
		}

		public void Serialize(ref JsonWriter writer, RelationName value, IJsonFormatterResolver formatterResolver)
		{
			if (value == null)
			{
				writer.WriteNull();
				return;
			}

			var settings = formatterResolver.GetConnectionSettings();
			writer.WriteString(settings.Inferrer.RelationName(value));
		}

		public void SerializeToPropertyName(ref JsonWriter writer, RelationName value, IJsonFormatterResolver formatterResolver) =>
			Serialize(ref writer, value, formatterResolver);

		public RelationName DeserializeFromPropertyName(ref JsonReader reader, IJsonFormatterResolver formatterResolver) =>
			Deserialize(ref reader, formatterResolver);
	}
}

{'fraction_non_alphanumeric': 0.08162162162162162, 'fraction_numerical': 0.001081081081081081, 'mean_word_length': 5.108910891089109, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, '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': '1090256', 'n_tokens_mistral': 605, 'n_tokens_neox': 517, 'n_words': 114}