コード例 #1
0
ファイル: ChunkerEvaluatorTest.cs プロジェクト: qooba/SharpNL
        public void TestEvaluatorNoError()
        {
            using (
                var predictedSample =
                    new DummyChunkSampleStream(
                        new PlainTextByLineStream(Tests.OpenFile("opennlp/tools/chunker/output.txt")), true))
                using (
                    var expectedSample =
                        new DummyChunkSampleStream(
                            new PlainTextByLineStream(Tests.OpenFile("opennlp/tools/chunker/output.txt")), true)) {
                    var dummyChunker = new DummyChunker(predictedSample);

                    var evaluator = new ChunkerEvaluator(dummyChunker);

                    evaluator.Evaluate(expectedSample);

                    Assert.AreEqual(1d, evaluator.FMeasure.PrecisionScore, DELTA);
                    Assert.AreEqual(1d, evaluator.FMeasure.RecallScore, DELTA);
                }
        }
コード例 #2
0
ファイル: ChunkerEvaluatorTest.cs プロジェクト: qooba/SharpNL
        public void TestEvaluator()
        {
            using (
                var predictedSample =
                    new DummyChunkSampleStream(
                        new PlainTextByLineStream(Tests.OpenFile("opennlp/tools/chunker/output.txt")), true))
                using (
                    var expectedSample =
                        new DummyChunkSampleStream(
                            new PlainTextByLineStream(Tests.OpenFile("opennlp/tools/chunker/output.txt")), false)) {
                    var dummyChunker = new DummyChunker(predictedSample);

                    //var stream = new ByteArrayOutputStream();
                    //ChunkerEvaluationMonitor listener = new ChunkEvaluationErrorListener(stream);
                    var evaluator = new ChunkerEvaluator(dummyChunker);

                    evaluator.Evaluate(expectedSample);

                    Assert.AreEqual(0.8d, evaluator.FMeasure.PrecisionScore, DELTA);
                    Assert.AreEqual(0.875d, evaluator.FMeasure.RecallScore, DELTA);

                    //assertNotSame(stream.toString().length(), 0);
                }
        }
コード例 #3
0
ファイル: DummyChunker.cs プロジェクト: qooba/SharpNL
 public DummyChunker(DummyChunkSampleStream aSampleStream)
 {
     mSampleStream = aSampleStream;
 }