<commit_before>namespace RankedSearch.Tests
{
    using System;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using RankedSearch.LanguageModels;
    using Iveonik.Stemmers;
    using RankedSearch.Tokenizers;

    [TestClass]
    public class BagOfWordsTests
    {
        [TestMethod]
        public void InvokingTheConstructor_WithEnumerableOfStrings_ShouldCreateANewInstance()
        {
            var model = new BagOfWords(new[] { string.Empty });
            Assert.IsInstanceOfType(model, typeof(BagOfWords));
        }

        [TestMethod]
        public void InvokingTheConstructor_WithEnumerableOfStrings_ShouldInferCorrectDistribution()
        {
            var model = new BagOfWords(new[] { "I", "run", "and", "run" });
            var actual = model.Query("run");
            
            Assert.AreEqual(0.5, actual);
        }

        [TestMethod]
        public void InvokingTheConstructor_WithEnumerableOfStrings_ShouldInferCorrectDistribution1()
        {
            var model = new BagOfWords(new[] { "I", "run", "and", "running" });
            var actual = model.Query("Run");

            Assert.AreEqual(0, actual);
        }

        [TestMethod]
        public void InvokingTheConstructor_WithEnumerableOfStrings_ShouldInferCorrectDistribution2()
        {
            var model = new BagOfWords(new[] { "speech", "recognition", "system" });
            var actual = model.Query("speech");

            Assert.AreEqual(0.33, Math.Round(actual, 2));
        }

        [TestMethod]
        public void InvokingTheConstructor_WithEnumerableOfStrings_ShouldInferCorrectDistribution3()
        {
            var model = new BagOfWords(new[] { "have", "having" });
            var actual = model.Query("have");

            Assert.AreEqual(0.5, actual);
        }
    }
}<commit_msg>added a few more tests for BagOfWords.cs<commit_after>namespace RankedSearch.Tests
{
    using System;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using RankedSearch.LanguageModels;
    using Iveonik.Stemmers;
    using RankedSearch.Tokenizers;

    [TestClass]
    public class BagOfWordsTests
    {
        [TestMethod]
        public void CreatingAnInstance_WithProvidingEnumerableOfStrings_ShouldCreateANewInstance()
        {
            var model = new BagOfWords(new[] { string.Empty });
            Assert.IsInstanceOfType(model, typeof(BagOfWords));
        }

        [TestMethod]
        public void CreatingAnInstance_WithProvidingEnumerableOfStrings_ShouldInferCorrectDistribution1()
        {
            var model = new BagOfWords(new[] { "I", "run", "and", "run" });
            var actual = model.Query("run");
            
            Assert.AreEqual(0.5, actual);
        }

        [TestMethod]
        public void CreatingAnInstance_WithProvidingEnumerableOfStrings_ShouldInferCorrectDistribution2()
        {
            var model = new BagOfWords(new[] { "I", "run", "and", "running" });
            var actual = model.Query("Run");

            Assert.AreEqual(0, actual);
        }

        [TestMethod]
        public void CreatingAnInstance_WithProvidingEnumerableOfStrings_ShouldInferCorrectDistribution3()
        {
            var model = new BagOfWords(new[] { "speech", "recognition", "system" });
            var actual = model.Query("speech");

            Assert.AreEqual(0.33, Math.Round(actual, 2));
        }

        [TestMethod]
        public void CreatingAnInstance_WithProvidingEnumerableOfStrings_ShouldInferCorrectDistribution4()
        {
            var model = new BagOfWords(new[] { "have", "having" });
            var actual = model.Query("have");

            Assert.AreEqual(0.5, actual);
        }

        [TestMethod]
        public void CreatingAnInstance_WithProvidingEnumerableOfStrings_ShouldInferCorrectDistribution5()
        {
            var model = new BagOfWords(new[] { "a", "b", "c", "d" });
            var actual = model.Query("b");

            Assert.AreEqual(0.25, actual);
        }

        [TestMethod]
        public void CreatingAnInstance_WithProvidingEnumerableOfStrings_ShouldInferCorrectDistribution6()
        {
            var model = new BagOfWords(new[] { "a", "a", "a", "aa" });
            var actual = model.Query("a");

            Assert.AreEqual(0.75, actual);
        }

        [TestMethod]
        public void CreatingAnInstance_WithProvidingEnumerableOfStrings_ShouldInferCorrectDistribution7()
        {
            var model = new BagOfWords(new[] { "a", "a", "a", "aa" });
            var actual = model.Query("aa");

            Assert.AreEqual(0.25, actual);
        }

        [TestMethod]
        public void CreatingAnInstance_WithProvidingEnumerableOfStrings_ShouldInferCorrectDistribution8()
        {
            var model = new BagOfWords(new[] { "hidden", "markov", "models", "hmm", "afa" });
            var actual = model.Query("markov");

            Assert.AreEqual(0.2, actual);
        }

        [TestMethod]
        public void CreatingAnInstance_WithProvidingAnEmptyArray_ShouldInferCorrectDistribution9()
        {
            var model = new BagOfWords(new string[0]);
            var actual = model.Query("markov");

            Assert.AreEqual(0, actual);
        }

        [TestMethod]
        [ExpectedException(typeof(NullReferenceException))]
        public void CreatingAnInstance_WithProvidingAnNullArgument_ShouldThrowException()
        {
            var model = new BagOfWords(null);
        }
    }
}
{'fraction_non_alphanumeric': 0.10491683421677939, 'fraction_numerical': 0.007859623469201243, 'mean_word_length': 2.3987577639751554, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3004993', 'n_tokens_mistral': 1556, 'n_tokens_neox': 1452, 'n_words': 284}