Beispiel #1
0
        public string MakeFromTrsx(string fileName, XElement trsxElement, ProgramParameters parameters)
        {
            _log.Enter(this);

            var intents           = new Dictionary <string, HashSet <EntityBasedUtterance> >();
            var allUtterances     = trsxElement.Descendants("sample");  // Utterances are named "samples" in Nuance
            var lines             = new List <string>();
            var reducedUtterances = allUtterances;
            var stats             = new FileStatistic {
                FileName = new FileInfo(fileName).Name, IgnoredIntents = new List <string>()
            };

            stats.UtteranceCount = trsxElement.Descendants("sample").Count();

            reducedUtterances = RemoveUtterancesForIgnoredIntents(parameters, reducedUtterances, stats);

            foreach (var utterance in reducedUtterances)
            {
                stats.ProcessedUtteranceCount += ExtractEntityBasedUtteranceFromXElement(intents, utterance);
            }
            stats.IntentCount = intents.Keys.Count();

            foreach (var key in intents.Keys)
            {
                stats.ResultingUtteranceCount += intents[key].Count();
            }
            stats.LinesWritten = _exceptionHandler.Get(() => WriteIntentsToLudownFile(parameters.DestinationFolderName, fileName, intents));

            return(_statisticsGenerator.Generate(stats));
        }
Beispiel #2
0
        public QuestionStatistics GenerateStatistics(List <Answer> answers)
        {
            if (statsGenerator == null)
            {
                throw new NotImplementedException();
            }

            return(statsGenerator.Generate(this, answers));
        }