Exemple #1
0
        private static bool update = true; // if true, only re-translate files that were edited (NOT WORKING)

        public static void Main(string[] args)
        {
            // create service collection
            var services = new ServiceCollection();

            ConfigureServices(services);

            // create service provider
            var serviceProvider = services.BuildServiceProvider();

            GMFileAccess.SetGoogleCredentialsEnvironmentVariable();

            TranslateDocs translate = serviceProvider.GetService <TranslateDocs>();

            // ################  Translate documentation files ########################

            // UNCOMMENT one of the following lines as you prefer
            //TranslateDocumentsLanguages(allDocuments, allLanguages, update);
            //translate.TranslateDocuments(allDocuments, someLanguages, update);
            //translate.TranslateDocuments(someDocuments, allLanguages, update);
            //translate.TranslateDocuments(someDocuments, someLanguages, update);


            // ################  Add new language to lookup arrays for GUI ########################

            // UNCOMMENT this to add a new language to the arrays.
            //translate.AddNewLanguageToArrays("hu", "Hungarian")
        }
Exemple #2
0
        static void TranscribeVideo(
            SampleVideo sample,              // sample video to use
            string fixedTags,                // file in which to save the fixed transcription
            string audio,                    // file in which to save the extracted audio
            bool useSmallSample,             // if true, use a small sample of the video/audio
            bool useAudioFileAlreadyInCloud, // if true, use prior audio in cloud if it exists
            string rawTranscription)         // file in which to save the raw transcription
        {
            string videofilePath                   = sample.filepath;
            string objectName                      = sample.objectname;
            RepeatedField <string> phrases         = sample.phrases;
            AudioProcessing        audioProcessing = new AudioProcessing();

            string googleCloudBucketName = "govmeeting-transcribe";

            TranscribeParameters transParams = new TranscribeParameters
            {
                audiofilePath              = audio,
                objectName                 = objectName,
                GoogleCloudBucketName      = googleCloudBucketName,
                useAudioFileAlreadyInCloud = useAudioFileAlreadyInCloud,
                language        = "en",
                MinSpeakerCount = 2,
                MaxSpeakerCount = 6,
                phrases         = phrases
            };

            // Clean up from last run
            File.Delete(audio);
            File.Delete(fixedTags);

            if (useSmallSample)
            {
                string shortVideoFile = videofilePath.Replace(".mp4", "-3min.mp4");
                //SplitRecording splitRecording = new SplitRecording();
                audioProcessing.ExtractPart(videofilePath, shortVideoFile, 60, 3 * 60);
                videofilePath = shortVideoFile;
            }

            audioProcessing.Extract(videofilePath, audio);

            GMFileAccess.SetGoogleCredentialsEnvironmentVariable();

            // Transcribe the audio file
            TranscribeAudio transcribe     = new TranscribeAudio();
            Transcribed_Dto response       = transcribe.TranscribeAudioFile(transParams, rawTranscription);
            string          responseString = JsonConvert.SerializeObject(response, Formatting.Indented);

            File.WriteAllText(fixedTags, responseString);

            WriteCopyOfResponse(responseString, fixedTags);
        }
Exemple #3
0
        public static void Main(string[] args)
        {
            // create service collection
            var services = new ServiceCollection();

            ConfigureServices(services);

            // create service provider
            var serviceProvider = services.BuildServiceProvider();


            GMFileAccess.SetGoogleCredentialsEnvironmentVariable();

            serviceProvider.GetService <TranslateDocs>().Run(args);
        }