// Token: 0x06001149 RID: 4425 RVA: 0x00064EA0 File Offset: 0x000630A0 public NameNormalizer(CultureInfo culture, SpeechRecognitionEngine engine, string cacheFileNamePrefix, string grammarFolderPath, Logger logger, INormalizationCacheFileStore cacheFileStore) { ValidateArgument.NotNull(culture, "culture"); ValidateArgument.NotNull(engine, "engine"); ValidateArgument.NotNullOrEmpty(cacheFileNamePrefix, "cacheFileNamePrefix"); ValidateArgument.NotNullOrEmpty(grammarFolderPath, "grammarFolderPath"); ValidateArgument.NotNull(logger, "logger"); this.logger = logger; this.logger.TraceDebug(this, "Entering NameNormalizer constructor culture='{0}', cacheFileNamePrefix='{1}', grammarFolderPath='{2}'", new object[] { culture, cacheFileNamePrefix, grammarFolderPath }); this.culture = culture; this.engine = engine; this.normalizationCache = new NormalizationCache(culture, cacheFileNamePrefix, grammarFolderPath, logger, cacheFileStore); }
// Token: 0x06001130 RID: 4400 RVA: 0x00063F64 File Offset: 0x00062164 private List <string> GenerateGrammar(CultureInfo c, IGrammarGeneratorInterface generatorInstance) { base.Logger.TraceDebug(this, "Entering GrammarGenerator.GenerateGrammar culture='{0}'", new object[] { c }); string runFolderPath = base.RunData.RunFolderPath; string adentriesFileName = generatorInstance.ADEntriesFileName; List <string> list = null; try { string entriesFilePath = ADCrawler.GetEntriesFilePath(runFolderPath, adentriesFileName); List <DirectoryGrammar> grammarList = generatorInstance.GetGrammarList(); list = new List <string>(grammarList.Count); UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_GrammarGenerationWritingGrammarEntriesStarted, null, new object[] { adentriesFileName, c.Name, base.TenantId, base.RunId }); string grammarFileFolderPath = GrammarFileDistributionShare.GetGrammarFileFolderPath(base.OrgId, base.MailboxGuid, base.RunId, c); Directory.CreateDirectory(grammarFileFolderPath); string recognizerId = SpeechRecognizerInfo.GetRecognizerId(c); if (recognizerId != null) { string grammarFolderPath = GrammarFileDistributionShare.GetGrammarFolderPath(base.OrgId, base.MailboxGuid); INormalizationCacheFileStore cacheFileStore = NormalizationCacheMailboxFileStore.FromMailboxGuid(base.OrgId, base.MailboxGuid); using (SpeechRecognitionEngine speechRecognitionEngine = new SpeechRecognitionEngine(recognizerId)) { using (XmlReader xmlReader = XmlReader.Create(entriesFilePath)) { using (GrammarGenerationLog grammarGenerationLog = new GrammarGenerationLog(grammarFileFolderPath, base.Logger)) { NameNormalizer nameNormalizer = new NameNormalizer(c, speechRecognitionEngine, adentriesFileName, grammarFolderPath, base.Logger, cacheFileStore); this.InitializeGrammars(grammarFileFolderPath, c, grammarList); if (xmlReader.ReadToFollowing("ADEntry")) { for (;;) { ADEntry adentry = this.LoadADEntry(xmlReader, nameNormalizer, grammarGenerationLog); if (adentry != null && !this.WriteADEntryToGrammars(adentry, grammarList)) { break; } base.RunData.ThrowIfShuttingDown(); if (!xmlReader.ReadToFollowing("ADEntry")) { goto IL_18A; } } base.Logger.TraceError(this, "GrammarGenerator.Run - Cannot accept more entries in any of the grammar files", new object[0]); } IL_18A: list.AddRange(this.CompleteGrammars(grammarList)); this.UploadResults(list, nameNormalizer, c); } } goto IL_204; } } UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_GrammarGenerationMissingCulture, null, new object[] { base.TenantId, c.Name, Utils.GetLocalHostFqdn() }); IL_204: UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_GrammarGenerationWritingGrammarEntriesCompleted, null, new object[] { adentriesFileName, c.Name, base.TenantId, base.RunId }); } catch (Exception ex) { base.Logger.TraceError(this, "GrammarGenerator.Run - Exception='{0}'", new object[] { ex }); this.exception = ex; throw; } return(list); }
// Token: 0x06001150 RID: 4432 RVA: 0x000652C8 File Offset: 0x000634C8 public NormalizationCache(CultureInfo culture, string fileNamePrefix, string grammarFolderPath, Logger logger, INormalizationCacheFileStore cacheFileStore) { ValidateArgument.NotNull(culture, "culture"); ValidateArgument.NotNullOrEmpty(fileNamePrefix, "fileNamePrefix"); ValidateArgument.NotNullOrEmpty(grammarFolderPath, "grammarFolderPath"); ValidateArgument.NotNull(logger, "logger"); this.logger = logger; this.logger.TraceDebug(this, "Entering NormalizationCache constructor culture='{0}', fileNamePrefix='{1}'", new object[] { culture, fileNamePrefix }); this.culture = culture; this.fileNamePrefix = fileNamePrefix; this.normalizationCacheFolderPath = Path.Combine(grammarFolderPath, "NormalizationCache"); this.versionedCacheFolderName = string.Format(CultureInfo.InvariantCulture, "{0}-{1}", new object[] { "1.0", typeof(Dictionary <string, bool>).Assembly.ImageRuntimeVersion }); this.cacheFileStore = cacheFileStore; this.Initialize(); }