Example #1
0
 public static void PrintSentences(SentenceSegmenter segmenter, IEnumerable<string> paragraphs)
 {
     foreach (var paragraph in paragraphs)
     {
         PrintSentences(segmenter, paragraph);
     }
 }
Example #2
0
        public static DetailedEvaluation Evaluate(this SentenceSegmenter segmenter, string taggedParagraph,
                                                  string tag = "#")
        {
            IEnumerable <int> realIndices       = GetBoundaryIndices(taggedParagraph, tag);
            string            untaggedParagraph = taggedParagraph.Replace(tag, "");

            return(Evaluate(segmenter, untaggedParagraph, realIndices));
        }
Example #3
0
        public static IEnumerable <DetailedEvaluation> Evaluate(this SentenceSegmenter segmenter,
                                                                IEnumerable <string> taggedParagraphs,
                                                                string tag = "#")
        {
            var evaluations = new List <DetailedEvaluation>();

            foreach (string taggedParagraph in taggedParagraphs)
            {
                evaluations.Add(Evaluate(segmenter, taggedParagraph));
            }
            return(evaluations);
        }
Example #4
0
        public static DetailedEvaluation Evaluate(this SentenceSegmenter segmenter, string paragraph,
                                                  IEnumerable <int> realBoundaryIndices)
        {
            IEnumerable <int> predictedIndices = segmenter.GetBoundaryIndices(paragraph);

            // ReSharper disable PossibleMultipleEnumeration
            IEnumerable <int> misses      = realBoundaryIndices.Except(predictedIndices);
            IEnumerable <int> falseAlarms = predictedIndices.Except(realBoundaryIndices);
            IEnumerable <int> hits        = realBoundaryIndices.Intersect(predictedIndices);
            // ReSharper restore PossibleMultipleEnumeration

            int eosCandidateCount = GetEosCharCount(segmenter.EosCandidates, paragraph);

            return(new DetailedEvaluation(hits, misses, falseAlarms, eosCandidateCount, paragraph));
        }
Example #5
0
 public static void PrintSentences(SentenceSegmenter segmenter, string paragraph)
 {
     var sentences = segmenter.GetSentences(paragraph);
     foreach (var sentence in sentences)
     {
         Console.WriteLine(sentence);
     }
 }
Example #6
0
 public static void EvaluateSbd(SentenceSegmenter segmenter)
 {
     var taggedParagraphs = File.ReadAllLines(TaggedInput);
     var evaluations = segmenter.Evaluate(taggedParagraphs);
     SentenceSegmenterEvaluator.GetTotalReport(evaluations, printFalseAlarms: true);
 }
Example #7
0
 public SentenceIterator(SentenceSegmenter segmenter, string paragraph)
 {
     _paragraph = paragraph;
     _segmenter = segmenter;
 }