public void AnalyzeWords(List <string> words, ComboSource <string, ThreeTuple <ContinuousDistribution, ContinuousDistribution, ContinuousDistribution> > combo,
                                 Dictionary <string, List <KeyValuePair <double, double> > > sentencesV,
                                 Dictionary <string, List <KeyValuePair <double, double> > > sentencesA,
                                 Dictionary <string, List <KeyValuePair <double, double> > > sentencesD)
        {
            List <KeyValuePair <double, double> > wordsV = new List <KeyValuePair <double, double> >(),
                                                  wordsA = new List <KeyValuePair <double, double> >(),
                                                  wordsD = new List <KeyValuePair <double, double> >();

            foreach (string word in words)
            {
                if (word.StartsWith(" ") || word.Length <= 2)
                {
                    continue;
                }

                ThreeTuple <ContinuousDistribution, ContinuousDistribution, ContinuousDistribution> vad;
                if (!TryGetWordOrStem(combo, word, out vad))
                {
                    continue;
                }

                wordsV.Add(new KeyValuePair <double, double>(vad.one.Mean, 1 / vad.one.Variance));
                wordsA.Add(new KeyValuePair <double, double>(vad.two.Mean, 1 / vad.two.Variance));
                wordsD.Add(new KeyValuePair <double, double>(vad.three.Mean, 1 / vad.three.Variance));
            }

            double vmean = WeightedStatistics.Mean(wordsV), amean = WeightedStatistics.Mean(wordsA), dmean = WeightedStatistics.Mean(wordsD);
            double vvar = WeightedStatistics.Variance(wordsV, vmean, true), avar = WeightedStatistics.Variance(wordsA, amean, true), dvar = WeightedStatistics.Variance(wordsD, dmean, true);

            if (double.IsNaN(vmean) || double.IsNaN(amean) || double.IsNaN(dmean))
            {
                return;
            }

            foreach (string word in words)
            {
                if (word.StartsWith(" ") || word.Length <= 2)
                {
                    continue;
                }

                ThreeTuple <ContinuousDistribution, ContinuousDistribution, ContinuousDistribution> vad;
                if (TryGetWordOrStem(source, word, out vad))
                {
                    continue;
                }

                string stem = stemmer.stemTerm(word);

                AddTextNumerDenom(stem, sentencesV, vmean, vvar);
                AddTextNumerDenom(stem, sentencesA, amean, avar);
                AddTextNumerDenom(stem, sentencesD, dmean, dvar);
            }
        }
        public void AnalyzeSentences(MemorySource <string, ThreeTuple <ContinuousDistribution, ContinuousDistribution, ContinuousDistribution> > inputed,
                                     Dictionary <string, List <KeyValuePair <double, double> > > sentencesV,
                                     Dictionary <string, List <KeyValuePair <double, double> > > sentencesA,
                                     Dictionary <string, List <KeyValuePair <double, double> > > sentencesD, string imputesave)
        {
            using (var stream = File.CreateText(imputesave)) {
                foreach (string stem in sentencesV.Keys)
                {
                    double vmean = WeightedStatistics.Mean(sentencesV[stem]), amean = WeightedStatistics.Mean(sentencesA[stem]), dmean = WeightedStatistics.Mean(sentencesD[stem]);

                    ClippedGaussianDistribution valence = new ClippedGaussianDistribution(vmean, WeightedStatistics.Variance(sentencesV[stem], vmean, true), 0, 1);
                    ClippedGaussianDistribution arousal = new ClippedGaussianDistribution(amean, WeightedStatistics.Variance(sentencesA[stem], amean, true), 0, 1);
                    ClippedGaussianDistribution dominance = new ClippedGaussianDistribution(dmean, WeightedStatistics.Variance(sentencesD[stem], dmean, true), 0, 1);

                    inputed[stem] = new ThreeTuple <ContinuousDistribution, ContinuousDistribution, ContinuousDistribution>(valence, arousal, dominance);
                    stream.WriteLine(stem + "," + valence.InternalMean + "," + valence.InternalVariance + "," + arousal.InternalMean + "," + arousal.InternalVariance + "," + dominance.InternalMean + "," + dominance.InternalVariance);
                }
            }
        }