// Token: 0x0600114F RID: 4431 RVA: 0x00065178 File Offset: 0x00063378 private bool IsWordAcceptable(string word) { bool result = true; IList <string> list = null; try { list = SpeechRecognizerInfo.GetNormalizedForms(this.engine, word); } catch (COMException ex) { this.logger.TraceError(this, "NameNormalizer.IsWordAcceptable - word='{0}', exception='{1}'", new object[] { word, ex }); throw; } ExAssert.RetailAssert(list != null, "normalizedForms is null"); ExAssert.RetailAssert(list.Count > 0, "normalizedForms is empty"); if (list.Count > 1 && !this.CanAcceptNormalizedForms(word, list, this.culture, SpeechRecognizerInfo.TextNormalizationRequiresSpecialHandling(this.culture))) { if (ExTraceGlobals.UMGrammarGeneratorTracer.IsTraceEnabled(TraceType.DebugTrace)) { StringBuilder stringBuilder = new StringBuilder(128); foreach (string value in list) { stringBuilder.Append(value); stringBuilder.Append(" "); } this.logger.TraceDebug(this, "NameNormalizer:IsWordAcceptable word='{0}' normalized to '{1}' count='{2}'", new object[] { word, stringBuilder.ToString(), list.Count }); stringBuilder.Length = 0; } result = false; } return(result); }
// 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: 0x0600115F RID: 4447 RVA: 0x00065C40 File Offset: 0x00063E40 static SpeechRecognizerInfo() { SpeechRecognizerInfo.InitializeInstalledRecognizers(); }