segmentation_correspondences() public static method

public static segmentation_correspondences ( Narray outsegments, Intarray seg, Intarray cseg ) : void
outsegments Narray
seg Intarray
cseg Intarray
return void
Beispiel #1
0
        public override void SetSegmentationAndGt(Intarray segmentation, Intarray cseg, ref string text)
        {
            // first, set the segmentation as usual
            SetSegmentation(segmentation);

            // Maybe fix up the transcript (remove spaces).
            gttranscript = text;
            string s = text;

            fixup_transcript(ref s, false);
            int  max_cseg  = NarrayUtil.Max(cseg);
            bool old_csegs = (s.Length != max_cseg);

            fixup_transcript(ref gttranscript, old_csegs);

            // Complain if it doesn't match.
            if (gttranscript.Length != max_cseg)
            {
                Logger.Default.Format("transcript = '{0}'\n", gttranscript);
                throw new Exception(String.Format("transcript doesn't agree with cseg (transcript {0}, cseg {1})",
                                                  gttranscript.Length, max_cseg));
            }

            // Now compute the correspondences between the character segmentation
            // and the raw segmentation.
            GrouperRoutine.segmentation_correspondences(gtsegments, segmentation, cseg);
        }