Ejemplo n.º 1
0
        private static double CalculateLinearModelPerplexityOnTestCorpus(CorpusParsingResult trainingCorpus, ReadCorpusResult evaluatingCorpus, bool development)
        {
            Console.WriteLine("Calculating Perplexity after training on {0}", trainingCorpus.CorpusName);
            Console.WriteLine("Calculating perplexity for {0}", evaluatingCorpus.CorpusName);

            Console.WriteLine("{0}\tProblem", evaluatingCorpus.CorpusName.ToString());

            ILanguageModel model = new LinearModel(trainingCorpus);
            Console.WriteLine("{0}\tModel", model.GetModelName());
            StringParsingResult testCorpus = CorpusParsing.ParseString(development ? evaluatingCorpus.Development : evaluatingCorpus.Evaluation);
            double perplexity = CalculatePerplexityWrapper(model, trainingCorpus, testCorpus);

            Console.WriteLine("============================================================");

            return perplexity;
        }
 public void LinearModel_WellDefinedProbability()
 {
     ILanguageModel linearModel = new LinearModel(_twoDogSentencesCorpus);
     TestWellDefinedProbability(linearModel, false);
 }