<commit_before>// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

// This is a generated sample ("LongRunningRequestPollUntilComplete", "batch_translate_text_with_glossary_and_model")

using CommandLine;
// [START batch_translate_text_with_glossary_and_model]
using Google.Cloud.Translate.V3;
using System;
using System.Collections.Generic;

namespace Google.Cloud.Translate.V3.Samples
{
    public class TranslateV3BatchTranslateTextWithGlossaryAndModel
    {
        /// <summary>
        /// Batch translate text with Model and Glossary
        /// </summary>
        /// <param name="targetLanguage">Required. Specify up to 10 language codes here.</param>
        /// <param name="sourceLanguage">Required. Source language code.</param>
        /// <param name="modelId">The models to use for translation. Map's key is target language
        /// code.</param>
        /// <param name="glossaryId">Required. Specifies the glossary used for this translation.</param>
        public static void SampleBatchTranslateTextWithGlossaryAndModel(string inputUri, string outputUri,
            string projectId, string location, string targetLanguage,
            string sourceLanguage, string modelId, string glossaryId)
        {
            TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
            // TODO(developer): Uncomment and set the following variables
            // string inputUri = "gs://cloud-samples-data/text.txt"
            // string outputUri = "gs://YOUR_BUCKET_ID/path_to_store_results/"
            // string projectId = "[Google Cloud Project ID]"
            // string location = "us-central1"
            // string targetLanguage = "en"
            // string sourceLanguage = "de"
            // string modelId = "{YOUR_MODEL_ID}"
            // string glossaryId = "{YOUR_GLOSSARY_ID}"

            string modelPath = $"projects/{projectId}/locations/{location}/models/{modelId}";
            string glossaryPath = $"projects/{projectId}/locations/{location}/glossaries/{glossaryId}";

            BatchTranslateTextRequest request = new BatchTranslateTextRequest
            {
                ParentAsLocationName = new LocationName(projectId, location),
                SourceLanguageCode = sourceLanguage,
                TargetLanguageCodes =
                {
                    // Required. Specify up to 10 language codes here.
                    targetLanguage,
                },
                InputConfigs =
                {
                    new InputConfig
                    {
                        GcsSource = new GcsSource
                        {
                            InputUri = inputUri,
                        },
                        MimeType = "text/plain",
                    },
                },
                OutputConfig = new OutputConfig
                {
                    GcsDestination = new GcsDestination
                    {
                        OutputUriPrefix = outputUri,
                    },
                },
                Models =
                {
                    // The models to use for translation. Map's key is target language code.
                    { targetLanguage, modelPath },
                },
                Glossaries =
                {
                    { targetLanguage, new TranslateTextGlossaryConfig
                        {
                            Glossary = glossaryPath,
                        } 
                    },
                },
            };
            // Poll until the returned long-running operation is complete
            BatchTranslateResponse response = translationServiceClient.BatchTranslateText(request).PollUntilCompleted().Result;
            // Display the translation for each input text provided
            Console.WriteLine($"Total Characters: {response.TotalCharacters}");
            Console.WriteLine($"Translated Characters: {response.TranslatedCharacters}");
        }
    }

    // [END batch_translate_text_with_glossary_and_model]

    public class BatchTranslateTextWithGlossaryAndModelMain
    {
        public static void Main(string[] args)
        {
            new Parser(with => with.CaseInsensitiveEnumValues = true).ParseArguments<Options>(args)
                .WithParsed<Options>(opts =>
                    TranslateV3BatchTranslateTextWithGlossaryAndModel.SampleBatchTranslateTextWithGlossaryAndModel(
                        opts.InputUri, opts.OutputUri, opts.ProjectId, opts.Location,
                        opts.TargetLanguage, opts.SourceLanguage, opts.ModelId, opts.GlossaryId));
        }

        public class Options
        {
            [Option("input_uri", Default = "gs://cloud-samples-data/text.txt")]
            public string InputUri { get; set; }

