This is an automated email from the ASF dual-hosted git repository.
mawiesne 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 ccc42e42 OPENNLP-1818: Update zlibsvm-core to 3.0.0 (#1000)
ccc42e42 is described below
commit ccc42e421e04e3826d9aee8e10c49e9ad00f0149
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
AuthorDate: Tue Mar 31 13:16:24 2026 +0200
OPENNLP-1818: Update zlibsvm-core to 3.0.0 (#1000)
* Bump de.hs-heilbronn.mi:zlibsvm-core from 2.1.2 to 3.0.0
Bumps [de.hs-heilbronn.mi:zlibsvm-core](https://github.com/rzo1/zlibsvm)
from 2.1.2 to 3.0.0.
- [Release notes](https://github.com/rzo1/zlibsvm/releases)
-
[Commits](https://github.com/rzo1/zlibsvm/compare/zlibsvm-2.1.2...zlibsvm-3.0.0)
---
updated-dependencies:
- dependency-name: de.hs-heilbronn.mi:zlibsvm-core
dependency-version: 3.0.0
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <[email protected]>
* Fix 3.0.0 changes
---------
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot]
<49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Richard Zowalla <[email protected]>
---
.../tools/ml/libsvm/doccat/DocumentCategorizerSVM.java | 12 +++++++++---
pom.xml | 2 +-
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git
a/opennlp-core/opennlp-ml/opennlp-ml-libsvm/src/main/java/opennlp/tools/ml/libsvm/doccat/DocumentCategorizerSVM.java
b/opennlp-core/opennlp-ml/opennlp-ml-libsvm/src/main/java/opennlp/tools/ml/libsvm/doccat/DocumentCategorizerSVM.java
index 726ae5ce..c2a96e9c 100644
---
a/opennlp-core/opennlp-ml/opennlp-ml-libsvm/src/main/java/opennlp/tools/ml/libsvm/doccat/DocumentCategorizerSVM.java
+++
b/opennlp-core/opennlp-ml/opennlp-ml-libsvm/src/main/java/opennlp/tools/ml/libsvm/doccat/DocumentCategorizerSVM.java
@@ -27,6 +27,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import java.util.Optional;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
@@ -314,10 +315,15 @@ public class DocumentCategorizerSVM implements
DocumentCategorizer {
}
// --- Train SVM ---
- SvmTrainer trainer = new SvmTrainerImpl(config.getSvmConfiguration(),
"opennlp-doccat-svm");
- SvmModel svmModel = trainer.train(svmDocuments);
+ final SvmTrainer trainer = new
SvmTrainerImpl(config.getSvmConfiguration(), "opennlp-doccat-svm");
+ final Optional<SvmModel> svmModel = trainer.train(svmDocuments);
- return new SvmDoccatModel(svmModel, featureVocabulary, indexToCategory,
categoryToIndex,
+ final SvmModel trainedModel = svmModel.orElseThrow(() ->
+ new RuntimeException("Training with Cross-Validation=True "
+ + "does not result in a valid model."));
+
+ return new SvmDoccatModel(trainedModel, featureVocabulary,
+ indexToCategory, categoryToIndex,
idfValues, featureMin, featureMax, config, lang);
}
diff --git a/pom.xml b/pom.xml
index 2399d2cf..83cc9813 100644
--- a/pom.xml
+++ b/pom.xml
@@ -248,7 +248,7 @@
<log4j2.version>2.25.4</log4j2.version>
<logcaptor.version>2.12.6</logcaptor.version>
<classgraph.version>4.8.184</classgraph.version>
- <zlibsvm.version>2.1.2</zlibsvm.version>
+ <zlibsvm.version>3.0.0</zlibsvm.version>
<jmh.version>1.37</jmh.version>
<!-- Plugin versions -->