Example #1
0
        public void NotFail()
        {
            var command = new PhraseToken("Test One", "TestOne");
            var result  = command.Process(new InputStack());

            Assert.Null(result);
        }
Example #2
0
        private static string GetFileName(PhraseToken token)
        {
            string fileName;

            _fileNames.TryGetValue(token, out fileName);
            return(fileName);
        }
Example #3
0
        public void ReturnGroup(string text, string value)
        {
            var stack   = new InputStack(text);
            var command = new PhraseToken(text, value);
            var result  = command.Process(stack);

            Assert.NotNull(result);
            Assert.Equal(value, result.Value);
        }
Example #4
0
        private double GetTokenDuration(PhraseToken token, AnnotationLanguage language, Sex speakerSex)
        {
            string localeKey = _commonTokens.Contains(token) ? "Common" : $"{ToLocale(language)}/{speakerSex.ToString().ToLower()}";
            string key       = GetFileName(token);

            double duration;

            if (!_durations.TryGetValue(Tuple.Create(localeKey, key), out duration))
            {
                _logger.Warn($"No duration for {token} {language}");
            }
            return(duration);
        }
Example #5
0
        public Uri GetFileUri(PhraseToken token, AnnotationLanguage language, Sex speakerSex)
        {
            string fileName = GetFileName(token);

            if (string.IsNullOrWhiteSpace(fileName))
            {
                _logger.Warn($"No file for {token} {language}");
                return(null);
            }
            return(_commonTokens.Contains(token)
                ? new Uri($"ms-appx:///Resources/Sounds/Guidance/Common/{fileName}.mp3")
                : new Uri($"ms-appx:///Resources/Sounds/Guidance/{ToLocale(language)}/{speakerSex.ToString().ToLower()}/{fileName}.mp3"));
        }