            [Option("output_uri", Default = "gs://YOUR_BUCKET_ID/path_to_store_results/")]
            public string OutputUri { get; set; }<commit_msg>fixed lint issue<commit_after>// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

// This is a generated sample ("LongRunningRequestPollUntilComplete", "batch_translate_text_with_glossary_and_model")

using CommandLine;
// [START batch_translate_text_with_glossary_and_model]
using Google.Cloud.Translate.V3;
using System;
using System.Collections.Generic;

namespace Google.Cloud.Translate.V3.Samples
{
    public class TranslateV3BatchTranslateTextWithGlossaryAndModel
    {
        /// <summary>
        /// Batch translate text with Model and Glossary
        /// </summary>
        /// <param name="targetLanguage">Required. Specify up to 10 language codes here.</param>
        /// <param name="sourceLanguage">Required. Source language code.</param>
        /// <param name="modelId">The models to use for translation. Map's key is target language
        /// code.</param>
        /// <param name="glossaryId">Required. Specifies the glossary used for this translation.</param>
        public static void SampleBatchTranslateTextWithGlossaryAndModel(string inputUri, string outputUri,
            string projectId, string location, string targetLanguage,
            string sourceLanguage, string modelId, string glossaryId)
        {
            TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
            // TODO(developer): Uncomment and set the following variables
            // string inputUri = "gs://cloud-samples-data/text.txt"
            // string outputUri = "gs://YOUR_BUCKET_ID/path_to_store_results/"
            // string projectId = "[Google Cloud Project ID]"
            // string location = "us-central1"
            // string targetLanguage = "en"
            // string sourceLanguage = "de"
            // string modelId = "{YOUR_MODEL_ID}"
            // string glossaryId = "{YOUR_GLOSSARY_ID}"

            string modelPath = $"projects/{projectId}/locations/{location}/models/{modelId}";
            string glossaryPath = $"projects/{projectId}/locations/{location}/glossaries/{glossaryId}";

            BatchTranslateTextRequest request = new BatchTranslateTextRequest
            {
                ParentAsLocationName = new LocationName(projectId, location),
                SourceLanguageCode = sourceLanguage,
                TargetLanguageCodes =
                {
                    // Required. Specify up to 10 language codes here.
                    targetLanguage,
                },
                InputConfigs =
                {
                    new InputConfig
                    {
                        GcsSource = new GcsSource
                        {
                            InputUri = inputUri,
                        },
                        MimeType = "text/plain",
                    },
                },
                OutputConfig = new OutputConfig
                {
                    GcsDestination = new GcsDestination
                    {
                        OutputUriPrefix = outputUri,
                    },
                },
                Models =
                {
                    // The models to use for translation. Map's key is target language code.
                    { targetLanguage, modelPath },
                },
                Glossaries =
                {
                    { targetLanguage, new TranslateTextGlossaryConfig
                        {
                            Glossary = glossaryPath,
                        }
                    },
                },
            };
            // Poll until the returned long-running operation is complete
            BatchTranslateResponse response = translationServiceClient.BatchTranslateText(request).PollUntilCompleted().Result;
            // Display the translation for each input text provided
            Console.WriteLine($"Total Characters: {response.TotalCharacters}");
            Console.WriteLine($"Translated Characters: {response.TranslatedCharacters}");
        }
    }

    // [END batch_translate_text_with_glossary_and_model]

    public class BatchTranslateTextWithGlossaryAndModelMain
    {
        public static void Main(string[] args)
        {
            new Parser(with => with.CaseInsensitiveEnumValues = true).ParseArguments<Options>(args)
                .WithParsed<Options>(opts =>
                    TranslateV3BatchTranslateTextWithGlossaryAndModel.SampleBatchTranslateTextWithGlossaryAndModel(
                        opts.InputUri, opts.OutputUri, opts.ProjectId, opts.Location,
                        opts.TargetLanguage, opts.SourceLanguage, opts.ModelId, opts.GlossaryId));
        }

        public class Options
        {
            [Option("input_uri", Default = "gs://cloud-samples-data/text.txt")]
            public string InputUri { get; set; }

            [Option("output_uri", Default = "gs://YOUR_BUCKET_ID/path_to_store_results/")]
            public string OutputUri { get; set; }
{'fraction_non_alphanumeric': 0.08443558615691249, 'fraction_numerical': 0.0030802681645225585, 'mean_word_length': 1.8509814049586777, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 31, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2149665', 'n_tokens_mistral': 2701, 'n_tokens_neox': 2547, 'n_words': 690}