private async void OnTestLuisAppFlyoutOpened(object sender, object e)
        {
            try
            {
                // Run LUIS app tests
                this.luisAppTestResultTextBox.Text = "";
                string[] utterances =
                {
                    "I'd like to get a hat",
                    "I am more interested in sunglasses",
                    "Caps for me",
                    "Blah-blah-blah"
                };
                for (int i = 0; i < utterances.Length; i++)
                {
                    string entity = await LuisServiceHelper.GetEntity(utterances[i]);

                    this.luisAppTestResultTextBox.Text += $"utterance: '{utterances[i]}'\n=> entity: '{entity}'\n";
                }
            }
            catch (Exception ex)
            {
                this.luisAppTestResultTextBox.Text = ex.Message;
            }
        }
예제 #2
0
        public async Task <string> RecognizeChoice()
        {
            string entity = "";

            if (this.isUsingSpeech)
            {
                string speechText = await SpeechToTextServiceHelper.GetTextFromSpeechAsync();

                if (this.isDebugInfo)
                {
                    this.debugInfo.Text = string.IsNullOrEmpty(speechText) ? "" : speechText;
                }
                entity = await LuisServiceHelper.GetEntity(speechText);

                if (this.isDebugInfo)
                {
                    string text = this.debugInfo.Text;
                    this.debugInfo.Text = $"{text} => {entity}";
                }
            }

            return(entity);
        }