예제 #1
0
    // BrianLanguageUnderstandingService
    //string luisEndpoint = "https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/e55cc38f-5070-450a-8d2d-8ae4239a6935?subscription-key=e87015cabeeb45dca44eb179d00eb275&verbose=true&timezoneOffset=-480&q=";

    private void Awake()
    {
        Debug.Log("LuisManager.Awake");

        // allows this class instance to behave like a singleton
        instance = this;
    }
예제 #2
0
    void Start()
    {
        // If no manager specified, see if one is on the same GameObject
        if (LuisManager == null)
        {
            LuisManager = GetComponent <LuisManager>();
        }

        // Validate components
        if (LuisManager == null)
        {
            Debug.LogErrorFormat("The {0} inspector field is not set and is required. {1} did not load.", nameof(LuisManager), this.GetType().Name);
            enabled = false;
            return;
        }

        // Enable debugging?
        if (EnableDebugging)
        {
            LuisManager.IntentHandlers.Add(new DebugIntentHandler());
        }

        // Predict on start?
        if ((PredictOnStart) && (!string.IsNullOrEmpty(TestUtterance)))
        {
            TryPredict();
        }
    }
예제 #3
0
        public virtual async Task <HttpResponseMessage> Post([FromBody] Activity activity)
        {
            // check if activity is of type message
            if (activity.GetActivityType() == ActivityTypes.Message)
            {
                //cria o gerenciador das informacoes do LUIS
                var manager = new LuisManager();

                //inicializa erecuperando sa informacoes na base
                await manager.InitAsync();

                //seta o dialog do LUIS
                await Conversation.SendAsync(activity, () => new GenericDialog(
                                                 manager.LuisAppId,
                                                 manager.LuisApiKey,
                                                 manager.LuisHostRegion,
                                                 manager.QnaService));

                //await Conversation.SendAsync(activity, () => new BasicLuisDialog());
            }
            else
            {
                HandleSystemMessage(activity);
            }
            return(new HttpResponseMessage(System.Net.HttpStatusCode.Accepted));
        }
    private void Awake()
    {
        string path = "Assets/Resources/luis.lic";

        //Read the text from directly from the test.txt file
        using (StreamReader reader = new StreamReader(path))
        {
            luisEndpoint = reader.ReadToEnd();
        }

        // allows this class instance to behave like a singleton
        instance = this;
    }
예제 #5
0
        static async Task MainAsync(string subscriptionKey, string appName, string appVersion)
        {
            var manager     = new LuisManager(subscriptionKey);
            var application = await manager.Apps.GetApplicationAsync(appName);

            var intents = await application.Intent.GetIntentsAsync(versionId : appVersion);

            var labels = await application.Intent.GetAllLabelsAsync(versionId : appVersion);

            AnalyzeData(intents, labels, out Dictionary <string, double> accuracyErrors, out Dictionary <string, double> accuracyAvg);

            Report(nameof(accuracyErrors), accuracyErrors);
            Report(nameof(accuracyAvg), accuracyAvg);

            Console.ReadLine();
        }
    void Start()
    {
        // If no manager specified, see if one is on the same GameObject
        if (LuisManager == null)
        {
            LuisManager = GetComponent <LuisManager>();
        }

        // Validate components
        if (LuisManager == null)
        {
            Debug.LogErrorFormat("The {0} inspector field is not set and is required. {1} did not load.", nameof(LuisManager), this.GetType().Name);
            enabled = false;
            return;
        }

        // If there is a test button in the scene, wire up the click handler.
        if (SceneTestButton != null)
        {
            SceneTestButton.onClick.AddListener(() =>
            {
                TryPredict();
            });
        }

        // If there is a test text field, setup the default
        if ((SceneUtteranceInput != null) && (string.IsNullOrEmpty(SceneUtteranceInput.text)))
        {
            SceneUtteranceInput.text = TestUtterance;
        }

        // Enable debugging?
        if (EnableDebugging)
        {
            LuisManager.IntentHandlers.Add(new DebugIntentHandler());
        }

        // Predict on start?
        if ((PredictOnStart) && (!string.IsNullOrEmpty(TestUtterance)))
        {
            TryPredict();
        }
    }
예제 #7
0
        public ActionResult SmartInteract(string q, string device)
        {
            Response.AppendHeader("Access-Control-Allow-Origin", "*");

            if (device == null)
            {
                device = "alexa";
            }
            LuisManager    luis    = new LuisManager();
            LUIS           intent  = luis.ExtractIntent(q);
            NewsBotManager newsBot = new NewsBotManager();

            return(new JsonResult
            {
                Data = newsBot.GetNewsLinesByIntent(intent, device),
                JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                ContentType = "application/json"
            });
        }
예제 #8
0
 private void Awake()
 {
     // allows this class instance to behave like a singleton
     instance = this;
 }
예제 #9
0
    //string luisEndpoint = "https://northeurope.api.cognitive.microsoft.com/luis/v2.0/apps/03316aef-f078-4361-89f9-1fbae3791356?subscription-key=fbe92a643352443886070d47cd81cfb0&verbose=true&timezoneOffset=60";
    // string luisEndpoint = "https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/8241229d-92cf-4eda-ba7d-44b77f18f444?subscription-key=42b9e51aff974485a8cdf01929c52e9a&verbose=true&timezoneOffset=60&q=";


    private void Awake()
    {
        instance = this;
    }