You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by co...@apache.org on 2017/05/17 15:53:13 UTC
[47/50] opennlp git commit: OPENNLP-1059: Adjust
evalAllTypesWithPOSNameFinder for larger beam size
OPENNLP-1059: Adjust evalAllTypesWithPOSNameFinder for larger beam size
The 1.5.x pos models are loaded with a larger beam size to work with the parser
Project: http://git-wip-us.apache.org/repos/asf/opennlp/repo
Commit: http://git-wip-us.apache.org/repos/asf/opennlp/commit/1713b449
Tree: http://git-wip-us.apache.org/repos/asf/opennlp/tree/1713b449
Diff: http://git-wip-us.apache.org/repos/asf/opennlp/diff/1713b449
Branch: refs/heads/LangDetect
Commit: 1713b4497a8a2aee1c1272e3a95703914f96b716
Parents: a00624c
Author: Jörn Kottmann <jo...@apache.org>
Authored: Wed May 17 14:45:34 2017 +0200
Committer: Jörn Kottmann <jo...@apache.org>
Committed: Wed May 17 14:45:34 2017 +0200
----------------------------------------------------------------------
.../tools/eval/OntoNotes4NameFinderEval.java | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/opennlp/blob/1713b449/opennlp-tools/src/test/java/opennlp/tools/eval/OntoNotes4NameFinderEval.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/test/java/opennlp/tools/eval/OntoNotes4NameFinderEval.java b/opennlp-tools/src/test/java/opennlp/tools/eval/OntoNotes4NameFinderEval.java
index d9f5ecd..a001ce9 100644
--- a/opennlp-tools/src/test/java/opennlp/tools/eval/OntoNotes4NameFinderEval.java
+++ b/opennlp-tools/src/test/java/opennlp/tools/eval/OntoNotes4NameFinderEval.java
@@ -35,7 +35,6 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
-import opennlp.tools.cmdline.TerminateToolException;
import opennlp.tools.cmdline.namefind.TokenNameFinderTrainerTool;
import opennlp.tools.formats.DirectorySampleStream;
import opennlp.tools.formats.convert.FileToStringSampleStream;
@@ -123,7 +122,7 @@ public class OntoNotes4NameFinderEval {
}
@Test
- public void evalAllTypesWithPOSNameFinder() throws IOException {
+ public void evalAllTypesWithPOSNameFinder() throws IOException, URISyntaxException {
TrainingParameters params = ModelUtil.createDefaultTrainingParameters();
params.put("Threads", "4");
@@ -137,9 +136,6 @@ public class OntoNotes4NameFinderEval {
bytes.write(buf, 0, len);
}
}
- catch (IOException e) {
- throw new IllegalStateException("Failed reading from ner-default-features.xml file on classpath!");
- }
byte[] featureGen = bytes.toByteArray();
@@ -149,16 +145,8 @@ public class OntoNotes4NameFinderEval {
new File(resourcesPath.toFile(), "en-pos-perceptron.bin").toPath(),
StandardCopyOption.REPLACE_EXISTING);
- Map<String, Object> resources;
-
- try {
- resources = TokenNameFinderTrainerTool.loadResources(resourcesPath.toFile(),
+ Map<String, Object> resources = TokenNameFinderTrainerTool.loadResources(resourcesPath.toFile(),
Paths.get(this.getClass().getResource("ner-en_pos-features.xml").toURI()).toFile());
- }
- catch (IOException | URISyntaxException e) {
- throw new TerminateToolException(-1,"IO error while loading resources", e);
- }
-
try (ObjectStream<NameSample> samples = createNameSampleStream()) {
@@ -171,7 +159,7 @@ public class OntoNotes4NameFinderEval {
cv.evaluate(filteredSamples, 5);
- Assert.assertEquals(0.8044097625338349d, cv.getFMeasure().getFMeasure(), 0.001d);
+ Assert.assertEquals(0.8070226153653437d, cv.getFMeasure().getFMeasure(), 0.001d);
}
}
}