Package opennlp.tools.util.eval

Examples of opennlp.tools.util.eval.FMeasure


    ChunkerEvaluationMonitor listener = new ChunkEvaluationErrorListener(stream);
    ChunkerEvaluator evaluator = new ChunkerEvaluator(dummyChunker, listener);

    evaluator.evaluate(expectedSample);

    FMeasure fm = evaluator.getFMeasure();

    assertEquals(0.8d, fm.getPrecisionScore(), DELTA);
    assertEquals(0.875d, fm.getRecallScore(), DELTA);

    assertNotSame(stream.toString().length(), 0);

  }
View Full Code Here


        stream);
    ChunkerEvaluator evaluator = new ChunkerEvaluator(dummyChunker, listener);

    evaluator.evaluate(expectedSample);

    FMeasure fm = evaluator.getFMeasure();

    assertEquals(1d, fm.getPrecisionScore(), DELTA);
    assertEquals(1d, fm.getRecallScore(), DELTA);

    assertEquals(stream.toString().length(), 0);

  }
View Full Code Here

    Span[] goldConsts = getConstituencySpans(Parse.parseParse(goldParseString));

    String testParseString = "(TOP (S (NP (NNS Sales) (NNS executives)) (VP (VBD were) (VP (VBG examing) (NP (DT the) (NNS figures)) (PP (IN with) (NP (JJ great) (NN care) (NN yesterday))) ))  (. .) ))";
    Span[] testConsts = getConstituencySpans(Parse.parseParse(testParseString));

    FMeasure measure = new FMeasure();
    measure.updateScores(goldConsts, testConsts);

    // Expected output:
    // Precision: 0.42857142857142855
    // Recall: 0.375
    // F-Measure: 0.39999999999999997

    System.out.println(measure.toString());
  }
View Full Code Here

          if (preds[i].equals(tag)) {
            prediction.add(new Span(i, i + 1));
          }
        }
        if (!this.tagFMeasure.containsKey(tag)) {
          this.tagFMeasure.put(tag, new FMeasure());
        }
        // populate the fmeasure
        this.tagFMeasure.get(tag).updateScores(
            reference.toArray(new Span[reference.size()]),
            prediction.toArray(new Span[prediction.size()]));
View Full Code Here

          if (preds[i].equals(tag)) {
            prediction.add(new Span(i, i + 1));
          }
        }
        if (!this.tagFMeasure.containsKey(tag)) {
          this.tagFMeasure.put(tag, new FMeasure());
        }
        // populate the fmeasure
        this.tagFMeasure.get(tag).updateScores(
            reference.toArray(new Span[reference.size()]),
            prediction.toArray(new Span[prediction.size()]));
View Full Code Here

      } catch (IOException e) {
        // sorry that this can fail
      }
    }

    FMeasure result = validator.getFMeasure();

    System.out.println(result.toString());
  }
View Full Code Here

      } catch (IOException e) {
        // sorry that this can fail
      }
    }

    FMeasure result = validator.getFMeasure();

    System.out.println(result.toString());
  }
View Full Code Here

        // sorry that this can fail
      }
    }

    if (detailedFMeasureListener == null) {
      FMeasure result = validator.getFMeasure();
      System.out.println(result.toString());
    } else {
      System.out.println(detailedFMeasureListener.toString());
    }
  }
View Full Code Here

        nameFinder, new NameEvaluationErrorListener());
    ObjectStream<NameSample> sample = createSample();

    evaluator.evaluate(sample);
    sample.close();
    FMeasure fmeasure = evaluator.getFMeasure();

    assertTrue(fmeasure.getFMeasure() == 1);
    assertTrue(fmeasure.getRecallScore() == 1);
  }
View Full Code Here

      } catch (IOException e) {
        // sorry that this can fail
      }
    }
   
    FMeasure result = validator.getFMeasure();
   
    System.out.println(result.toString());
  }
View Full Code Here

TOP

Related Classes of opennlp.tools.util.eval.FMeasure

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.