示例#1
0
        public IList <HighlightDetail> ProcessExtraAndShortChars(AccuracyMeasurement measurement)
        {
            var details = new List <HighlightDetail>();

            //are we working with extra or short chars
            bool isExtraChars = (measurement.NumExtraChars > 0);

            int delta = (isExtraChars) ?
                        measurement.NumExtraChars
                : measurement.NumShortChars;

            int indexStart = measurement.LengthMeasured - delta + measurement.IndexInLargerText;
            int indexEnd   = indexStart + delta;

            details.Add(new HighlightDetail()
            {
                HighlightType = (isExtraChars) ?
                                HighlightType.ExtraChars
                    : HighlightType.ShortChars,
                IndexStart = indexStart,
                IndexEnd   = indexEnd
            });

            return(details);
        }
示例#2
0
        public IList <HighlightDetail> ProcessIncorrectChars(AccuracyMeasurement measurement)
        {
            var details = new List <HighlightDetail>();

            foreach (var incorrectChar in measurement.IncorrectChars)
            {
                int indexStart = incorrectChar.Index + measurement.IndexInLargerText;
                details.Add(new HighlightDetail()
                {
                    HighlightType = HighlightType.IncorrectChar,
                    IndexStart    = indexStart,
                    IndexEnd      = indexStart + 1
                });
            }
            return(details);
        }