This is an automated email from the ASF dual-hosted git repository.
jzemerick pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/opennlp.git
The following commit(s) were added to refs/heads/master by this push:
new ecc8a1ec OPENNLP-1307 Incorrect code example for Document
Categorization (9.3) (#450)
ecc8a1ec is described below
commit ecc8a1ec8e21cf0f6131fdbb4049130a15cb386d
Author: Martin Wiesner <[email protected]>
AuthorDate: Sat Dec 10 15:20:05 2022 +0100
OPENNLP-1307 Incorrect code example for Document Categorization (9.3) (#450)
- fixes `doccat.xml` as proposed in OPENNLP-1307; the current example in
the DOC was inconsistent with `DocumentCategorizerME#categorize(..)` and
required a change
---
opennlp-docs/src/docbkx/doccat.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/opennlp-docs/src/docbkx/doccat.xml
b/opennlp-docs/src/docbkx/doccat.xml
index 61076041..33ac04a2 100644
--- a/opennlp-docs/src/docbkx/doccat.xml
+++ b/opennlp-docs/src/docbkx/doccat.xml
@@ -82,8 +82,9 @@ DoccatModel m = new DoccatModel(is);]]>
<programlisting language="java">
<![CDATA[
String inputText = ...
+String[] textTokens = inputText.split(" "); // split by whitespace
DocumentCategorizerME myCategorizer = new DocumentCategorizerME(m);
-double[] outcomes = myCategorizer.categorize(inputText);
+double[] outcomes = myCategorizer.categorize(textTokens);
String category = myCategorizer.getBestCategory(outcomes);]]>
</programlisting>
</para>