public void FullAnalysisResult_WithData()
        {
            subject.LogOccurrence("ALL", 0);

            var item1    = Shared.BuildExpectedJson("ALL", 1, "[0]");
            var expected = String.Format(jsonFormat, item1);
            var actual   = JsonConvert.SerializeObject(subject);

            Assert.AreEqual(expected, actual);
        }
        public FullAnalysisResult Analyze(string input)
        {
            var result  = new FullAnalysisResult();
            var stemmer = new Porter2();

            var wordSplit     = input.Split(new[] { ' ', ',', '"', ':' }, StringSplitOptions.RemoveEmptyEntries);
            var sentenceIndex = 0;

            foreach (var word in wordSplit)
            {
                Action nextSentenceIndexIfApplicable = () => { };
                var    currentWord = word.ToLowerInvariant();

                if (currentWord.EndsWith("."))
                {
                    currentWord = word.Remove(word.Length - 1, 1);
                    nextSentenceIndexIfApplicable = () => { sentenceIndex++; };

                    if (String.IsNullOrWhiteSpace(currentWord))
                    {
                        nextSentenceIndexIfApplicable();
                        continue;
                    }
                }

                if (WordExceptions.Contains(currentWord))
                {
                    continue;
                }

                var stem = stemmer.Stem(currentWord);

                result.LogOccurrence(stem, sentenceIndex);
                nextSentenceIndexIfApplicable();
            }

            return(result);
        }