/// <summary>
        /// Execute
        /// </summary>
        /// <param name="context">WF context</param>
        /// <returns></returns>
        protected override void Execute(NativeActivityContext context)
        {
            // Obtain the runtime value of the Text input argument
            var localEpisode = context.GetValue(this.LocalEpisode);

            // TODO : Code this activity
            var setSentence = context.GetExtension <INotifySetSentenceTimeline>();

            setSentence.NotifySyncDocument(localEpisode.SyncDocumentFilePath);

            if (File.Exists(localEpisode.SubtitleFilePath) == true)
            {
                var transcript     = localEpisode.Lrc.Transcript;
                var sentenceArray  = NlpUtilities.DetectSentences(transcript);
                var newLrcFilePath = localEpisode.SubtitleFilePath + ".sentences";

                var newLrc = localEpisode.Lrc.ToSentenceLyrics(sentenceArray);
                newLrc.Save(newLrcFilePath);

                setSentence.NotifyLyrics(newLrcFilePath);
            }
            else if (File.Exists(localEpisode.DictationDocumentFilePath) == true)
            {
                setSentence.NotifyDictation(localEpisode.DictationDocumentFilePath);
            }
        }
Exemple #2
0
        /// <summary>
        /// Execute
        /// </summary>
        /// <param name="context">WF context</param>
        /// <returns></returns>
        protected override void Execute(NativeActivityContext context)
        {
            // Obtain the runtime value of the Text input argument
            var transcript = context.GetValue(this.Transcript);

            // TODO : Code this activity
            var sentenceArray = NlpUtilities.DetectSentences(transcript);

            Console.WriteLine("Split 2 Sentences:" + sentenceArray.Length.ToString());

            // Return value
            this.Result.Set(context, sentenceArray.ToList());
        }
Exemple #3
0
        public bool AutoSetTimeLine(Lyrics lrc)
        {
            bool result = false;

            var lrcTranscript = lrc.Transcript;

            var textArray     = NlpUtilities.DetectSentences(lrcTranscript);
            var sentenceArray = this.Sentences.ToArray();

            if (textArray.Length == sentenceArray.Length)
            {
                result = true;
                var sentenceLyrics = lrc.ToSentenceLyrics(textArray);

                for (int i = 0; i < sentenceArray.Length; i++)
                {
                    sentenceArray[i].BeginTime = sentenceLyrics.Phrases[i].BeginTime;
                    sentenceArray[i].EndTime   = sentenceLyrics.Phrases[i].EndTime;
                }
            }

            return(result);
        }
        /// <summary>
        /// Execute
        /// </summary>
        /// <param name="context">WF context</param>
        /// <returns></returns>
        protected override void Execute(NativeActivityContext context)
        {
            // Obtain the runtime value of the Text input argument
            var content = context.GetValue(this.EpisodeContent);

            // TODO : Code this activity
            var notifyParaSplited = context.GetExtension <INotifyParagraphSplited>();

            var pIndex = 0;

            foreach (var para in content.Paragraphs)
            {
                var sentences = NlpUtilities.DetectSentences(para);
                try
                {
                    notifyParaSplited.NotifyParagraphSplited(new SplitedParagraph(para, sentences));
                }
                catch (Exception ex)
                {
                    throw new Exception("Error in SplitEpisodeActivity : notifyParaSplited.NotifyParagraphSplited", ex);
                }
                pIndex += 1;
            }
        }