예제 #1
0
        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
        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);
                }
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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);
                }
        }