<commit_before>using System.Collections.Generic;
using Palaso.Text;

namespace Bloom.Book
{
	/// <summary>
	/// Holds the values we inject and gather from the document.
	/// </summary>
	public class DataSet
	{
		public DataSet()
		{
			WritingSystemCodes = new Dictionary<string, string>();
			TextVariables = new Dictionary<string, DataItem>();

		}

		/// <summary>
		/// Depending on the context, the correct values for these change. E.g., "V" is the *actual* vernacular when looking at a book in the Vernacular library,
		/// but it should be the national language or UI language when looking a shell in a collection (where we'd want to see, for example, the French title)
		///
		/// Values in use currently are: "V", "N1", "N2"
		/// </summary>
		public Dictionary<string, string> WritingSystemCodes { get; private set; }

		public Dictionary<string, DataItem> TextVariables { get; private set; }

		public void AddGenericLanguageString(string key, string value, bool isCollectionValue)
		{
			var code = new MultiTextBase();
			code.SetAlternative("*", value);
			TextVariables.Add(key, new DataItem(code, isCollectionValue));
		}

		public void UpdateGenericLanguageString(string key, string value, bool isCollectionValue)
		{
			var code = new MultiTextBase();
			code.SetAlternative("*", value);
			if(TextVariables.ContainsKey(key))
			{
				TextVariables.Remove(key);
			}
			TextVariables.Add(key, new DataItem(code, isCollectionValue));
		}

		public void UpdateLanguageString(string writingSystemId, string key, string value, bool isCollectionValue)
		{
			var code = new MultiTextBase();
			code.SetAlternative(writingSystemId, value);
			if (TextVariables.ContainsKey(key))
			{
				TextVariables.Remove(key);
			}
			TextVariables.Add(key, new DataItem(code, isCollectionValue));
		}

		public void AddLanguageString(string writingSystemId, string key, string value, bool isCollectionValue)
		{
			if(!TextVariables.ContainsKey(key))
			{
				var text = new MultiTextBase();
				TextVariables.Add(key, new DataItem(text, isCollectionValue));
			}
			TextVariables[key].TextAlternatives.SetAlternative(writingSystemId,value);
		}
	}

	public class DataItem
	{
		public DataItem(MultiTextBase text, bool isCollectionValue)
		{
			TextAlternatives = text;
			isCollectionValue = isCollectionValue;
		}
		public MultiTextBase TextAlternatives;
		public bool IsCollectionValue;

	}
}<commit_msg>fix capitalization that broke a test (go tests!)<commit_after>using System.Collections.Generic;
using Palaso.Text;

namespace Bloom.Book
{
	/// <summary>
	/// Holds the values we inject and gather from the document.
	/// </summary>
	public class DataSet
	{
		public DataSet()
		{
			WritingSystemCodes = new Dictionary<string, string>();
			TextVariables = new Dictionary<string, DataItem>();

		}

		/// <summary>
		/// Depending on the context, the correct values for these change. E.g., "V" is the *actual* vernacular when looking at a book in the Vernacular library,
		/// but it should be the national language or UI language when looking a shell in a collection (where we'd want to see, for example, the French title)
		///
		/// Values in use currently are: "V", "N1", "N2"
		/// </summary>
		public Dictionary<string, string> WritingSystemCodes { get; private set; }

		public Dictionary<string, DataItem> TextVariables { get; private set; }

		public void AddGenericLanguageString(string key, string value, bool isCollectionValue)
		{
			var code = new MultiTextBase();
			code.SetAlternative("*", value);
			TextVariables.Add(key, new DataItem(code, isCollectionValue));
		}

		public void UpdateGenericLanguageString(string key, string value, bool isCollectionValue)
		{
			var code = new MultiTextBase();
			code.SetAlternative("*", value);
			if(TextVariables.ContainsKey(key))
			{
				TextVariables.Remove(key);
			}
			TextVariables.Add(key, new DataItem(code, isCollectionValue));
		}

		public void UpdateLanguageString(string writingSystemId, string key, string value, bool isCollectionValue)
		{
			var code = new MultiTextBase();
			code.SetAlternative(writingSystemId, value);
			if (TextVariables.ContainsKey(key))
			{
				TextVariables.Remove(key);
			}
			TextVariables.Add(key, new DataItem(code, isCollectionValue));
		}

		public void AddLanguageString(string writingSystemId, string key, string value, bool isCollectionValue)
		{
			if(!TextVariables.ContainsKey(key))
			{
				var text = new MultiTextBase();
				TextVariables.Add(key, new DataItem(text, isCollectionValue));
			}
			TextVariables[key].TextAlternatives.SetAlternative(writingSystemId,value);
		}
	}

	public class DataItem
	{
		public DataItem(MultiTextBase text, bool isCollectionValue)
		{
			TextAlternatives = text;
			IsCollectionValue = isCollectionValue;
		}
		public MultiTextBase TextAlternatives;
		public bool IsCollectionValue;

	}
}
{'fraction_non_alphanumeric': 0.1049268192125335, 'fraction_numerical': 0.0008245722531436817, 'mean_word_length': 4.2172043010752684, 'pattern_counts': {'":': 0, '<': 19, '<?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': '1656863', 'n_tokens_mistral': 1599, 'n_tokens_neox': 1389, 'n_words': 419}