コード例 #1
0
ファイル: Program.cs プロジェクト: drupaltr/nuve
 public static void PrintSentences(SentenceSegmenter segmenter, IEnumerable<string> paragraphs)
 {
     foreach (var paragraph in paragraphs)
     {
         PrintSentences(segmenter, paragraph);
     }
 }
コード例 #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));
        }
コード例 #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);
        }
コード例 #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));
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: drupaltr/nuve
 public static void PrintSentences(SentenceSegmenter segmenter, string paragraph)
 {
     var sentences = segmenter.GetSentences(paragraph);
     foreach (var sentence in sentences)
     {
         Console.WriteLine(sentence);
     }
 }
コード例 #6
0
ファイル: Program.cs プロジェクト: drupaltr/nuve
 public static void EvaluateSbd(SentenceSegmenter segmenter)
 {
     var taggedParagraphs = File.ReadAllLines(TaggedInput);
     var evaluations = segmenter.Evaluate(taggedParagraphs);
     SentenceSegmenterEvaluator.GetTotalReport(evaluations, printFalseAlarms: true);
 }
コード例 #7
0
 public SentenceIterator(SentenceSegmenter segmenter, string paragraph)
 {
     _paragraph = paragraph;
     _segmenter = segmenter;
 }