Skip to content

Apache Lucene open-source search software

upgrade to OpenNLP 2.3.2 (#12674)

Christine Poerschke563fafd8ac61
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index f4441340c1c..efadc8ba8e8 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -219,6 +219,8 @@ Improvements
Tests are running with random byte order to ensure that the order does not affect correctness
of code. Native order was enabled for LZ4 compression. (Uwe Schindler)
+* GITHUB#11657, LUCENE-10621: Upgrade to OpenNLP 2.3.2. (Christine Poerschke, Eric Pugh)
+
Optimizations
---------------------
diff --git a/lucene/MIGRATE.md b/lucene/MIGRATE.md
index 698548fdfd7..8a72c58b097 100644
--- a/lucene/MIGRATE.md
+++ b/lucene/MIGRATE.md
@@ -147,6 +147,12 @@ may throw `IOException` on index problems, bubbling up unexpectedly to the calle
`(Reverse)PathHierarchyTokenizer` now produces sequential (instead of overlapping) tokens with accurate
offsets, making positional queries and highlighters possible for fields tokenized with this tokenizer.
+## Migration from Lucene 9.9 to Lucene 9.10
+
+### OpenNLP dependency upgrade
+
+[Apache OpenNLP](https://opennlp.apache.org) 2.x opens the door to accessing various models via the ONNX runtime. To migrate you will need to update any deprecated OpenNLP methods that you may be using and be running on Java 17.
+
## Migration from Lucene 9.0 to Lucene 9.1
### Test framework package migration and module (LUCENE-10301)
diff --git a/lucene/analysis/opennlp/src/test/org/apache/lucene/analysis/opennlp/TestOpenNLPChunkerFilterFactory.java b/lucene/analysis/opennlp/src/test/org/apache/lucene/analysis/opennlp/TestOpenNLPChunkerFilterFactory.java
index 708f7bafc17..dc21abe1a7d 100644
--- a/lucene/analysis/opennlp/src/test/org/apache/lucene/analysis/opennlp/TestOpenNLPChunkerFilterFactory.java
+++ b/lucene/analysis/opennlp/src/test/org/apache/lucene/analysis/opennlp/TestOpenNLPChunkerFilterFactory.java
@@ -58,7 +58,7 @@ public class TestOpenNLPChunkerFilterFactory extends BaseTokenStreamTestCase {
8, 15, 17, 21, 23, 29, 30, 39, 46, 48, 49, 51, 57, 58
};
private static final String[] SENTENCES_chunks = {
- "B-NP", "I-NP", "I-NP", "B-VP", "B-NP", "I-NP", "O", "B-NP", "I-NP", "I-NP", "O", "B-NP",
+ "B-NP", "I-NP", "I-NP", "I-NP", "I-NP", "I-NP", "O", "B-NP", "I-NP", "I-NP", "O", "B-NP",
"I-NP", "O"
};
diff --git a/lucene/analysis/opennlp/src/tools/test-model-data/README.txt b/lucene/analysis/opennlp/src/tools/test-model-data/README.txt
index 3ac0aa39b06..2c4c0704ed6 100644
--- a/lucene/analysis/opennlp/src/tools/test-model-data/README.txt
+++ b/lucene/analysis/opennlp/src/tools/test-model-data/README.txt
@@ -3,4 +3,4 @@ Training data derived from Reuters corpus in very unscientific way.
Tagging done with CCG Urbana-Champaign online demos:
http://cogcomp.cs.illinois.edu/page/demos
-Run 'ant train-test-models' to generate models from training data here.
+When https://github.com/apache/lucene/issues/13002 is done, please run './gradlew ???' to generate models from training data here.
diff --git a/lucene/licenses/opennlp-tools-1.9.4.jar.sha1 b/lucene/licenses/opennlp-tools-1.9.4.jar.sha1
deleted file mode 100644
index fa7e85dd48f..00000000000
--- a/lucene/licenses/opennlp-tools-1.9.4.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-dd5c4a6d82453bcccb78ba4ac90f166366dde12b
diff --git a/lucene/licenses/opennlp-tools-2.3.2.jar.sha1 b/lucene/licenses/opennlp-tools-2.3.2.jar.sha1
new file mode 100644
index 00000000000..94b2924f8fa
--- /dev/null
+++ b/lucene/licenses/opennlp-tools-2.3.2.jar.sha1
@@ -0,0 +1 @@
+d739edba1e729691ed5ab80e1ccf330555a02ea7
diff --git a/lucene/licenses/opennlp-tools-NOTICE.txt b/lucene/licenses/opennlp-tools-NOTICE.txt
index fa391c448b0..5897a68a412 100644
--- a/lucene/licenses/opennlp-tools-NOTICE.txt
+++ b/lucene/licenses/opennlp-tools-NOTICE.txt
@@ -1,11 +1,101 @@
Apache OpenNLP
-Copyright 2017 The Apache Software Foundation
+Copyright 2021-2023 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
+============================================================================
+
The snowball stemmers in
opennlp-tools/src/main/java/opennlp/tools/stemmer/snowball
were developed by Martin Porter and Richard Boulton.
The full snowball package is available from
http://snowball.tartarus.org/
+
+============================================================================
+
+Wordpiece tokenizer
+https://github.com/robrua/easy-bert
+
+The MIT License (MIT)
+
+Copyright (c) 2019 Rob Rua
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+============================================================================
+
+ONNX Runtime
+
+MIT License
+
+Copyright (c) Microsoft Corporation
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+============================================================================
+
+SLF4J API
+https://github.com/qos-ch/slf4j
+
+MIT License
+
+Copyright (c) 2004-2022 QOS.ch Sarl (Switzerland)
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+============================================================================
+
+jackson-databind
+https://github.com/FasterXML/jackson-databind
+The Apache Software License, Version 2.0
diff --git a/lucene/licenses/slf4j-api-1.7.36.jar.sha1 b/lucene/licenses/slf4j-api-1.7.36.jar.sha1
new file mode 100644
index 00000000000..828b7cf7e05
--- /dev/null
+++ b/lucene/licenses/slf4j-api-1.7.36.jar.sha1
@@ -0,0 +1 @@
+6c62681a2f655b49963a5983b8b0950a6120ae14
diff --git a/lucene/licenses/slf4j-api-LICENSE-MIT.txt b/lucene/licenses/slf4j-api-LICENSE-MIT.txt
new file mode 100644
index 00000000000..1a3d053237b
--- /dev/null
+++ b/lucene/licenses/slf4j-api-LICENSE-MIT.txt
@@ -0,0 +1,24 @@
+Copyright (c) 2004-2022 QOS.ch Sarl (Switzerland)
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+
diff --git a/versions.lock b/versions.lock
index b532be08686..1f56d9593d4 100644
--- a/versions.lock
+++ b/versions.lock
@@ -10,7 +10,7 @@ net.sourceforge.nekohtml:nekohtml:1.9.17 (1 constraints: 4405503b)
org.antlr:antlr4-runtime:4.11.1 (1 constraints: 39053f3b)
org.apache.commons:commons-compress:1.19 (1 constraints: df04fa30)
org.apache.commons:commons-math3:3.6.1 (1 constraints: bf0adbcc)
-org.apache.opennlp:opennlp-tools:1.9.4 (1 constraints: 10050f36)
+org.apache.opennlp:opennlp-tools:2.3.2 (1 constraints: 09050036)
org.carrot2:morfologik-fsa:2.1.9 (1 constraints: db0d9c36)
org.carrot2:morfologik-polish:2.1.9 (1 constraints: 0e050136)
org.carrot2:morfologik-stemming:2.1.9 (2 constraints: 1312040d)
@@ -20,6 +20,7 @@ org.openjdk.jmh:jmh-core:1.37 (1 constraints: df04fc30)
org.ow2.asm:asm:9.6 (3 constraints: 3917ef6d)
org.ow2.asm:asm-commons:9.6 (1 constraints: b304382c)
org.ow2.asm:asm-tree:9.6 (1 constraints: ea09e3a5)
+org.slf4j:slf4j-api:1.7.36 (1 constraints: 6f0ed053)
ua.net.nlp:morfologik-ukrainian-search:4.9.1 (1 constraints: 10051b36)
xerces:xercesImpl:2.12.0 (1 constraints: 3705353b)
diff --git a/versions.props b/versions.props
index ed49d7065cf..b44026a166f 100644
--- a/versions.props
+++ b/versions.props
@@ -9,7 +9,7 @@ junit:junit=4.13.1
net.sourceforge.nekohtml:nekohtml=1.9.17
org.antlr:antlr4*=4.11.1
org.apache.commons:commons-compress=1.19
-org.apache.opennlp:opennlp-tools=1.9.4
+org.apache.opennlp:opennlp-tools=2.3.2
org.assertj:*=3.21.0
org.carrot2:morfologik-*=2.1.9
org.hamcrest:*=2.2