Codota Logo
LemmatizerEvaluator
Code IndexAdd Codota to your IDE (free)

How to use
LemmatizerEvaluator
in
opennlp.tools.lemmatizer

Best Java code snippets using opennlp.tools.lemmatizer.LemmatizerEvaluator (Showing top 5 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: apache/opennlp

LemmatizerEvaluator evaluator = new LemmatizerEvaluator(
  new opennlp.tools.lemmatizer.LemmatizerME(model),
  missclassifiedListener, reportListener);
 evaluator.evaluate(sampleStream);
} catch (IOException e) {
 System.err.println("failed");
System.out.println("Accuracy: " + evaluator.getWordAccuracy());
origin: apache/opennlp

/**
 * Checks the evaluator results against the results got using the conlleval,
 * available at http://www.cnts.ua.ac.be/conll2000/chunking/output.html but
 * containing lemmas instead of chunks.
 *
 * @throws IOException
 */
@Test
public void testEvaluator() throws IOException {
 String inPredicted = "opennlp/tools/lemmatizer/output.txt";
 String inExpected = "opennlp/tools/lemmatizer/output.txt";
 String encoding = "UTF-8";
 DummyLemmaSampleStream predictedSample = new DummyLemmaSampleStream(
   new PlainTextByLineStream(
    new MockInputStreamFactory(new File(inPredicted)), encoding), true);
 DummyLemmaSampleStream expectedSample = new DummyLemmaSampleStream(
   new PlainTextByLineStream(
    new MockInputStreamFactory(new File(inExpected)), encoding), false);
 Lemmatizer dummyLemmatizer = new DummyLemmatizer(predictedSample);
 OutputStream stream = new ByteArrayOutputStream();
 LemmatizerEvaluationMonitor listener = new LemmaEvaluationErrorListener(stream);
 LemmatizerEvaluator evaluator = new LemmatizerEvaluator(dummyLemmatizer, listener);
 evaluator.evaluate(expectedSample);
 Assert.assertEquals(0.9877049180327869, evaluator.getWordAccuracy(), DELTA);
 Assert.assertNotSame(stream.toString().length(), 0);
}
origin: apache/opennlp

private double trainAndEval(String lang, File trainFile, TrainingParameters params,
                  File evalFile) throws IOException {
 ConlluTagset tagset = ConlluTagset.X;
 ObjectStream<LemmaSample> trainSamples = new ConlluLemmaSampleStream(new ConlluStream(
   new MarkableFileInputStreamFactory(trainFile)), tagset);
 LemmatizerModel model = LemmatizerME.train(lang, trainSamples, params, new LemmatizerFactory());
 LemmatizerEvaluator evaluator = new LemmatizerEvaluator(new LemmatizerME(model));
 evaluator.evaluate(new ConlluLemmaSampleStream(new ConlluStream(
   new MarkableFileInputStreamFactory(evalFile)), tagset));
 return evaluator.getWordAccuracy();
}
origin: ai.idylnlp/idylnlp-opennlp-tools-1.8.3

LemmatizerEvaluator evaluator = new LemmatizerEvaluator(
  new opennlp.tools.lemmatizer.LemmatizerME(model),
  missclassifiedListener, reportListener);
 evaluator.evaluate(sampleStream);
} catch (IOException e) {
 System.err.println("failed");
System.out.println("Accuracy: " + evaluator.getWordAccuracy());
origin: org.apache.opennlp/opennlp-tools

LemmatizerEvaluator evaluator = new LemmatizerEvaluator(
  new opennlp.tools.lemmatizer.LemmatizerME(model),
  missclassifiedListener, reportListener);
 evaluator.evaluate(sampleStream);
} catch (IOException e) {
 System.err.println("failed");
System.out.println("Accuracy: " + evaluator.getWordAccuracy());
opennlp.tools.lemmatizerLemmatizerEvaluator

Javadoc

The LemmatizerEvaluator measures the performance of the given Lemmatizer with the provided reference LemmaSamples.

Most used methods

  • <init>
    Initializes the current instance.
  • evaluate
  • getWordAccuracy
    Retrieves the word accuracy. This is defined as: word accuracy = correctly detected tags / total wor

Popular in Java

  • Making http post requests using okhttp
  • compareTo (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • addToBackStack (FragmentTransaction)
  • FileInputStream (java.io)
    A FileInputStream obtains input bytes from a file in a file system. What files are available depends
  • FileWriter (java.io)
    Convenience class for writing character files. The constructors of this class assume that the defaul
  • String (java.lang)
  • Hashtable (java.util)
    Hashtable is a synchronized implementation of Map. All optional operations are supported.Neither key
  • Iterator (java.util)
    An iterator over a collection. Iterator takes the place of Enumeration in the Java Collections Frame
  • Vector (java.util)
    The Vector class implements a growable array of objects. Like an array, it contains components that
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now