public LearningModeExecutor( ConfigService <AppSettings> configService, ILogger <LearningModeExecutor> logger, JsonService jsonService, ILearningHistoryService learningHistoryService, IPronunciation pronunciationService, ILogger <IPronunciation> pronunciationLogger, LearningModeConsoleService consoleService) { ConfigService = configService; Logger = logger; JsonService = jsonService; LearningHistoryService = learningHistoryService; PronunciationService = pronunciationService; PronunciationLogger = pronunciationLogger; ConsoleService = consoleService; }
/// <summary> /// Returns the string of words leading up to this token. /// </summary> /// <param name="wantFiller">if true, filler words are added</param> /// <param name="wantPronunciations">if true append [ phoneme phoneme ... ] after each word</param> /// <returns></returns> public String getWordPath(Boolean wantFiller, Boolean wantPronunciations) { StringBuilder sb = new StringBuilder(); Token token = this; while (token != null) { if (token.isWord()) { IWordSearchState wordState = (IWordSearchState)token.getSearchState(); IPronunciation pron = wordState.getPronunciation(); IWord word = wordState.getPronunciation().getWord(); //Console.Out.WriteLine(token.getFrameNumber() + " " + word + " " + token.logLanguageScore + " " + token.logAcousticScore); if (wantFiller || !word.isFiller()) { if (wantPronunciations) { sb.Insert(0, ']'); IUnit[] u = pron.getUnits(); for (int i = u.Length - 1; i >= 0; i--) { if (i < u.Length - 1) { sb.Insert(0, ','); } sb.Insert(0, u[i].getName()); } sb.Insert(0, '['); } sb.Insert(0, word.getSpelling()); sb.Insert(0, ' '); } } token = token.getPredecessor(); } return(sb.ToString().Trim()); }
private static byte[] GetPronunciation(long id, SpeakerDataType type) { IPronunciationQuery pronunciationQuery = null; if (type == SpeakerDataType.Word) { pronunciationQuery = new WordsQuery(); } else if (type == SpeakerDataType.Sentence) { pronunciationQuery = new SentencesQuery(); } if (pronunciationQuery == null) { LoggerWrapper.LogTo(LoggerName.Errors).ErrorFormat( "SpeakerController.GetPronunciation передан некорректный тип {0}", type); return(null); } IPronunciation pronunciationEntity = pronunciationQuery.GetById(id); return(pronunciationEntity != null ? pronunciationEntity.Pronunciation : null); }