This is an automated email from the ASF dual-hosted git repository.

mawiesne pushed a commit to branch 
OPENNLP-1727-Correct-example-snippet-for-loading-a-model-from-the-classpath
in repository https://gitbox.apache.org/repos/asf/opennlp.git

commit 5aa2977a84835e4755489b037b8f97af4d553e04
Author: Martin Wiesner <[email protected]>
AuthorDate: Wed Apr 23 20:37:02 2025 +0200

    OPENNLP-1727: Correct example snippet for loading a model from the classpath
---
 opennlp-docs/src/docbkx/model-loading.xml | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/opennlp-docs/src/docbkx/model-loading.xml 
b/opennlp-docs/src/docbkx/model-loading.xml
index 9ff3663a..aec161cd 100644
--- a/opennlp-docs/src/docbkx/model-loading.xml
+++ b/opennlp-docs/src/docbkx/model-loading.xml
@@ -78,7 +78,7 @@ under the License.
 
             <programlisting language="java">
                 <![CDATA[
-final ClassgraphModelFinder finder = new ClassgraphModelFinder(); // or use 
new SimpleClassPathModelFinder()
+final ClassgraphModelFinder finder = new ClassgraphModelFinder(); // or use: 
new SimpleClassPathModelFinder()
 final ClassPathModelLoader loader = new ClassPathModelLoader();
 final Set<ClassPathModelEntry> models = finder.findModels(false);
 for(ClassPathModelEntry entry : models) {
@@ -86,10 +86,10 @@ for(ClassPathModelEntry entry : models) {
    final ClassPathModel model = loader.load(entry);
 
    if(model != null) {
-                System.out.println(model.getModelName());
-                System.out.println(model.getModelSHA256());
-                System.out.println(model.getModelVersion());
-                System.out.println(model.getModeLanguage());
+      System.out.println(model.getModelName());
+      System.out.println(model.getModelSHA256());
+      System.out.println(model.getModelVersion());
+      System.out.println(model.getModelLanguage());
       // do something with the model by consuming the byte array
    }
 }]]>
@@ -120,12 +120,12 @@ model.language=${model.language}
             Make sure to replace the values accordingly and configure your 
build tool to include the binary model and the 
<emphasis>model.properties</emphasis>
             in the resulting JAR file.
 
-            To load such a custom model, you may need to adjust the pattern 
for classpath scanning. For example, if you name your model 
"custom-opennlp-model",
+            To load such a custom model, you may need to adjust the pattern 
for classpath scanning. For example, if you name the model 
"custom-opennlp-model",
             you need the following code to successfully find and load it:
 
             <programlisting language="java">
                 <![CDATA[
-final ClassgraphModelFinder finder = new 
ClassgraphModelFinder("custom-opennlp-model.jar"); // or use new 
SimpleClassPathModelFinder("custom-opennlp-model.jar")
+final ClassgraphModelFinder finder = new 
ClassgraphModelFinder("custom-opennlp-model.jar"); // or use: new 
SimpleClassPathModelFinder("custom-opennlp-model.jar")
 final ClassPathModelLoader loader = new ClassPathModelLoader();
 final Set<ClassPathModelEntry> models = finder.findModels(false);
 for(ClassPathModelEntry entry : models) {
@@ -133,10 +133,10 @@ for(ClassPathModelEntry entry : models) {
    final ClassPathModel model = loader.load(entry);
 
    if(model != null) {
-                System.out.println(model.getModelName());
-                System.out.println(model.getModelSHA256());
-                System.out.println(model.getModelVersion());
-                System.out.println(model.getModeLanguage());
+      System.out.println(model.getModelName());
+      System.out.println(model.getModelSHA256());
+      System.out.println(model.getModelVersion());
+      System.out.println(model.getModelLanguage());
       // do something with the model by consuming the byte array
    }
 }]]>

Reply via email to