public async Task <SentimentBatchResult> RunSentimentAnalysisAsync(CidadaoModel cidadao)
        {
            var credentials = new ApiKeyServiceClientCredentials(key);
            var client      = new TextAnalyticsClient(credentials)
            {
                Endpoint = endpoint
            };

            // The documents to be analyzed. Add the language of the document. The ID can be any value.
            var inputDocuments = new MultiLanguageBatchInput(
                new List <MultiLanguageInput>
            {
                new MultiLanguageInput("1", cidadao.texto, "pt"),
            });

            var result = await client.SentimentBatchAsync(inputDocuments);

            // Printing sentiment results
            // Console.WriteLine("===== Sentiment Analysis =====\n");

            //foreach (var document in result.Documents)
            //{

            //    // Console.WriteLine($"Document ID: {document.Id} , Sentiment Score: {document.Score:0.00}");
            //}

            return(result);
        }
        public async Task RunRecognizeEntitiesAsync(CidadaoModel cidadao)
        {
            var credentials = new ApiKeyServiceClientCredentials(key);
            var client      = new TextAnalyticsClient(credentials)
            {
                Endpoint = endpoint
            };

            // The documents to be submitted for entity recognition. The ID can be any value.
            var inputDocuments = new MultiLanguageBatchInput(
                new List <MultiLanguageInput>
            {
                new MultiLanguageInput("1", cidadao.texto, "pt"),
            });

            var entitiesResult = await client.EntitiesBatchAsync(inputDocuments);


            foreach (var document in entitiesResult.Documents)
            {
                foreach (var entity in document.Entities)
                {
                    foreach (var match in entity.Matches)
                    {
                        // Console.WriteLine($"\t\t\tOffset: {match.Offset},\tLength: {match.Length},\tScore: {match.EntityTypeScore:F3}");
                    }
                }
            }
            // Console.WriteLine();
        }
        public async Task RunKeyPhraseExtractionAsync(CidadaoModel cidadao)
        {
            var credentials = new ApiKeyServiceClientCredentials(key);
            var client      = new TextAnalyticsClient(credentials)
            {
                Endpoint = endpoint
            };

            var inputDocuments = new MultiLanguageBatchInput(
                new List <MultiLanguageInput>
            {
                new MultiLanguageInput("1", "猫は幸せ", "ja"),
                new MultiLanguageInput("2", "Fahrt nach Stuttgart und dann zum Hotel zu Fu.", "de"),
                new MultiLanguageInput("3", "My cat might need to see a veterinarian.", "en"),
                new MultiLanguageInput("4", "A mi me encanta el fútbol!", "es")
            });

            var kpResults = await client.KeyPhrasesBatchAsync(inputDocuments);

            // Printing keyphrases

            foreach (var document in kpResults.Documents)
            {
                foreach (string keyphrase in document.KeyPhrases)
                {
                }
            }
        }
        public async Task RunLanguageDetectionAsync(CidadaoModel cidadao)
        {
            var credentials = new ApiKeyServiceClientCredentials(key);
            var client      = new TextAnalyticsClient(credentials)
            {
                Endpoint = endpoint
            };

            // The documents to be submitted for language detection. The ID can be any value.
            var inputDocuments = new LanguageBatchInput(
                new List <LanguageInput>
            {
                new LanguageInput("1", cidadao.texto),
            });

            var langResults = await client.DetectLanguageBatchAsync(inputDocuments);

            // Printing detected languages

            foreach (var document in langResults.Documents)
            {
            }
        }