Пример #1
0
        /// ------------------------------------------------------------------------------------
        public bool GetIsAdequatelyAnnotated(OralAnnotationType type)
        {
            var timeTier = GetTimeTier();

            if (timeTier == null)
            {
                return(false);
            }

            bool fullySegmented = timeTier.IsFullySegmented;

            // If not fully segmented, you must have more than 1 segment per minute and be
            // segmented to within the final 10 seconds of the recording.
            if (!fullySegmented &&
                (timeTier.Segments.Count <= timeTier.TotalTime.TotalSeconds / 60 ||
                 timeTier.EndOfLastSegment.TotalSeconds + 10 < timeTier.TotalTime.TotalSeconds))
            {
                return(false);
            }

            // If fully segmented and last segment isn't annotated, that's okay (as long as
            // there is more than 1 segment)
            int requiredAnnotations = timeTier.Segments.Count;

            if (fullySegmented && requiredAnnotations > 1)
            {
                requiredAnnotations--;
            }
            return(GetCountOfContiguousAnnotatedSegments(type) >= requiredAnnotations);
        }
Пример #2
0
        /// ------------------------------------------------------------------------------------
        public bool GetHasOralAnnotation(OralAnnotationType type)
        {
            var pathToOralAnnotation = (type == OralAnnotationType.CarefulSpeech ?
                                        GetFullPathToCarefulSpeechFile() : GetFullPathToOralTranslationFile());

            return(pathToOralAnnotation != null && File.Exists(pathToOralAnnotation));
        }
Пример #3
0
        /// ------------------------------------------------------------------------------------
        public bool GetIsFullyAnnotated(OralAnnotationType type)
        {
            var timeTier = GetTimeTier();

            if (timeTier == null || !timeTier.IsFullySegmented)
            {
                return(false);
            }

            return(GetCountOfContiguousAnnotatedSegments(type) == timeTier.Segments.Count);
        }
Пример #4
0
        /// ------------------------------------------------------------------------------------
        private int GetCountOfContiguousAnnotatedSegments(OralAnnotationType type)
        {
            var timeTier          = GetTimeTier();
            var transcriptionTier = GetTranscriptionTier();
            AnnotationSegment transcriptionSegment;
            Func <AnnotationSegment, string> getPathToAnnotationFile = (type == OralAnnotationType.CarefulSpeech) ?
                                                                       timeTier.GetFullPathToCarefulSpeechFile :
                                                                       (Func <AnnotationSegment, string>)timeTier.GetFullPathToOralTranslationFile;

            int iSegment = 0;

            while (iSegment < timeTier.Segments.Count && ((transcriptionTier != null &&
                                                           transcriptionTier.TryGetSegment(iSegment, out transcriptionSegment) &&
                                                           SegmentIsIgnored(transcriptionSegment)) ||
                                                          File.Exists(getPathToAnnotationFile(timeTier.Segments[iSegment]))))
            {
                iSegment++;
            }

            return(iSegment);
        }
Пример #5
0
 /// ------------------------------------------------------------------------------------
 public TimeSpan GetTotalAnnotatedTime(OralAnnotationType type)
 {
     return(TimeSpan.FromSeconds(Segments.Where(segment =>
                                                segment.GetHasOralAnnotation(type)).Sum(segment => segment.GetLength())));
 }