This is an automated email from the ASF dual-hosted git repository.
jzemerick pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opennlp.git
The following commit(s) were added to refs/heads/main by this push:
new 8a942d3f OPENNLP-1481: Adding delta for DL test assertions. (#521)
8a942d3f is described below
commit 8a942d3f9c50a14f7f51962e74a9756b750909b0
Author: Jeff Zemerick <[email protected]>
AuthorDate: Wed Mar 15 15:56:15 2023 -0400
OPENNLP-1481: Adding delta for DL test assertions. (#521)
---
.../opennlp/dl/doccat/DocumentCategorizerDLEval.java | 16 ++++++++--------
.../java/opennlp/dl/namefinder/NameFinderDLEval.java | 2 +-
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git
a/opennlp-dl/src/test/java/opennlp/dl/doccat/DocumentCategorizerDLEval.java
b/opennlp-dl/src/test/java/opennlp/dl/doccat/DocumentCategorizerDLEval.java
index c0d3b221..297d42b3 100644
--- a/opennlp-dl/src/test/java/opennlp/dl/doccat/DocumentCategorizerDLEval.java
+++ b/opennlp-dl/src/test/java/opennlp/dl/doccat/DocumentCategorizerDLEval.java
@@ -83,7 +83,7 @@ public class DocumentCategorizerDLEval extends AbstactDLTest {
logger.debug("Actual: {}", Arrays.toString(sortedResult));
logger.debug("Expected: {}", Arrays.toString(expected));
- Assertions.assertArrayEquals(expected, sortedResult, 0.0);
+ Assertions.assertArrayEquals(expected, sortedResult, 0.000001);
Assertions.assertEquals(5, result.length);
final String category = documentCategorizerDL.getBestCategory(result);
@@ -119,7 +119,7 @@ public class DocumentCategorizerDLEval extends
AbstactDLTest {
0.3003573715686798,
0.6352779865264893};
- Assertions.assertArrayEquals(expected, result, 0.0);
+ Assertions.assertArrayEquals(expected, result, 0.000001);
Assertions.assertEquals(5, result.length);
final String category = documentCategorizerDL.getBestCategory(result);
@@ -151,7 +151,7 @@ public class DocumentCategorizerDLEval extends
AbstactDLTest {
final double[] expected = new double[]{0.8851314783096313,
0.11486853659152985};
- Assertions.assertArrayEquals(expected, result, 0.0);
+ Assertions.assertArrayEquals(expected, result, 0.000001);
Assertions.assertEquals(2, result.length);
final String category = documentCategorizerDL.getBestCategory(result);
@@ -174,11 +174,11 @@ public class DocumentCategorizerDLEval extends
AbstactDLTest {
final Map<String, Double> result = documentCategorizerDL.scoreMap(new
String[]{"I am happy"});
- Assertions.assertEquals(0.6352779865264893, result.get("very
good").doubleValue(), 0);
- Assertions.assertEquals(0.3003573715686798,
result.get("good").doubleValue(), 0);
- Assertions.assertEquals(0.04995147883892059,
result.get("neutral").doubleValue(), 0);
- Assertions.assertEquals(0.006593209225684404,
result.get("bad").doubleValue(), 0);
- Assertions.assertEquals(0.007819971069693565, result.get("very
bad").doubleValue(), 0);
+ Assertions.assertEquals(0.6352779865264893, result.get("very
good").doubleValue(), 0.000001);
+ Assertions.assertEquals(0.3003573715686798,
result.get("good").doubleValue(), 0.000001);
+ Assertions.assertEquals(0.04995147883892059,
result.get("neutral").doubleValue(), 0.000001);
+ Assertions.assertEquals(0.006593209225684404,
result.get("bad").doubleValue(), 0.000001);
+ Assertions.assertEquals(0.007819971069693565, result.get("very
bad").doubleValue(), 0.000001);
}
diff --git
a/opennlp-dl/src/test/java/opennlp/dl/namefinder/NameFinderDLEval.java
b/opennlp-dl/src/test/java/opennlp/dl/namefinder/NameFinderDLEval.java
index 36fd0fe7..af8b88ee 100644
--- a/opennlp-dl/src/test/java/opennlp/dl/namefinder/NameFinderDLEval.java
+++ b/opennlp-dl/src/test/java/opennlp/dl/namefinder/NameFinderDLEval.java
@@ -64,7 +64,7 @@ public class NameFinderDLEval extends AbstactDLTest {
Assertions.assertEquals(1, spans.length);
Assertions.assertEquals(0, spans[0].getStart());
Assertions.assertEquals(17, spans[0].getEnd());
- Assertions.assertEquals(8.251646041870117, spans[0].getProb(), 0.0);
+ Assertions.assertEquals(8.251646041870117, spans[0].getProb(), 0.000001);
Assertions.assertEquals("George Washington",
spans[0].getCoveredText(String.join(" ", tokens)));
}