diff --git a/opennlp-api/pom.xml b/opennlp-api/pom.xml
new file mode 100644
index 000000000..ae9a91a7a
--- /dev/null
+++ b/opennlp-api/pom.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.opennlp
+ opennlp
+ 3.0.0-SNAPSHOT
+
+
+ opennlp-api
+ jar
+ Apache OpenNLP API
+
+
+
+
+ org.slf4j
+ slf4j-api
+
+
+
+
\ No newline at end of file
diff --git a/opennlp-tools/src/main/java/opennlp/tools/chunker/ChunkSample.java b/opennlp-api/src/main/java/opennlp/tools/chunker/ChunkSample.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/chunker/ChunkSample.java
rename to opennlp-api/src/main/java/opennlp/tools/chunker/ChunkSample.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/chunker/Chunker.java b/opennlp-api/src/main/java/opennlp/tools/chunker/Chunker.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/chunker/Chunker.java
rename to opennlp-api/src/main/java/opennlp/tools/chunker/Chunker.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/chunker/ChunkerContextGenerator.java b/opennlp-api/src/main/java/opennlp/tools/chunker/ChunkerContextGenerator.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/chunker/ChunkerContextGenerator.java
rename to opennlp-api/src/main/java/opennlp/tools/chunker/ChunkerContextGenerator.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/chunker/ChunkerEvaluationMonitor.java b/opennlp-api/src/main/java/opennlp/tools/chunker/ChunkerEvaluationMonitor.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/chunker/ChunkerEvaluationMonitor.java
rename to opennlp-api/src/main/java/opennlp/tools/chunker/ChunkerEvaluationMonitor.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/ArgumentParser.java b/opennlp-api/src/main/java/opennlp/tools/cmdline/ArgumentParser.java
similarity index 90%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/ArgumentParser.java
rename to opennlp-api/src/main/java/opennlp/tools/cmdline/ArgumentParser.java
index c7e25cc1b..e01bff53b 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/cmdline/ArgumentParser.java
+++ b/opennlp-api/src/main/java/opennlp/tools/cmdline/ArgumentParser.java
@@ -228,7 +228,7 @@ public static String createUsage(Class argProxyInterface) {
/**
* Auxiliary record that holds information about an argument. This is used by the
- * {@link GenerateManualTool}, which creates a Docbook for the CLI automatically.
+ * {@code GenerateManualTool}, which creates a Docbook for the CLI automatically.
*/
record Argument(String argument, String value, String description, boolean optional) {
@@ -331,10 +331,10 @@ public static String createUsage(Class>... argProxyInterfaces) {
}
}
- if (usage.length() > 0)
+ if (!usage.isEmpty())
usage.setLength(usage.length() - 1);
- if (details.length() > 0) {
+ if (!details.isEmpty()) {
details.setLength(details.length() - 1);
usage.append("\n\nArguments description:\n").append(details);
}
@@ -398,8 +398,8 @@ public static String validateArgumentsLoudly(String[] args, Class>... argProxy
for (Class> argProxyInterface : argProxyInterfaces) {
for (Method method : argProxyInterface.getMethods()) {
String paramName = methodNameToParameter(method.getName());
- int paramIndex = CmdLineUtil.getParameterIndex(paramName, args);
- String valueString = CmdLineUtil.getParameter(paramName, args);
+ int paramIndex = getParameterIndex(paramName, args);
+ String valueString = getParameter(paramName, args);
if (valueString == null) {
OptionalParameter optionalParam = method.getAnnotation(OptionalParameter.class);
@@ -456,7 +456,7 @@ public static T parse(String[] args, Class argProxyInterface) {
for (Method method : argProxyInterface.getMethods()) {
String parameterName = methodNameToParameter(method.getName());
- String valueString = CmdLineUtil.getParameter(parameterName, args);
+ String valueString = getParameter(parameterName, args);
if (valueString == null) {
OptionalParameter optionalParam = method.getAnnotation(OptionalParameter.class);
@@ -503,10 +503,10 @@ public static String[] filter(String[] args, Class argProxyInterface) {
for (Method method : argProxyInterface.getMethods()) {
String parameterName = methodNameToParameter(method.getName());
- int idx = CmdLineUtil.getParameterIndex(parameterName, args);
+ int idx = getParameterIndex(parameterName, args);
if (-1 < idx) {
parameters.add(parameterName);
- String valueString = CmdLineUtil.getParameter(parameterName, args);
+ String valueString = getParameter(parameterName, args);
if (null != valueString) {
parameters.add(valueString);
}
@@ -515,4 +515,61 @@ public static String[] filter(String[] args, Class argProxyInterface) {
return parameters.toArray(new String[0]);
}
+
+ /**
+ * Retrieves the specified parameter from the specified arguments.
+ *
+ * @param param parameter name
+ * @param args arguments
+ * @return parameter value
+ */
+ private static Integer getIntParameter(String param, String[] args) {
+ String value = getParameter(param, args);
+
+ try {
+ if (value != null)
+ return Integer.parseInt(value);
+ }
+ catch (NumberFormatException ignored) {
+ // in this case return null
+ }
+
+ return null;
+ }
+
+ /**
+ * Retrieves the specified parameter from the given arguments.
+ *
+ * @param param parameter name
+ * @param args arguments
+ * @return parameter value
+ */
+ private static String getParameter(String param, String[] args) {
+ int i = getParameterIndex(param, args);
+ if (-1 < i) {
+ i++;
+ if (i < args.length) {
+ return args[i];
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the index of the parameter in the arguments, or {@code -1} if the parameter is not found.
+ *
+ * @param param parameter name
+ * @param args arguments
+ * @return the index of the parameter in the arguments, or {@code -1} if the parameter is not found
+ */
+ private static int getParameterIndex(String param, String[] args) {
+ for (int i = 0; i < args.length; i++) {
+ if (args[i].startsWith("-") && args[i].equals(param)) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/ObjectStreamFactory.java b/opennlp-api/src/main/java/opennlp/tools/cmdline/ObjectStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/ObjectStreamFactory.java
rename to opennlp-api/src/main/java/opennlp/tools/cmdline/ObjectStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/TerminateToolException.java b/opennlp-api/src/main/java/opennlp/tools/cmdline/TerminateToolException.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/TerminateToolException.java
rename to opennlp-api/src/main/java/opennlp/tools/cmdline/TerminateToolException.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/params/BasicFormatParams.java b/opennlp-api/src/main/java/opennlp/tools/cmdline/params/BasicFormatParams.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/params/BasicFormatParams.java
rename to opennlp-api/src/main/java/opennlp/tools/cmdline/params/BasicFormatParams.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/params/BasicTrainingParams.java b/opennlp-api/src/main/java/opennlp/tools/cmdline/params/BasicTrainingParams.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/params/BasicTrainingParams.java
rename to opennlp-api/src/main/java/opennlp/tools/cmdline/params/BasicTrainingParams.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/params/CVParams.java b/opennlp-api/src/main/java/opennlp/tools/cmdline/params/CVParams.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/params/CVParams.java
rename to opennlp-api/src/main/java/opennlp/tools/cmdline/params/CVParams.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/params/DetokenizerParameter.java b/opennlp-api/src/main/java/opennlp/tools/cmdline/params/DetokenizerParameter.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/params/DetokenizerParameter.java
rename to opennlp-api/src/main/java/opennlp/tools/cmdline/params/DetokenizerParameter.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/params/EncodingParameter.java b/opennlp-api/src/main/java/opennlp/tools/cmdline/params/EncodingParameter.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/params/EncodingParameter.java
rename to opennlp-api/src/main/java/opennlp/tools/cmdline/params/EncodingParameter.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/params/EvaluatorParams.java b/opennlp-api/src/main/java/opennlp/tools/cmdline/params/EvaluatorParams.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/params/EvaluatorParams.java
rename to opennlp-api/src/main/java/opennlp/tools/cmdline/params/EvaluatorParams.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/params/FineGrainedEvaluatorParams.java b/opennlp-api/src/main/java/opennlp/tools/cmdline/params/FineGrainedEvaluatorParams.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/params/FineGrainedEvaluatorParams.java
rename to opennlp-api/src/main/java/opennlp/tools/cmdline/params/FineGrainedEvaluatorParams.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/params/LanguageParams.java b/opennlp-api/src/main/java/opennlp/tools/cmdline/params/LanguageParams.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/params/LanguageParams.java
rename to opennlp-api/src/main/java/opennlp/tools/cmdline/params/LanguageParams.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/params/TrainingToolParams.java b/opennlp-api/src/main/java/opennlp/tools/cmdline/params/TrainingToolParams.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/params/TrainingToolParams.java
rename to opennlp-api/src/main/java/opennlp/tools/cmdline/params/TrainingToolParams.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/commons/Internal.java b/opennlp-api/src/main/java/opennlp/tools/commons/Internal.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/commons/Internal.java
rename to opennlp-api/src/main/java/opennlp/tools/commons/Internal.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/commons/Sample.java b/opennlp-api/src/main/java/opennlp/tools/commons/Sample.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/commons/Sample.java
rename to opennlp-api/src/main/java/opennlp/tools/commons/Sample.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/commons/ThreadSafe.java b/opennlp-api/src/main/java/opennlp/tools/commons/ThreadSafe.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/commons/ThreadSafe.java
rename to opennlp-api/src/main/java/opennlp/tools/commons/ThreadSafe.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/commons/Trainer.java b/opennlp-api/src/main/java/opennlp/tools/commons/Trainer.java
similarity index 69%
rename from opennlp-tools/src/main/java/opennlp/tools/commons/Trainer.java
rename to opennlp-api/src/main/java/opennlp/tools/commons/Trainer.java
index ce8ed0224..f5d6faa89 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/commons/Trainer.java
+++ b/opennlp-api/src/main/java/opennlp/tools/commons/Trainer.java
@@ -19,31 +19,32 @@
import java.util.Map;
+import opennlp.tools.util.Parameters;
import opennlp.tools.util.TrainingConfiguration;
-import opennlp.tools.util.TrainingParameters;
/**
* Represents a common base for training implementations.
*/
-public interface Trainer {
+public interface Trainer
{
/**
* Conducts the initialization of an {@link Trainer} via
- * {@link TrainingParameters} and a {@link Map report map}.
+ * {@link Parameters} and a {@link Map report map}.
*
- * @param trainParams The {@link TrainingParameters} to use.
+ * @param trainParams The {@link Parameters} to use.
* @param reportMap The {@link Map} instance used as report map.
*/
- void init(TrainingParameters trainParams, Map reportMap);
+ void init(P trainParams, Map reportMap);
/**
* Conducts the initialization of a {@link Trainer} via
- * {@link TrainingParameters}, {@link Map report map} and {@link TrainingConfiguration}
+ * {@link Parameters}, {@link Map report map} and {@link TrainingConfiguration}
*
- * @param trainParams The {@link TrainingParameters} to use.
+ * @param trainParams The {@link Parameters} to use.
* @param reportMap The {@link Map} instance used as report map.
- * @param config The {@link TrainingConfiguration} to use. If null, suitable defaults will be used.
+ * @param config The {@link TrainingConfiguration} to use.
+ * If {@code null}, suitable defaults will be used.
*/
- void init(TrainingParameters trainParams, Map reportMap, TrainingConfiguration config);
+ void init(P trainParams, Map reportMap, TrainingConfiguration config);
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/doccat/DoccatEvaluationMonitor.java b/opennlp-api/src/main/java/opennlp/tools/doccat/DoccatEvaluationMonitor.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/doccat/DoccatEvaluationMonitor.java
rename to opennlp-api/src/main/java/opennlp/tools/doccat/DoccatEvaluationMonitor.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/doccat/DocumentCategorizer.java b/opennlp-api/src/main/java/opennlp/tools/doccat/DocumentCategorizer.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/doccat/DocumentCategorizer.java
rename to opennlp-api/src/main/java/opennlp/tools/doccat/DocumentCategorizer.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/doccat/DocumentSample.java b/opennlp-api/src/main/java/opennlp/tools/doccat/DocumentSample.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/doccat/DocumentSample.java
rename to opennlp-api/src/main/java/opennlp/tools/doccat/DocumentSample.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/doccat/FeatureGenerator.java b/opennlp-api/src/main/java/opennlp/tools/doccat/FeatureGenerator.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/doccat/FeatureGenerator.java
rename to opennlp-api/src/main/java/opennlp/tools/doccat/FeatureGenerator.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/entitylinker/BaseLink.java b/opennlp-api/src/main/java/opennlp/tools/entitylinker/BaseLink.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/entitylinker/BaseLink.java
rename to opennlp-api/src/main/java/opennlp/tools/entitylinker/BaseLink.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/entitylinker/EntityLinker.java b/opennlp-api/src/main/java/opennlp/tools/entitylinker/EntityLinker.java
similarity index 97%
rename from opennlp-tools/src/main/java/opennlp/tools/entitylinker/EntityLinker.java
rename to opennlp-api/src/main/java/opennlp/tools/entitylinker/EntityLinker.java
index 2430445a9..d4420c6ca 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/entitylinker/EntityLinker.java
+++ b/opennlp-api/src/main/java/opennlp/tools/entitylinker/EntityLinker.java
@@ -40,11 +40,11 @@ public interface EntityLinker {
/**
* Initializes an {@link EntityLinker} and allows for passing properties
- * through the {@link EntityLinkerFactory} into all impls dynamically.
+ * through an {@code EntityLinkerFactory} into all impls dynamically.
*
* {@link EntityLinker} impls should initialize reusable objects
* used by the impl in this method. If this is done, any errors will be
- * captured and thrown by the {@link EntityLinkerFactory}.
+ * captured and thrown by an {@code EntityLinkerFactory}.
*
* @param initializationData The {@link EntityLinkerProperties} that contains
* properties needed by the impl, as well as any
diff --git a/opennlp-tools/src/main/java/opennlp/tools/entitylinker/EntityLinkerProperties.java b/opennlp-api/src/main/java/opennlp/tools/entitylinker/EntityLinkerProperties.java
similarity index 98%
rename from opennlp-tools/src/main/java/opennlp/tools/entitylinker/EntityLinkerProperties.java
rename to opennlp-api/src/main/java/opennlp/tools/entitylinker/EntityLinkerProperties.java
index fab8c4b35..72fe116b1 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/entitylinker/EntityLinkerProperties.java
+++ b/opennlp-api/src/main/java/opennlp/tools/entitylinker/EntityLinkerProperties.java
@@ -26,8 +26,6 @@
/**
* Properties wrapper for {@link EntityLinker} implementations.
- *
- * @see EntityLinkerFactory
*/
public class EntityLinkerProperties {
diff --git a/opennlp-tools/src/main/java/opennlp/tools/entitylinker/LinkedSpan.java b/opennlp-api/src/main/java/opennlp/tools/entitylinker/LinkedSpan.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/entitylinker/LinkedSpan.java
rename to opennlp-api/src/main/java/opennlp/tools/entitylinker/LinkedSpan.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/langdetect/Language.java b/opennlp-api/src/main/java/opennlp/tools/langdetect/Language.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/langdetect/Language.java
rename to opennlp-api/src/main/java/opennlp/tools/langdetect/Language.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/langdetect/LanguageDetector.java b/opennlp-api/src/main/java/opennlp/tools/langdetect/LanguageDetector.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/langdetect/LanguageDetector.java
rename to opennlp-api/src/main/java/opennlp/tools/langdetect/LanguageDetector.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/langdetect/LanguageDetectorContextGenerator.java b/opennlp-api/src/main/java/opennlp/tools/langdetect/LanguageDetectorContextGenerator.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/langdetect/LanguageDetectorContextGenerator.java
rename to opennlp-api/src/main/java/opennlp/tools/langdetect/LanguageDetectorContextGenerator.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/langdetect/LanguageDetectorEvaluationMonitor.java b/opennlp-api/src/main/java/opennlp/tools/langdetect/LanguageDetectorEvaluationMonitor.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/langdetect/LanguageDetectorEvaluationMonitor.java
rename to opennlp-api/src/main/java/opennlp/tools/langdetect/LanguageDetectorEvaluationMonitor.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/langdetect/LanguageSample.java b/opennlp-api/src/main/java/opennlp/tools/langdetect/LanguageSample.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/langdetect/LanguageSample.java
rename to opennlp-api/src/main/java/opennlp/tools/langdetect/LanguageSample.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/languagemodel/LanguageModel.java b/opennlp-api/src/main/java/opennlp/tools/languagemodel/LanguageModel.java
similarity index 93%
rename from opennlp-tools/src/main/java/opennlp/tools/languagemodel/LanguageModel.java
rename to opennlp-api/src/main/java/opennlp/tools/languagemodel/LanguageModel.java
index 6453f627c..50eab9a61 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/languagemodel/LanguageModel.java
+++ b/opennlp-api/src/main/java/opennlp/tools/languagemodel/LanguageModel.java
@@ -19,7 +19,7 @@
/**
* A language model can calculate the probability p (between 0 and 1) of a
- * certain {@link opennlp.tools.util.StringList sequence of tokens}, given its underlying vocabulary.
+ * certain sequence of tokens, given its underlying vocabulary.
*/
public interface LanguageModel {
diff --git a/opennlp-tools/src/main/java/opennlp/tools/lemmatizer/LemmaSample.java b/opennlp-api/src/main/java/opennlp/tools/lemmatizer/LemmaSample.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/lemmatizer/LemmaSample.java
rename to opennlp-api/src/main/java/opennlp/tools/lemmatizer/LemmaSample.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/lemmatizer/Lemmatizer.java b/opennlp-api/src/main/java/opennlp/tools/lemmatizer/Lemmatizer.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/lemmatizer/Lemmatizer.java
rename to opennlp-api/src/main/java/opennlp/tools/lemmatizer/Lemmatizer.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/lemmatizer/LemmatizerContextGenerator.java b/opennlp-api/src/main/java/opennlp/tools/lemmatizer/LemmatizerContextGenerator.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/lemmatizer/LemmatizerContextGenerator.java
rename to opennlp-api/src/main/java/opennlp/tools/lemmatizer/LemmatizerContextGenerator.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/lemmatizer/LemmatizerEvaluationMonitor.java b/opennlp-api/src/main/java/opennlp/tools/lemmatizer/LemmatizerEvaluationMonitor.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/lemmatizer/LemmatizerEvaluationMonitor.java
rename to opennlp-api/src/main/java/opennlp/tools/lemmatizer/LemmatizerEvaluationMonitor.java
diff --git a/opennlp-api/src/main/java/opennlp/tools/ml/AlgorithmType.java b/opennlp-api/src/main/java/opennlp/tools/ml/AlgorithmType.java
new file mode 100644
index 000000000..afe984af2
--- /dev/null
+++ b/opennlp-api/src/main/java/opennlp/tools/ml/AlgorithmType.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package opennlp.tools.ml;
+
+public enum AlgorithmType {
+
+ MAXENT("MAXENT", "GIS",
+ "opennlp.tools.ml.maxent.GISTrainer",
+ "opennlp.tools.ml.maxent.io.GISModelReader",
+ "opennlp.tools.ml.maxent.io.BinaryGISModelWriter"),
+ MAXENT_QN("MAXENT_QN", "QN",
+ "opennlp.tools.ml.maxent.quasinewton.QNTrainer",
+ "opennlp.tools.ml.maxent.io.QNModelReader",
+ "opennlp.tools.ml.maxent.io.BinaryQNModelWriter"),
+ PERCEPTRON("PERCEPTRON", "Perceptron",
+ "opennlp.tools.ml.perceptron.PerceptronTrainer",
+ "opennlp.tools.ml.perceptron.PerceptronModelReader",
+ "opennlp.tools.ml.perceptron.BinaryPerceptronModelWriter"),
+ PERCEPTRON_SEQUENCE("PERCEPTRON_SEQUENCE", "Perceptron",
+ "opennlp.tools.ml.perceptron.SimplePerceptronSequenceTrainer",
+ "opennlp.tools.ml.perceptron.PerceptronModelReader",
+ "opennlp.tools.ml.perceptron.BinaryPerceptronModelWriter"),
+ NAIVE_BAYES("NAIVEBAYES", "NaiveBayes",
+ "opennlp.tools.ml.naivebayes.NaiveBayesTrainer",
+ "opennlp.tools.ml.naivebayes.NaiveBayesModelReader",
+ "opennlp.tools.ml.naivebayes.BinaryNaiveBayesModelWriter");
+
+
+ private final String algorithmType;
+ private final String trainerClazz;
+ private final String modelType;
+ private final String readerClazz;
+ private final String writerClazz;
+
+ AlgorithmType(String type, String ioType,
+ String trainerClazz, String readerClazz, String writerClazz) {
+ this.algorithmType = type;
+ this.trainerClazz = trainerClazz;
+ this.modelType = ioType;
+ this.readerClazz = readerClazz;
+ this.writerClazz = writerClazz;
+ }
+
+ public String getAlgorithmType() {
+ return algorithmType;
+ }
+
+ public String getTrainerClazz() {
+ return trainerClazz;
+ }
+
+ public String getModelType() {
+ return modelType;
+ }
+
+ public String getReaderClazz() {
+ return readerClazz;
+ }
+
+ public String getWriterClazz() {
+ return writerClazz;
+ }
+
+ /**
+ * @param type no restriction on the type.
+ * @return the {@link AlgorithmType} corresponding to the given algorithm type.
+ * @throws IllegalArgumentException if the given type is not a valid {@link AlgorithmType}.
+ */
+ public static AlgorithmType fromAlgorithmType(String type) {
+ for (AlgorithmType trainerType : AlgorithmType.values()) {
+ if (trainerType.algorithmType.equals(type)) {
+ return trainerType;
+ }
+ }
+ throw new IllegalArgumentException("Unknown algorithm type: " + type);
+ }
+
+ /**
+ * @param type no restriction on the type.
+ * @return the {@link AlgorithmType} corresponding to the given reader type.
+ * @throws IllegalArgumentException if the given type is not a valid {@link AlgorithmType}.
+ */
+ public static AlgorithmType fromModelType(String type) {
+ for (AlgorithmType trainerType : AlgorithmType.values()) {
+ if (trainerType.modelType.equals(type)) {
+ return trainerType;
+ }
+ }
+ throw new IllegalArgumentException("Unknown reader type: " + type);
+ }
+
+
+}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/ArrayMath.java b/opennlp-api/src/main/java/opennlp/tools/ml/ArrayMath.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/ArrayMath.java
rename to opennlp-api/src/main/java/opennlp/tools/ml/ArrayMath.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/EventModelSequenceTrainer.java b/opennlp-api/src/main/java/opennlp/tools/ml/EventModelSequenceTrainer.java
similarity index 92%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/EventModelSequenceTrainer.java
rename to opennlp-api/src/main/java/opennlp/tools/ml/EventModelSequenceTrainer.java
index 27d2a75c5..628e3c30d 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/EventModelSequenceTrainer.java
+++ b/opennlp-api/src/main/java/opennlp/tools/ml/EventModelSequenceTrainer.java
@@ -22,12 +22,13 @@
import opennlp.tools.commons.Trainer;
import opennlp.tools.ml.model.MaxentModel;
import opennlp.tools.ml.model.SequenceStream;
+import opennlp.tools.util.Parameters;
/**
* A specialized {@link Trainer} that is based on a 'EventModelSequence' approach.
* @param The generic type of elements to process via a {@link SequenceStream}.
*/
-public interface EventModelSequenceTrainer extends Trainer {
+public interface EventModelSequenceTrainer extends Trainer
{
String SEQUENCE_VALUE = "EventModelSequence";
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/EventTrainer.java b/opennlp-api/src/main/java/opennlp/tools/ml/EventTrainer.java
similarity index 91%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/EventTrainer.java
rename to opennlp-api/src/main/java/opennlp/tools/ml/EventTrainer.java
index d426888cb..ec9bb235b 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/EventTrainer.java
+++ b/opennlp-api/src/main/java/opennlp/tools/ml/EventTrainer.java
@@ -24,11 +24,12 @@
import opennlp.tools.ml.model.Event;
import opennlp.tools.ml.model.MaxentModel;
import opennlp.tools.util.ObjectStream;
+import opennlp.tools.util.Parameters;
/**
* A specialized {@link Trainer} that is based on an {@link Event} approach.
*/
-public interface EventTrainer extends Trainer {
+public interface EventTrainer
{
String SEQUENCE_VALUE = "Sequence";
/**
- * Trains a {@link SequenceClassificationModel} for given {@link SequenceStream events}.
+ * Trains a {@link SequenceClassificationModel} for given {@link SequenceStream events}.
*
* @param events The input {@link SequenceStream events}.
* @param The generic type of elements to process via the {@link SequenceStream}.
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/Context.java b/opennlp-api/src/main/java/opennlp/tools/ml/model/Context.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/Context.java
rename to opennlp-api/src/main/java/opennlp/tools/ml/model/Context.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/DataIndexer.java b/opennlp-api/src/main/java/opennlp/tools/ml/model/DataIndexer.java
similarity index 89%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/DataIndexer.java
rename to opennlp-api/src/main/java/opennlp/tools/ml/model/DataIndexer.java
index 3849e6f3f..4c29f3ded 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/model/DataIndexer.java
+++ b/opennlp-api/src/main/java/opennlp/tools/ml/model/DataIndexer.java
@@ -21,15 +21,15 @@
import java.util.Map;
import opennlp.tools.util.ObjectStream;
-import opennlp.tools.util.TrainingParameters;
+import opennlp.tools.util.Parameters;
/**
* Represents an indexer which compresses events in memory and performs feature selection.
*
* @see ObjectStream
- * @see TrainingParameters
+ * @see Parameters
*/
-public interface DataIndexer {
+public interface DataIndexer
{
/**
* @return Retrieves a 2-dimensional array whose first dimension is the event
@@ -78,16 +78,16 @@ public interface DataIndexer {
/**
* Sets parameters used during the data indexing.
*
- * @param trainParams The {@link TrainingParameters} to be used.
+ * @param trainParams The {@link Parameters} to be used.
* @param reportMap The {@link Map} used for reporting.
*/
- void init(TrainingParameters trainParams, Map reportMap);
+ void init(P trainParams, Map reportMap);
/**
* Performs the data indexing.
*
* Note:
- * Make sure the {@link #init(TrainingParameters, Map)} method is called first.
+ * Make sure the {@link #init(Parameters, Map)} method is called first.
*
* @param eventStream A {@link ObjectStream} of events used as input.
*
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/DataReader.java b/opennlp-api/src/main/java/opennlp/tools/ml/model/DataReader.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/DataReader.java
rename to opennlp-api/src/main/java/opennlp/tools/ml/model/DataReader.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/Event.java b/opennlp-api/src/main/java/opennlp/tools/ml/model/Event.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/Event.java
rename to opennlp-api/src/main/java/opennlp/tools/ml/model/Event.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/MaxentModel.java b/opennlp-api/src/main/java/opennlp/tools/ml/model/MaxentModel.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/MaxentModel.java
rename to opennlp-api/src/main/java/opennlp/tools/ml/model/MaxentModel.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/Prior.java b/opennlp-api/src/main/java/opennlp/tools/ml/model/Prior.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/Prior.java
rename to opennlp-api/src/main/java/opennlp/tools/ml/model/Prior.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/Sequence.java b/opennlp-api/src/main/java/opennlp/tools/ml/model/Sequence.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/Sequence.java
rename to opennlp-api/src/main/java/opennlp/tools/ml/model/Sequence.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/SequenceClassificationModel.java b/opennlp-api/src/main/java/opennlp/tools/ml/model/SequenceClassificationModel.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/SequenceClassificationModel.java
rename to opennlp-api/src/main/java/opennlp/tools/ml/model/SequenceClassificationModel.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/SequenceStream.java b/opennlp-api/src/main/java/opennlp/tools/ml/model/SequenceStream.java
similarity index 91%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/SequenceStream.java
rename to opennlp-api/src/main/java/opennlp/tools/ml/model/SequenceStream.java
index eb48f7f70..ca167e672 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/model/SequenceStream.java
+++ b/opennlp-api/src/main/java/opennlp/tools/ml/model/SequenceStream.java
@@ -32,10 +32,10 @@ public interface SequenceStream extends ObjectStream> {
* for the specified {@link Sequence}.
*
* @param sequence The {@link Sequence} to be evaluated.
- * @param model The {@link AbstractModel model} to use.
+ * @param model The {@link MaxentModel model} to use.
*
* @return The resulting {@link Event} array.
*/
- Event[] updateContext(Sequence sequence, AbstractModel model);
+ Event[] updateContext(Sequence sequence, MaxentModel model);
}
diff --git a/opennlp-tools-models/src/main/java/opennlp/tools/models/ClassPathLoaderException.java b/opennlp-api/src/main/java/opennlp/tools/models/ClassPathLoaderException.java
similarity index 100%
rename from opennlp-tools-models/src/main/java/opennlp/tools/models/ClassPathLoaderException.java
rename to opennlp-api/src/main/java/opennlp/tools/models/ClassPathLoaderException.java
diff --git a/opennlp-tools-models/src/main/java/opennlp/tools/models/ClassPathModelEntry.java b/opennlp-api/src/main/java/opennlp/tools/models/ClassPathModelEntry.java
similarity index 100%
rename from opennlp-tools-models/src/main/java/opennlp/tools/models/ClassPathModelEntry.java
rename to opennlp-api/src/main/java/opennlp/tools/models/ClassPathModelEntry.java
diff --git a/opennlp-tools-models/src/main/java/opennlp/tools/models/ClassPathModelFinder.java b/opennlp-api/src/main/java/opennlp/tools/models/ClassPathModelFinder.java
similarity index 100%
rename from opennlp-tools-models/src/main/java/opennlp/tools/models/ClassPathModelFinder.java
rename to opennlp-api/src/main/java/opennlp/tools/models/ClassPathModelFinder.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/models/ModelType.java b/opennlp-api/src/main/java/opennlp/tools/models/ModelType.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/models/ModelType.java
rename to opennlp-api/src/main/java/opennlp/tools/models/ModelType.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/monitoring/StopCriteria.java b/opennlp-api/src/main/java/opennlp/tools/monitoring/StopCriteria.java
similarity index 94%
rename from opennlp-tools/src/main/java/opennlp/tools/monitoring/StopCriteria.java
rename to opennlp-api/src/main/java/opennlp/tools/monitoring/StopCriteria.java
index 576aa7e59..16760529e 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/monitoring/StopCriteria.java
+++ b/opennlp-api/src/main/java/opennlp/tools/monitoring/StopCriteria.java
@@ -19,14 +19,10 @@
import java.util.function.Predicate;
-import opennlp.tools.ml.model.AbstractModel;
-
-
/**
* Stop criteria for model training. If the predicate is met, then the training is aborted.
*
* @see Predicate
- * @see AbstractModel
*/
public interface StopCriteria extends Predicate {
diff --git a/opennlp-tools/src/main/java/opennlp/tools/monitoring/TrainingMeasure.java b/opennlp-api/src/main/java/opennlp/tools/monitoring/TrainingMeasure.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/monitoring/TrainingMeasure.java
rename to opennlp-api/src/main/java/opennlp/tools/monitoring/TrainingMeasure.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/monitoring/TrainingProgressMonitor.java b/opennlp-api/src/main/java/opennlp/tools/monitoring/TrainingProgressMonitor.java
similarity index 95%
rename from opennlp-tools/src/main/java/opennlp/tools/monitoring/TrainingProgressMonitor.java
rename to opennlp-api/src/main/java/opennlp/tools/monitoring/TrainingProgressMonitor.java
index 235048700..87e69f62e 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/monitoring/TrainingProgressMonitor.java
+++ b/opennlp-api/src/main/java/opennlp/tools/monitoring/TrainingProgressMonitor.java
@@ -17,10 +17,8 @@
package opennlp.tools.monitoring;
-import opennlp.tools.ml.model.AbstractModel;
-
/**
- * An interface to capture training progress of an {@link AbstractModel}.
+ * An interface to capture training progress of a model.
*/
public interface TrainingProgressMonitor {
diff --git a/opennlp-tools/src/main/java/opennlp/tools/namefind/DocumentNameFinder.java b/opennlp-api/src/main/java/opennlp/tools/namefind/DocumentNameFinder.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/namefind/DocumentNameFinder.java
rename to opennlp-api/src/main/java/opennlp/tools/namefind/DocumentNameFinder.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/namefind/NameContextGenerator.java b/opennlp-api/src/main/java/opennlp/tools/namefind/NameContextGenerator.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/namefind/NameContextGenerator.java
rename to opennlp-api/src/main/java/opennlp/tools/namefind/NameContextGenerator.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/namefind/NameSample.java b/opennlp-api/src/main/java/opennlp/tools/namefind/NameSample.java
similarity index 95%
rename from opennlp-tools/src/main/java/opennlp/tools/namefind/NameSample.java
rename to opennlp-api/src/main/java/opennlp/tools/namefind/NameSample.java
index db57fce73..795a25089 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/namefind/NameSample.java
+++ b/opennlp-api/src/main/java/opennlp/tools/namefind/NameSample.java
@@ -18,6 +18,7 @@
package opennlp.tools.namefind;
import java.io.IOException;
+import java.io.Serial;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -35,7 +36,14 @@
*/
public class NameSample implements Sample {
- private static final long serialVersionUID = 1655333056555270688L;
+ @Serial
+ private static final long serialVersionUID = 9042233753280831321L;
+
+ public static final String START_TAG_PREFIX = " sentence;
private final List names;
@@ -202,14 +210,14 @@ public String toString() {
// check if nameTypes is null, or if the nameType for this specific
// entity is empty. If it is, we leave the nameType blank.
if (name.getType() == null) {
- result.append(NameSampleDataStream.START_TAG).append(' ');
+ result.append(START_TAG).append(' ');
}
else {
- result.append(NameSampleDataStream.START_TAG_PREFIX).append(name.getType()).append("> ");
+ result.append(START_TAG_PREFIX).append(name.getType()).append("> ");
}
}
if (name.getEnd() == tokenIndex) {
- result.append(NameSampleDataStream.END_TAG).append(' ');
+ result.append(END_TAG).append(' ');
}
}
@@ -221,7 +229,7 @@ public String toString() {
for (Span name : names) {
if (name.getEnd() == sentence.size()) {
- result.append(' ').append(NameSampleDataStream.END_TAG);
+ result.append(' ').append(END_TAG);
}
}
@@ -315,7 +323,7 @@ public static NameSample parse(String taggedTokens, String defaultType, boolean
}
}
- else if (parts[pi].equals(NameSampleDataStream.END_TAG)) {
+ else if (parts[pi].equals(END_TAG)) {
if (!catchingName) {
throw new IOException("Found unexpected annotation: " + errorTokenWithContext(parts, pi));
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinder.java b/opennlp-api/src/main/java/opennlp/tools/namefind/TokenNameFinder.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinder.java
rename to opennlp-api/src/main/java/opennlp/tools/namefind/TokenNameFinder.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinderEvaluationMonitor.java b/opennlp-api/src/main/java/opennlp/tools/namefind/TokenNameFinderEvaluationMonitor.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinderEvaluationMonitor.java
rename to opennlp-api/src/main/java/opennlp/tools/namefind/TokenNameFinderEvaluationMonitor.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/parser/Constituent.java b/opennlp-api/src/main/java/opennlp/tools/parser/Constituent.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/parser/Constituent.java
rename to opennlp-api/src/main/java/opennlp/tools/parser/Constituent.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/parser/GapLabeler.java b/opennlp-api/src/main/java/opennlp/tools/parser/GapLabeler.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/parser/GapLabeler.java
rename to opennlp-api/src/main/java/opennlp/tools/parser/GapLabeler.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/parser/HeadRules.java b/opennlp-api/src/main/java/opennlp/tools/parser/HeadRules.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/parser/HeadRules.java
rename to opennlp-api/src/main/java/opennlp/tools/parser/HeadRules.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/parser/Parse.java b/opennlp-api/src/main/java/opennlp/tools/parser/Parse.java
similarity index 98%
rename from opennlp-tools/src/main/java/opennlp/tools/parser/Parse.java
rename to opennlp-api/src/main/java/opennlp/tools/parser/Parse.java
index 3eaa7319e..88d7bc050 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/parser/Parse.java
+++ b/opennlp-api/src/main/java/opennlp/tools/parser/Parse.java
@@ -372,7 +372,7 @@ else if (ic.contains(sp)) {
public void show(StringBuffer sb) {
int start;
start = span.getStart();
- if (!type.equals(AbstractBottomUpParser.TOK_NODE)) {
+ if (!type.equals(Parser.TOK_NODE)) {
sb.append("(");
sb.append(type).append(" ");
if (logger.isTraceEnabled()) {
@@ -399,7 +399,7 @@ public void show(StringBuffer sb) {
if (start < span.getEnd()) {
sb.append(encodeToken(text.substring(start, span.getEnd())));
}
- if (!type.equals(AbstractBottomUpParser.TOK_NODE)) {
+ if (!type.equals(Parser.TOK_NODE)) {
sb.append(")");
}
}
@@ -421,7 +421,7 @@ public double getTagSequenceProb() {
if (logger.isTraceEnabled()) {
logger.trace("Parse.getTagSequenceProb: {} {}",type, this);
}
- if (parts.size() == 1 && (parts.get(0)).type.equals(AbstractBottomUpParser.TOK_NODE)) {
+ if (parts.size() == 1 && (parts.get(0)).type.equals(Parser.TOK_NODE)) {
if (logger.isTraceEnabled()) {
logger.trace("{} {}", this, prob);
}
@@ -844,7 +844,7 @@ public static Parse parseParse(String parse, GapLabeler gl) {
}
gl.labelGaps(stack);
} else {
- cons.add(new Constituent(AbstractBottomUpParser.TOK_NODE,
+ cons.add(new Constituent(Parser.TOK_NODE,
new Span(offset, offset + token.length())));
text.append(token).append(" ");
offset += token.length() + 1;
@@ -860,11 +860,11 @@ public static Parse parseParse(String parse, GapLabeler gl) {
}
String txt = text.toString();
int tokenIndex = -1;
- Parse p = new Parse(txt, new Span(0, txt.length()), AbstractBottomUpParser.TOP_NODE, 1, 0);
+ Parse p = new Parse(txt, new Span(0, txt.length()), Parser.TOP_NODE, 1, 0);
for (Constituent con : cons) {
String type = con.getLabel();
- if (!type.equals(AbstractBottomUpParser.TOP_NODE)) {
- if (AbstractBottomUpParser.TOK_NODE.equals(type)) {
+ if (!type.equals(Parser.TOP_NODE)) {
+ if (Parser.TOK_NODE.equals(type)) {
tokenIndex++;
}
Parse c = new Parse(txt, con.getSpan(), type, 1, tokenIndex);
@@ -901,7 +901,7 @@ public void setParent(Parse parent) {
*/
public boolean isPosTag() {
return (parts.size() == 1 &&
- (parts.get(0)).getType().equals(AbstractBottomUpParser.TOK_NODE));
+ (parts.get(0)).getType().equals(Parser.TOK_NODE));
}
/**
@@ -947,7 +947,7 @@ public Parse[] getTokenNodes() {
List nodes = new LinkedList<>(this.parts);
while (nodes.size() != 0) {
Parse p = nodes.remove(0);
- if (p.getType().equals(AbstractBottomUpParser.TOK_NODE)) {
+ if (p.getType().equals(Parser.TOK_NODE)) {
tokens.add(p);
} else {
nodes.addAll(0, p.parts);
diff --git a/opennlp-tools/src/main/java/opennlp/tools/parser/Parser.java b/opennlp-api/src/main/java/opennlp/tools/parser/Parser.java
similarity index 89%
rename from opennlp-tools/src/main/java/opennlp/tools/parser/Parser.java
rename to opennlp-api/src/main/java/opennlp/tools/parser/Parser.java
index 8b5d3a7e0..107c11dcd 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/parser/Parser.java
+++ b/opennlp-api/src/main/java/opennlp/tools/parser/Parser.java
@@ -22,6 +22,22 @@
*/
public interface Parser {
+
+ /**
+ * The label for the top node.
+ */
+ String TOP_NODE = "TOP";
+
+ /**
+ * The label for the top if an incomplete node.
+ */
+ String INC_NODE = "INC";
+
+ /**
+ * The label for a token node.
+ */
+ String TOK_NODE = "TK";
+
/**
* Returns the specified number of parses or fewer for the specified tokens.
*
diff --git a/opennlp-tools/src/main/java/opennlp/tools/parser/ParserEvaluationMonitor.java b/opennlp-api/src/main/java/opennlp/tools/parser/ParserEvaluationMonitor.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/parser/ParserEvaluationMonitor.java
rename to opennlp-api/src/main/java/opennlp/tools/parser/ParserEvaluationMonitor.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/parser/ParserEventTypeEnum.java b/opennlp-api/src/main/java/opennlp/tools/parser/ParserEventTypeEnum.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/parser/ParserEventTypeEnum.java
rename to opennlp-api/src/main/java/opennlp/tools/parser/ParserEventTypeEnum.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/parser/ParserType.java b/opennlp-api/src/main/java/opennlp/tools/parser/ParserType.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/parser/ParserType.java
rename to opennlp-api/src/main/java/opennlp/tools/parser/ParserType.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/postag/MutableTagDictionary.java b/opennlp-api/src/main/java/opennlp/tools/postag/MutableTagDictionary.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/postag/MutableTagDictionary.java
rename to opennlp-api/src/main/java/opennlp/tools/postag/MutableTagDictionary.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/postag/POSContextGenerator.java b/opennlp-api/src/main/java/opennlp/tools/postag/POSContextGenerator.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/postag/POSContextGenerator.java
rename to opennlp-api/src/main/java/opennlp/tools/postag/POSContextGenerator.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/postag/POSSample.java b/opennlp-api/src/main/java/opennlp/tools/postag/POSSample.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/postag/POSSample.java
rename to opennlp-api/src/main/java/opennlp/tools/postag/POSSample.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/postag/POSTagger.java b/opennlp-api/src/main/java/opennlp/tools/postag/POSTagger.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/postag/POSTagger.java
rename to opennlp-api/src/main/java/opennlp/tools/postag/POSTagger.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerEvaluationMonitor.java b/opennlp-api/src/main/java/opennlp/tools/postag/POSTaggerEvaluationMonitor.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerEvaluationMonitor.java
rename to opennlp-api/src/main/java/opennlp/tools/postag/POSTaggerEvaluationMonitor.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/postag/TagDictionary.java b/opennlp-api/src/main/java/opennlp/tools/postag/TagDictionary.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/postag/TagDictionary.java
rename to opennlp-api/src/main/java/opennlp/tools/postag/TagDictionary.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/sentdetect/EndOfSentenceScanner.java b/opennlp-api/src/main/java/opennlp/tools/sentdetect/EndOfSentenceScanner.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/sentdetect/EndOfSentenceScanner.java
rename to opennlp-api/src/main/java/opennlp/tools/sentdetect/EndOfSentenceScanner.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/sentdetect/SDContextGenerator.java b/opennlp-api/src/main/java/opennlp/tools/sentdetect/SDContextGenerator.java
similarity index 95%
rename from opennlp-tools/src/main/java/opennlp/tools/sentdetect/SDContextGenerator.java
rename to opennlp-api/src/main/java/opennlp/tools/sentdetect/SDContextGenerator.java
index d0ca1f2f3..6ce943a0e 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/sentdetect/SDContextGenerator.java
+++ b/opennlp-api/src/main/java/opennlp/tools/sentdetect/SDContextGenerator.java
@@ -17,9 +17,8 @@
package opennlp.tools.sentdetect;
-
/**
- * Interface for {@link SentenceDetectorME} context generators.
+ * Interface for {@link SentenceDetector} context generators.
*/
public interface SDContextGenerator {
diff --git a/opennlp-tools/src/main/java/opennlp/tools/sentdetect/SentenceDetector.java b/opennlp-api/src/main/java/opennlp/tools/sentdetect/SentenceDetector.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/sentdetect/SentenceDetector.java
rename to opennlp-api/src/main/java/opennlp/tools/sentdetect/SentenceDetector.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/sentdetect/SentenceDetectorEvaluationMonitor.java b/opennlp-api/src/main/java/opennlp/tools/sentdetect/SentenceDetectorEvaluationMonitor.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/sentdetect/SentenceDetectorEvaluationMonitor.java
rename to opennlp-api/src/main/java/opennlp/tools/sentdetect/SentenceDetectorEvaluationMonitor.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/sentdetect/SentenceSample.java b/opennlp-api/src/main/java/opennlp/tools/sentdetect/SentenceSample.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/sentdetect/SentenceSample.java
rename to opennlp-api/src/main/java/opennlp/tools/sentdetect/SentenceSample.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/stemmer/Stemmer.java b/opennlp-api/src/main/java/opennlp/tools/stemmer/Stemmer.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/stemmer/Stemmer.java
rename to opennlp-api/src/main/java/opennlp/tools/stemmer/Stemmer.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/tokenize/AbstractTokenizer.java b/opennlp-api/src/main/java/opennlp/tools/tokenize/AbstractTokenizer.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/tokenize/AbstractTokenizer.java
rename to opennlp-api/src/main/java/opennlp/tools/tokenize/AbstractTokenizer.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/tokenize/Detokenizer.java b/opennlp-api/src/main/java/opennlp/tools/tokenize/Detokenizer.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/tokenize/Detokenizer.java
rename to opennlp-api/src/main/java/opennlp/tools/tokenize/Detokenizer.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenContextGenerator.java b/opennlp-api/src/main/java/opennlp/tools/tokenize/TokenContextGenerator.java
similarity index 92%
rename from opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenContextGenerator.java
rename to opennlp-api/src/main/java/opennlp/tools/tokenize/TokenContextGenerator.java
index 475146bd8..683dac76d 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenContextGenerator.java
+++ b/opennlp-api/src/main/java/opennlp/tools/tokenize/TokenContextGenerator.java
@@ -18,7 +18,8 @@
package opennlp.tools.tokenize;
/**
- * Interface for context generators required for {@link TokenizerME}.
+ * Interface for context generators required for
+ * {@link Tokenizer tokenizer implementations}.
*/
public interface TokenContextGenerator {
diff --git a/opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenSample.java b/opennlp-api/src/main/java/opennlp/tools/tokenize/TokenSample.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenSample.java
rename to opennlp-api/src/main/java/opennlp/tools/tokenize/TokenSample.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/tokenize/Tokenizer.java b/opennlp-api/src/main/java/opennlp/tools/tokenize/Tokenizer.java
similarity index 99%
rename from opennlp-tools/src/main/java/opennlp/tools/tokenize/Tokenizer.java
rename to opennlp-api/src/main/java/opennlp/tools/tokenize/Tokenizer.java
index 8a6bc37f5..f57fd8dba 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/tokenize/Tokenizer.java
+++ b/opennlp-api/src/main/java/opennlp/tools/tokenize/Tokenizer.java
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
package opennlp.tools.tokenize;
import opennlp.tools.util.Span;
diff --git a/opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenizerEvaluationMonitor.java b/opennlp-api/src/main/java/opennlp/tools/tokenize/TokenizerEvaluationMonitor.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenizerEvaluationMonitor.java
rename to opennlp-api/src/main/java/opennlp/tools/tokenize/TokenizerEvaluationMonitor.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/tokenize/WhitespaceTokenizer.java b/opennlp-api/src/main/java/opennlp/tools/tokenize/WhitespaceTokenizer.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/tokenize/WhitespaceTokenizer.java
rename to opennlp-api/src/main/java/opennlp/tools/tokenize/WhitespaceTokenizer.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/tokenize/WordpieceTokenizer.java b/opennlp-api/src/main/java/opennlp/tools/tokenize/WordpieceTokenizer.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/tokenize/WordpieceTokenizer.java
rename to opennlp-api/src/main/java/opennlp/tools/tokenize/WordpieceTokenizer.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/AbstractObjectStream.java b/opennlp-api/src/main/java/opennlp/tools/util/AbstractObjectStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/AbstractObjectStream.java
rename to opennlp-api/src/main/java/opennlp/tools/util/AbstractObjectStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/BeamSearchContextGenerator.java b/opennlp-api/src/main/java/opennlp/tools/util/BeamSearchContextGenerator.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/BeamSearchContextGenerator.java
rename to opennlp-api/src/main/java/opennlp/tools/util/BeamSearchContextGenerator.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/Cache.java b/opennlp-api/src/main/java/opennlp/tools/util/Cache.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/Cache.java
rename to opennlp-api/src/main/java/opennlp/tools/util/Cache.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/InputStreamFactory.java b/opennlp-api/src/main/java/opennlp/tools/util/InputStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/InputStreamFactory.java
rename to opennlp-api/src/main/java/opennlp/tools/util/InputStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/InsufficientTrainingDataException.java b/opennlp-api/src/main/java/opennlp/tools/util/InsufficientTrainingDataException.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/InsufficientTrainingDataException.java
rename to opennlp-api/src/main/java/opennlp/tools/util/InsufficientTrainingDataException.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/InvalidFormatException.java b/opennlp-api/src/main/java/opennlp/tools/util/InvalidFormatException.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/InvalidFormatException.java
rename to opennlp-api/src/main/java/opennlp/tools/util/InvalidFormatException.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/ObjectStream.java b/opennlp-api/src/main/java/opennlp/tools/util/ObjectStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/ObjectStream.java
rename to opennlp-api/src/main/java/opennlp/tools/util/ObjectStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/ObjectStreamUtils.java b/opennlp-api/src/main/java/opennlp/tools/util/ObjectStreamUtils.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/ObjectStreamUtils.java
rename to opennlp-api/src/main/java/opennlp/tools/util/ObjectStreamUtils.java
diff --git a/opennlp-api/src/main/java/opennlp/tools/util/Parameters.java b/opennlp-api/src/main/java/opennlp/tools/util/Parameters.java
new file mode 100644
index 000000000..df72b1a14
--- /dev/null
+++ b/opennlp-api/src/main/java/opennlp/tools/util/Parameters.java
@@ -0,0 +1,359 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package opennlp.tools.util;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Map;
+
+import opennlp.tools.ml.AlgorithmType;
+
+public interface Parameters {
+
+ String ALGORITHM_PARAM = "Algorithm";
+ String TRAINER_TYPE_PARAM = "TrainerType";
+ String ITERATIONS_PARAM = "Iterations";
+ String CUTOFF_PARAM = "Cutoff";
+ String THREADS_PARAM = "Threads";
+
+ String ALGORITHM_DEFAULT_VALUE = AlgorithmType.MAXENT.getAlgorithmType();
+
+ /**
+ * The default number of iterations is 100.
+ */
+ int ITERATIONS_DEFAULT_VALUE = 100;
+ /**
+ * The default cut off value is 5.
+ */
+ int CUTOFF_DEFAULT_VALUE = 5;
+
+ /**
+ * @param namespace The namespace used as prefix or {@code null}.
+ * If {@code null} the {@code key} is left unchanged.
+ * @param key The identifying key to process.
+ *
+ * @return Retrieves a prefixed key in the specified {@code namespace}.
+ * If no {@code namespace} was specified the returned String is equal to {@code key}.
+ */
+ static String getKey(String namespace, String key) {
+ if (namespace == null) {
+ return key;
+ }
+ else {
+ return namespace + "." + key;
+ }
+ }
+
+ /**
+ * @return Retrieves the (training) algorithm name for a given name space, or {@code null} if unset.
+ */
+ String algorithm(String namespace);
+
+ /**
+ * @return Retrieves the (training) algorithm name. or @code null} if not set.
+ */
+ String algorithm();
+
+ /**
+ * @param namespace The name space to filter or narrow the search space. May be {@code null}.
+ *
+ * @return Retrieves a parameter {@link Map} which can be passed to the train and validate methods.
+ */
+ Map getObjectSettings(String namespace);
+
+ /**
+ * @return Retrieves a parameter {@link Map} of all parameters without narrowing.
+ */
+ Map getObjectSettings();
+
+ /**
+ * Puts a {@code value} into the current {@link Parameters} under a certain {@code key},
+ * if the value was not present before.
+ * The {@code namespace} can be used to prefix the {@code key}.
+ *
+ * @param namespace A prefix to declare or use a name space under which {@code key} shall be put.
+ * May be {@code null}.
+ * @param key The identifying key to put or retrieve a {@code value} with.
+ * @param value The {@link String} parameter to put into this {@link Parameters} instance.
+ */
+ void putIfAbsent(String namespace, String key, String value);
+
+ /**
+ * Puts a {@code value} into the current {@link Parameters} under a certain {@code key},
+ * if the value was not present before.
+ *
+ * @param key The identifying key to put or retrieve a {@code value} with.
+ * @param value The {@link String} parameter to put into this {@link Parameters} instance.
+ */
+ void putIfAbsent(String key, String value);
+
+ /**
+ * Puts a {@code value} into the current {@link Parameters} under a certain {@code key},
+ * if the value was not present before.
+ * The {@code namespace} can be used to prefix the {@code key}.
+ *
+ * @param namespace A prefix to declare or use a name space under which {@code key} shall be put.
+ * May be {@code null}.
+ * @param key The identifying key to put or retrieve a {@code value} with.
+ * @param value The {@link Integer} parameter to put into this {@link Parameters} instance.
+ */
+ void putIfAbsent(String namespace, String key, int value);
+
+ /**
+ * Puts a {@code value} into the current {@link Parameters} under a certain {@code key},
+ * if the value was not present before.
+ *
+ * @param key The identifying key to put or retrieve a {@code value} with.
+ * @param value The {@link Integer} parameter to put into this {@link Parameters} instance.
+ */
+ void putIfAbsent(String key, int value);
+
+ /**
+ * Puts a {@code value} into the current {@link Parameters} under a certain {@code key},
+ * if the value was not present before.
+ * The {@code namespace} can be used to prefix the {@code key}.
+ *
+ * @param namespace A prefix to declare or use a name space under which {@code key} shall be put.
+ * May be {@code null}.
+ * @param key The identifying key to put or retrieve a {@code value} with.
+ * @param value The {@link Double} parameter to put into this {@link Parameters} instance.
+ */
+ void putIfAbsent(String namespace, String key, double value);
+
+ /**
+ * Puts a {@code value} into the current {@link Parameters} under a certain {@code key},
+ * if the value was not present before.
+ * The {@code namespace} can be used to prefix the {@code key}.
+ *
+ * @param key The identifying key to put or retrieve a {@code value} with.
+ * @param value The {@link Double} parameter to put into this {@link Parameters} instance.
+ */
+ void putIfAbsent(String key, double value);
+
+ /**
+ * Puts a {@code value} into the current {@link Parameters} under a certain {@code key},
+ * if the value was not present before.
+ * The {@code namespace} can be used to prefix the {@code key}.
+ *
+ * @param namespace A prefix to declare or use a name space under which {@code key} shall be put.
+ * May be {@code null}.
+ * @param key The identifying key to put or retrieve a {@code value} with.
+ * @param value The {@link Boolean} parameter to put into this {@link Parameters} instance.
+ */
+ void putIfAbsent(String namespace, String key, boolean value);
+
+ /**
+ * Puts a {@code value} into the current {@link Parameters} under a certain {@code key},
+ * if the value was not present before.
+ *
+ * @param key The identifying key to put or retrieve a {@code value} with.
+ * @param value The {@link Boolean} parameter to put into this {@link Parameters} instance.
+ */
+ void putIfAbsent(String key, boolean value);
+
+ /**
+ * Puts a {@code value} into the current {@link Parameters} under a certain {@code key}.
+ * If the value was present before, the previous value will be overwritten with the specified one.
+ * The {@code namespace} can be used to prefix the {@code key}.
+ *
+ * @param namespace A prefix to declare or use a name space under which {@code key} shall be put.
+ * May be {@code null}.
+ * @param key The identifying key to put or retrieve a {@code value} with.
+ * @param value The {@link String} parameter to put into this {@link Parameters} instance.
+ */
+ void put(String namespace, String key, String value);
+
+ /**
+ * Puts a {@code value} into the current {@link Parameters} under a certain {@code key}.
+ * If the value was present before, the previous value will be overwritten with the specified one.
+ *
+ * @param key The identifying key to put or retrieve a {@code value} with.
+ * @param value The {@link String} parameter to put into this {@link Parameters} instance.
+ */
+ void put(String key, String value);
+
+ /**
+ * Puts a {@code value} into the current {@link Parameters} under a certain {@code key}.
+ * If the value was present before, the previous value will be overwritten with the specified one.
+ * The {@code namespace} can be used to prefix the {@code key}.
+ *
+ * @param namespace A prefix to declare or use a name space under which {@code key} shall be put.
+ * May be {@code null}.
+ * @param key The identifying key to put or retrieve a {@code value} with.
+ * @param value The {@link Integer} parameter to put into this {@link Parameters} instance.
+ */
+ void put(String namespace, String key, int value);
+
+ /**
+ * Puts a {@code value} into the current {@link Parameters} under a certain {@code key}.
+ * If the value was present before, the previous value will be overwritten with the specified one.
+ *
+ * @param key The identifying key to put or retrieve a {@code value} with.
+ * @param value The {@link Integer} parameter to put into this {@link Parameters} instance.
+ */
+ void put(String key, int value);
+
+ /**
+ * Puts a {@code value} into the current {@link Parameters} under a certain {@code key}.
+ * If the value was present before, the previous value will be overwritten with the specified one.
+ * The {@code namespace} can be used to prefix the {@code key}.
+ *
+ * @param namespace A prefix to declare or use a name space under which {@code key} shall be put.
+ * May be {@code null}.
+ * @param key The identifying key to put or retrieve a {@code value} with.
+ * @param value The {@link Double} parameter to put into this {@link Parameters} instance.
+ */
+ void put(String namespace, String key, double value);
+
+ /**
+ * Puts a {@code value} into the current {@link Parameters} under a certain {@code key}.
+ * If the value was present before, the previous value will be overwritten with the specified one.
+ *
+ * @param key The identifying key to put or retrieve a {@code value} with.
+ * @param value The {@link Double} parameter to put into this {@link Parameters} instance.
+ */
+ void put(String key, double value);
+
+ /**
+ * Puts a {@code value} into the current {@link Parameters} under a certain {@code key}.
+ * If the value was present before, the previous value will be overwritten with the specified one.
+ * The {@code namespace} can be used to prefix the {@code key}.
+ *
+ * @param namespace A prefix to declare or use a name space under which {@code key} shall be put.
+ * May be {@code null}.
+ * @param key The identifying key to put or retrieve a {@code value} with.
+ * @param value The {@link Boolean} parameter to put into this {@link Parameters} instance.
+ */
+ void put(String namespace, String key, boolean value);
+
+ /**
+ * Puts a {@code value} into the current {@link Parameters} under a certain {@code key}.
+ * If the value was present before, the previous value will be overwritten with the specified one.
+ *
+ * @param key The identifying key to put or retrieve a {@code value} with.
+ * @param value The {@link Boolean} parameter to put into this {@link Parameters} instance.
+ */
+ void put(String key, boolean value);
+
+ /**
+ * Serializes a {@link Parameters} instance via a specified {@link OutputStream}.
+ *
+ * @param out A valid, open {@link OutputStream} to write to.
+ *
+ * @throws IOException Thrown if errors occurred.
+ */
+ void serialize(OutputStream out) throws IOException;
+
+ /**
+ * Obtains a training parameter value.
+ *
+ * @param key The identifying key to retrieve a {@code value} with.
+ * @param defaultValue The alternative value to use, if {@code key} was not present.
+ * @return The {@link String training value} associated with {@code key} if present,
+ * or a {@code defaultValue} if not.
+ * @throws java.lang.ClassCastException} Thrown if the value is not {@code String}
+ */
+ String getStringParameter(String key, String defaultValue);
+
+ /**
+ * Obtains a training parameter value in the specified namespace.
+ *
+ * @param namespace A prefix to declare or use a name space under which {@code key} shall be searched.
+ * May be {@code null}.
+ * @param key The identifying key to retrieve a {@code value} with.
+ * @param defaultValue The alternative value to use, if {@code key} was not present.
+ *
+ * @return The {@link String training value} associated with {@code key} if present,
+ * or a {@code defaultValue} if not.
+ * @throws java.lang.ClassCastException} Thrown if the value is not {@code String}
+ */
+ String getStringParameter(String namespace, String key, String defaultValue);
+
+ /**
+ * Obtains a training parameter value.
+ *
+ *
+ * @param key The identifying key to retrieve a {@code value} with.
+ * @param defaultValue The alternative value to use, if {@code key} was not present.
+ * @return The {@link Integer training value} associated with {@code key} if present,
+ * or a {@code defaultValue} if not.
+ */
+ int getIntParameter(String key, int defaultValue);
+
+ /**
+ * Obtains a training parameter value in the specified namespace.
+ *
+ * @param namespace A prefix to declare or use a name space under which {@code key} shall be searched.
+ * May be {@code null}.
+ * @param key The identifying key to retrieve a {@code value} with.
+ * @param defaultValue The alternative value to use, if {@code key} was not present.
+ *
+ * @return The {@link Integer training value} associated with {@code key} if present,
+ * or a {@code defaultValue} if not.
+ */
+ int getIntParameter(String namespace, String key, int defaultValue);
+
+ /**
+ * Obtains a training parameter value.
+ *
+ *
+ * @param key The identifying key to retrieve a {@code value} with.
+ * @param defaultValue The alternative value to use, if {@code key} was not present.
+ * @return The {@link Double training value} associated with {@code key} if present,
+ * or a {@code defaultValue} if not.
+ */
+ double getDoubleParameter(String key, double defaultValue);
+
+ /**
+ * Obtains a training parameter value in the specified namespace.
+ *
+ * @param namespace A prefix to declare or use a name space under which {@code key} shall be searched.
+ * May be {@code null}.
+ * @param key The identifying key to retrieve a {@code value} with.
+ * @param defaultValue The alternative value to use, if {@code key} was not present.
+ *
+ * @return The {@link Double training value} associated with {@code key} if present,
+ * or a {@code defaultValue} if not.
+ */
+ double getDoubleParameter(String namespace, String key, double defaultValue);
+
+ /**
+ * Obtains a training parameter value.
+ *
+ *
+ * @param key The identifying key to retrieve a {@code value} with.
+ * @param defaultValue The alternative value to use, if {@code key} was not present.
+ * @return The {@link Boolean training value} associated with {@code key} if present,
+ * or a {@code defaultValue} if not.
+ */
+ boolean getBooleanParameter(String key, boolean defaultValue);
+
+
+ /**
+ * Obtains a training parameter value in the specified namespace.
+ *
+ * @param namespace A prefix to declare or use a name space under which {@code key} shall be searched.
+ * May be {@code null}.
+ * @param key The identifying key to retrieve a {@code value} with.
+ * @param defaultValue The alternative value to use, if {@code key} was not present.
+ *
+ * @return The {@link Boolean training value} associated with {@code key} if present,
+ * or a {@code defaultValue} if not.
+ */
+ boolean getBooleanParameter(String namespace, String key, boolean defaultValue);
+}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/PlainTextByLineStream.java b/opennlp-api/src/main/java/opennlp/tools/util/PlainTextByLineStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/PlainTextByLineStream.java
rename to opennlp-api/src/main/java/opennlp/tools/util/PlainTextByLineStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/ResetableIterator.java b/opennlp-api/src/main/java/opennlp/tools/util/ResetableIterator.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/ResetableIterator.java
rename to opennlp-api/src/main/java/opennlp/tools/util/ResetableIterator.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/Sequence.java b/opennlp-api/src/main/java/opennlp/tools/util/Sequence.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/Sequence.java
rename to opennlp-api/src/main/java/opennlp/tools/util/Sequence.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/SequenceCodec.java b/opennlp-api/src/main/java/opennlp/tools/util/SequenceCodec.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/SequenceCodec.java
rename to opennlp-api/src/main/java/opennlp/tools/util/SequenceCodec.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/SequenceValidator.java b/opennlp-api/src/main/java/opennlp/tools/util/SequenceValidator.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/SequenceValidator.java
rename to opennlp-api/src/main/java/opennlp/tools/util/SequenceValidator.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/Span.java b/opennlp-api/src/main/java/opennlp/tools/util/Span.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/Span.java
rename to opennlp-api/src/main/java/opennlp/tools/util/Span.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/StringUtil.java b/opennlp-api/src/main/java/opennlp/tools/util/StringUtil.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/StringUtil.java
rename to opennlp-api/src/main/java/opennlp/tools/util/StringUtil.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/TokenTag.java b/opennlp-api/src/main/java/opennlp/tools/util/TokenTag.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/TokenTag.java
rename to opennlp-api/src/main/java/opennlp/tools/util/TokenTag.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/TrainingConfiguration.java b/opennlp-api/src/main/java/opennlp/tools/util/TrainingConfiguration.java
similarity index 92%
rename from opennlp-tools/src/main/java/opennlp/tools/util/TrainingConfiguration.java
rename to opennlp-api/src/main/java/opennlp/tools/util/TrainingConfiguration.java
index 40bf5757f..ad5ef5a7f 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/util/TrainingConfiguration.java
+++ b/opennlp-api/src/main/java/opennlp/tools/util/TrainingConfiguration.java
@@ -17,12 +17,11 @@
package opennlp.tools.util;
-import opennlp.tools.ml.model.AbstractModel;
import opennlp.tools.monitoring.StopCriteria;
import opennlp.tools.monitoring.TrainingProgressMonitor;
/**
- * Configuration used for {@link AbstractModel} training.
+ * Configuration used for model training.
* @param progMon {@link TrainingProgressMonitor} used to monitor the training progress.
* @param stopCriteria {@link StopCriteria} used to abort training when the criteria is met.
*/
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/eval/EvaluationMonitor.java b/opennlp-api/src/main/java/opennlp/tools/util/eval/EvaluationMonitor.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/eval/EvaluationMonitor.java
rename to opennlp-api/src/main/java/opennlp/tools/util/eval/EvaluationMonitor.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/eval/FMeasure.java b/opennlp-api/src/main/java/opennlp/tools/util/eval/FMeasure.java
similarity index 98%
rename from opennlp-tools/src/main/java/opennlp/tools/util/eval/FMeasure.java
rename to opennlp-api/src/main/java/opennlp/tools/util/eval/FMeasure.java
index 935a78769..1d5b407a7 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/util/eval/FMeasure.java
+++ b/opennlp-api/src/main/java/opennlp/tools/util/eval/FMeasure.java
@@ -23,7 +23,7 @@
/**
- * The {@link FMeasure} is a utility class for {@link Evaluator evaluators}
+ * The {@link FMeasure} is a utility class for {@code evaluators}
* which measures precision, recall and the resulting f-measure.
*
* Evaluation results are the arithmetic mean of the precision
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/eval/Mean.java b/opennlp-api/src/main/java/opennlp/tools/util/eval/Mean.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/eval/Mean.java
rename to opennlp-api/src/main/java/opennlp/tools/util/eval/Mean.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/ext/ExtensionLoader.java b/opennlp-api/src/main/java/opennlp/tools/util/ext/ExtensionLoader.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/ext/ExtensionLoader.java
rename to opennlp-api/src/main/java/opennlp/tools/util/ext/ExtensionLoader.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/ext/ExtensionNotLoadedException.java b/opennlp-api/src/main/java/opennlp/tools/util/ext/ExtensionNotLoadedException.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/ext/ExtensionNotLoadedException.java
rename to opennlp-api/src/main/java/opennlp/tools/util/ext/ExtensionNotLoadedException.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/ext/ExtensionServiceKeys.java b/opennlp-api/src/main/java/opennlp/tools/util/ext/ExtensionServiceKeys.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/ext/ExtensionServiceKeys.java
rename to opennlp-api/src/main/java/opennlp/tools/util/ext/ExtensionServiceKeys.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/AdaptiveFeatureGenerator.java b/opennlp-api/src/main/java/opennlp/tools/util/featuregen/AdaptiveFeatureGenerator.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/featuregen/AdaptiveFeatureGenerator.java
rename to opennlp-api/src/main/java/opennlp/tools/util/featuregen/AdaptiveFeatureGenerator.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/FeatureGeneratorResourceProvider.java b/opennlp-api/src/main/java/opennlp/tools/util/featuregen/FeatureGeneratorResourceProvider.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/featuregen/FeatureGeneratorResourceProvider.java
rename to opennlp-api/src/main/java/opennlp/tools/util/featuregen/FeatureGeneratorResourceProvider.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/java/Experimental.java b/opennlp-api/src/main/java/opennlp/tools/util/java/Experimental.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/java/Experimental.java
rename to opennlp-api/src/main/java/opennlp/tools/util/java/Experimental.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/jvm/StringInterner.java b/opennlp-api/src/main/java/opennlp/tools/util/jvm/StringInterner.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/jvm/StringInterner.java
rename to opennlp-api/src/main/java/opennlp/tools/util/jvm/StringInterner.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/model/ArtifactProvider.java b/opennlp-api/src/main/java/opennlp/tools/util/model/ArtifactProvider.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/model/ArtifactProvider.java
rename to opennlp-api/src/main/java/opennlp/tools/util/model/ArtifactProvider.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/model/ArtifactSerializer.java b/opennlp-api/src/main/java/opennlp/tools/util/model/ArtifactSerializer.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/model/ArtifactSerializer.java
rename to opennlp-api/src/main/java/opennlp/tools/util/model/ArtifactSerializer.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/model/ModelType.java b/opennlp-api/src/main/java/opennlp/tools/util/model/ModelType.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/model/ModelType.java
rename to opennlp-api/src/main/java/opennlp/tools/util/model/ModelType.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/model/SerializableArtifact.java b/opennlp-api/src/main/java/opennlp/tools/util/model/SerializableArtifact.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/model/SerializableArtifact.java
rename to opennlp-api/src/main/java/opennlp/tools/util/model/SerializableArtifact.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/normalizer/CharSequenceNormalizer.java b/opennlp-api/src/main/java/opennlp/tools/util/normalizer/CharSequenceNormalizer.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/normalizer/CharSequenceNormalizer.java
rename to opennlp-api/src/main/java/opennlp/tools/util/normalizer/CharSequenceNormalizer.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/wordvector/WordVector.java b/opennlp-api/src/main/java/opennlp/tools/util/wordvector/WordVector.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/wordvector/WordVector.java
rename to opennlp-api/src/main/java/opennlp/tools/util/wordvector/WordVector.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/wordvector/WordVectorTable.java b/opennlp-api/src/main/java/opennlp/tools/util/wordvector/WordVectorTable.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/wordvector/WordVectorTable.java
rename to opennlp-api/src/main/java/opennlp/tools/util/wordvector/WordVectorTable.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/wordvector/WordVectorType.java b/opennlp-api/src/main/java/opennlp/tools/util/wordvector/WordVectorType.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/wordvector/WordVectorType.java
rename to opennlp-api/src/main/java/opennlp/tools/util/wordvector/WordVectorType.java
diff --git a/opennlp-core/opennlp-cli/lang/ga/abb_GA.xml b/opennlp-core/opennlp-cli/lang/ga/abb_GA.xml
new file mode 100644
index 000000000..9d15aede3
--- /dev/null
+++ b/opennlp-core/opennlp-cli/lang/ga/abb_GA.xml
@@ -0,0 +1,164 @@
+
+
+
+
+
+
+tel.
+
+
+Mr.
+
+
+Mrs.
+
+
+.i.
+
+
+Uacht.
+
+
+m.sh.
+
+
+lch.
+
+
+lgh.
+
+
+Dr.
+
+
+uimh.
+
+
+Co.
+
+
+gCo.
+
+
+tUacht.
+
+
+Uas.
+
+
+tUas.
+
+
+Msc.
+
+
+Ms.
+
+
+Sr.
+
+
+Jr.
+
+
+Bros.
+
+
+fig.
+
+
+Jan.
+
+
+Feb.
+
+
+Mar.
+
+
+Apr.
+
+
+Jun.
+
+
+Jul.
+
+
+Aug.
+
+
+Sep.
+
+
+Sept.
+
+
+Oct.
+
+
+Nov.
+
+
+Dec.
+
+
+Ean.
+
+
+Fea.
+
+
+Már.
+
+
+Aib.
+
+
+Bea.
+
+
+Mei.
+
+
+Iúl.
+
+
+Lún.
+
+
+M.Fr.
+
+
+D.Fr.
+
+
+Sam.
+
+
+Nol.
+
+
+Ltd.
+
+
+Teo.
+
+
diff --git a/opennlp-core/opennlp-cli/pom.xml b/opennlp-core/opennlp-cli/pom.xml
new file mode 100644
index 000000000..b19b450b7
--- /dev/null
+++ b/opennlp-core/opennlp-cli/pom.xml
@@ -0,0 +1,138 @@
+
+
+ 4.0.0
+
+ org.apache.opennlp
+ opennlp-core
+ 3.0.0-SNAPSHOT
+
+
+ opennlp-cli
+ jar
+ Apache OpenNLP Core CLI
+
+
+
+
+ opennlp-api
+ ${project.groupId}
+
+
+
+ opennlp-runtime
+ ${project.groupId}
+
+
+
+ opennlp-formats
+ ${project.groupId}
+
+
+
+ opennlp-ml-commons
+ ${project.groupId}
+
+
+
+ opennlp-ml-perceptron
+ ${project.groupId}
+ runtime
+
+
+
+ opennlp-ml-bayes
+ ${project.groupId}
+ runtime
+
+
+
+ opennlp-ml-maxent
+ ${project.groupId}
+ runtime
+
+
+
+
+ org.slf4j
+ slf4j-api
+
+
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-params
+ test
+
+
+
+
+ com.ginsberg
+ junit5-system-exit
+ ${junit5-system-exit.version}
+ test
+
+
+
+ io.github.hakky54
+ logcaptor
+ ${logcaptor.version}
+ test
+
+
+
+
+
+
+ src/main/resources
+ true
+
+
+
+
+ maven-javadoc-plugin
+
+ opennlp.tools.cmdline
+
+
+
+ create-javadoc-jar
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ -Xmx2048m -DOPENNLP_DOWNLOAD_HOME=${opennlp.download.home} -javaagent:${settings.localRepository}/com/ginsberg/junit5-system-exit/${junit5-system-exit.version}/junit5-system-exit-${junit5-system-exit.version}.jar
+ ${opennlp.forkCount}
+ false
+
+ **/stemmer/*
+ **/stemmer/snowball/*
+ **/*IT.java
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+
+
+
+
+
+
\ No newline at end of file
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/AbstractConverterTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/AbstractConverterTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/AbstractConverterTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/AbstractConverterTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/AbstractCrossValidatorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/AbstractCrossValidatorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/AbstractCrossValidatorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/AbstractCrossValidatorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/AbstractEvaluatorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/AbstractEvaluatorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/AbstractEvaluatorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/AbstractEvaluatorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/AbstractTrainerTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/AbstractTrainerTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/AbstractTrainerTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/AbstractTrainerTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/AbstractTypedParamTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/AbstractTypedParamTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/AbstractTypedParamTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/AbstractTypedParamTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/BasicCmdLineTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/BasicCmdLineTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/BasicCmdLineTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/BasicCmdLineTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/CLI.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/CLI.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/CLI.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/CLI.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/CmdLineTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/CmdLineTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/CmdLineTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/CmdLineTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/CmdLineUtil.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/CmdLineUtil.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/CmdLineUtil.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/CmdLineUtil.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/DetailedFMeasureListener.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/DetailedFMeasureListener.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/DetailedFMeasureListener.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/DetailedFMeasureListener.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/EvaluationErrorPrinter.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/EvaluationErrorPrinter.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/EvaluationErrorPrinter.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/EvaluationErrorPrinter.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/FineGrainedReportListener.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/FineGrainedReportListener.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/FineGrainedReportListener.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/FineGrainedReportListener.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/GenerateManualTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/GenerateManualTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/GenerateManualTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/GenerateManualTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/ModelLoader.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/ModelLoader.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/ModelLoader.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/ModelLoader.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/PerformanceMonitor.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/PerformanceMonitor.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/PerformanceMonitor.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/PerformanceMonitor.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/SystemInputStreamFactory.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/SystemInputStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/SystemInputStreamFactory.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/SystemInputStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/TypedCmdLineTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/TypedCmdLineTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/TypedCmdLineTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/TypedCmdLineTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/chunker/ChunkEvaluationErrorListener.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/chunker/ChunkEvaluationErrorListener.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/chunker/ChunkEvaluationErrorListener.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/chunker/ChunkEvaluationErrorListener.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/chunker/ChunkerConverterTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/chunker/ChunkerConverterTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/chunker/ChunkerConverterTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/chunker/ChunkerConverterTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/chunker/ChunkerCrossValidatorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/chunker/ChunkerCrossValidatorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/chunker/ChunkerCrossValidatorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/chunker/ChunkerCrossValidatorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/chunker/ChunkerDetailedFMeasureListener.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/chunker/ChunkerDetailedFMeasureListener.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/chunker/ChunkerDetailedFMeasureListener.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/chunker/ChunkerDetailedFMeasureListener.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/chunker/ChunkerEvaluatorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/chunker/ChunkerEvaluatorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/chunker/ChunkerEvaluatorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/chunker/ChunkerEvaluatorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/chunker/ChunkerMETool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/chunker/ChunkerMETool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/chunker/ChunkerMETool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/chunker/ChunkerMETool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/chunker/ChunkerModelLoader.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/chunker/ChunkerModelLoader.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/chunker/ChunkerModelLoader.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/chunker/ChunkerModelLoader.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/chunker/ChunkerTrainerTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/chunker/ChunkerTrainerTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/chunker/ChunkerTrainerTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/chunker/ChunkerTrainerTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/chunker/TrainingParams.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/chunker/TrainingParams.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/chunker/TrainingParams.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/chunker/TrainingParams.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/dictionary/DictionaryBuilderParams.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/dictionary/DictionaryBuilderParams.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/dictionary/DictionaryBuilderParams.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/dictionary/DictionaryBuilderParams.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/dictionary/DictionaryBuilderTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/dictionary/DictionaryBuilderTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/dictionary/DictionaryBuilderTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/dictionary/DictionaryBuilderTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/doccat/DoccatConverterTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/doccat/DoccatConverterTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/doccat/DoccatConverterTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/doccat/DoccatConverterTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/doccat/DoccatCrossValidatorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/doccat/DoccatCrossValidatorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/doccat/DoccatCrossValidatorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/doccat/DoccatCrossValidatorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/doccat/DoccatEvaluationErrorListener.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/doccat/DoccatEvaluationErrorListener.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/doccat/DoccatEvaluationErrorListener.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/doccat/DoccatEvaluationErrorListener.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/doccat/DoccatEvaluatorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/doccat/DoccatEvaluatorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/doccat/DoccatEvaluatorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/doccat/DoccatEvaluatorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/doccat/DoccatFineGrainedReportListener.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/doccat/DoccatFineGrainedReportListener.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/doccat/DoccatFineGrainedReportListener.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/doccat/DoccatFineGrainedReportListener.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/doccat/DoccatModelLoader.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/doccat/DoccatModelLoader.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/doccat/DoccatModelLoader.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/doccat/DoccatModelLoader.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/doccat/DoccatTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/doccat/DoccatTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/doccat/DoccatTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/doccat/DoccatTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/doccat/DoccatTrainerTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/doccat/DoccatTrainerTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/doccat/DoccatTrainerTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/doccat/DoccatTrainerTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/doccat/TrainingParams.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/doccat/TrainingParams.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/doccat/TrainingParams.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/doccat/TrainingParams.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/entitylinker/EntityLinkerTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/entitylinker/EntityLinkerTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/entitylinker/EntityLinkerTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/entitylinker/EntityLinkerTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorConverterTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorConverterTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorConverterTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorConverterTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorCrossValidatorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorCrossValidatorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorCrossValidatorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorCrossValidatorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorEvaluationErrorListener.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorEvaluationErrorListener.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorEvaluationErrorListener.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorEvaluationErrorListener.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorEvaluatorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorEvaluatorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorEvaluatorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorEvaluatorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorFineGrainedReportListener.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorFineGrainedReportListener.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorFineGrainedReportListener.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorFineGrainedReportListener.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorModelLoader.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorModelLoader.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorModelLoader.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorModelLoader.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorTrainerTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorTrainerTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorTrainerTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/langdetect/LanguageDetectorTrainerTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/langdetect/TrainingParams.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/langdetect/TrainingParams.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/langdetect/TrainingParams.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/langdetect/TrainingParams.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/languagemodel/NGramLanguageModelTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/languagemodel/NGramLanguageModelTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/languagemodel/NGramLanguageModelTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/languagemodel/NGramLanguageModelTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmaEvaluationErrorListener.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmaEvaluationErrorListener.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmaEvaluationErrorListener.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmaEvaluationErrorListener.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerEvaluatorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerEvaluatorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerEvaluatorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerEvaluatorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerFineGrainedReportListener.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerFineGrainedReportListener.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerFineGrainedReportListener.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerFineGrainedReportListener.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerMETool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerMETool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerMETool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerMETool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerModelLoader.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerModelLoader.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerModelLoader.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerModelLoader.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerTrainerTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerTrainerTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerTrainerTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerTrainerTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/lemmatizer/TrainingParams.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/lemmatizer/TrainingParams.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/lemmatizer/TrainingParams.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/lemmatizer/TrainingParams.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/CensusDictionaryCreatorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/CensusDictionaryCreatorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/CensusDictionaryCreatorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/CensusDictionaryCreatorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/NameEvaluationErrorListener.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/NameEvaluationErrorListener.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/NameEvaluationErrorListener.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/NameEvaluationErrorListener.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/NameSampleCountersStream.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/NameSampleCountersStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/NameSampleCountersStream.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/NameSampleCountersStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderConverterTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderConverterTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderConverterTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderConverterTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderCrossValidatorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderCrossValidatorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderCrossValidatorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderCrossValidatorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderDetailedFMeasureListener.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderDetailedFMeasureListener.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderDetailedFMeasureListener.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderDetailedFMeasureListener.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderEvaluatorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderEvaluatorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderEvaluatorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderEvaluatorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderFineGrainedReportListener.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderFineGrainedReportListener.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderFineGrainedReportListener.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderFineGrainedReportListener.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderModelLoader.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderModelLoader.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderModelLoader.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderModelLoader.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderTrainerTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderTrainerTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderTrainerTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderTrainerTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TrainingParams.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/TrainingParams.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TrainingParams.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/namefind/TrainingParams.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/BuildModelUpdaterTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/BuildModelUpdaterTool.java
similarity index 95%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/BuildModelUpdaterTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/BuildModelUpdaterTool.java
index cef866260..2646da753 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/BuildModelUpdaterTool.java
+++ b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/BuildModelUpdaterTool.java
@@ -32,6 +32,7 @@
import opennlp.tools.parser.ParserModel;
import opennlp.tools.parser.chunking.ParserEventStream;
import opennlp.tools.util.ObjectStream;
+import opennlp.tools.util.TrainingParameters;
import opennlp.tools.util.model.ModelUtil;
public final class BuildModelUpdaterTool extends ModelUpdaterTool {
@@ -57,7 +58,7 @@ protected ParserModel trainAndUpdate(ParserModel originalModel,
ObjectStream bes = new ParserEventStream(parseSamples,
originalModel.getHeadRules(), ParserEventTypeEnum.BUILD, mdict);
- EventTrainer trainer = TrainerFactory.getEventTrainer(
+ EventTrainer trainer = TrainerFactory.getEventTrainer(
ModelUtil.createDefaultTrainingParameters(), null);
MaxentModel buildModel = trainer.train(bes);
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/CheckModelUpdaterTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/CheckModelUpdaterTool.java
similarity index 95%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/CheckModelUpdaterTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/CheckModelUpdaterTool.java
index 590f4b0a8..7ceb9b082 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/CheckModelUpdaterTool.java
+++ b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/CheckModelUpdaterTool.java
@@ -32,6 +32,7 @@
import opennlp.tools.parser.ParserModel;
import opennlp.tools.parser.chunking.ParserEventStream;
import opennlp.tools.util.ObjectStream;
+import opennlp.tools.util.TrainingParameters;
import opennlp.tools.util.model.ModelUtil;
/**
@@ -61,7 +62,7 @@ protected ParserModel trainAndUpdate(ParserModel originalModel,
ObjectStream bes = new ParserEventStream(parseSamples,
originalModel.getHeadRules(), ParserEventTypeEnum.CHECK, mdict);
- EventTrainer trainer = TrainerFactory.getEventTrainer(
+ EventTrainer trainer = TrainerFactory.getEventTrainer(
ModelUtil.createDefaultTrainingParameters(), null);
MaxentModel checkModel = trainer.train(bes);
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/ModelUpdaterTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/ModelUpdaterTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/ModelUpdaterTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/ModelUpdaterTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/ParserConverterTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/ParserConverterTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/ParserConverterTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/ParserConverterTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/ParserEvaluatorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/ParserEvaluatorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/ParserEvaluatorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/ParserEvaluatorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/ParserModelLoader.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/ParserModelLoader.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/ParserModelLoader.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/ParserModelLoader.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/ParserTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/ParserTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/ParserTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/ParserTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/ParserTrainerTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/ParserTrainerTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/ParserTrainerTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/ParserTrainerTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/TaggerModelReplacerTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/TaggerModelReplacerTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/TaggerModelReplacerTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/TaggerModelReplacerTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/TrainingParams.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/TrainingParams.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/TrainingParams.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/parser/TrainingParams.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/postag/POSEvaluationErrorListener.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/postag/POSEvaluationErrorListener.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/postag/POSEvaluationErrorListener.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/postag/POSEvaluationErrorListener.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/postag/POSModelLoader.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/postag/POSModelLoader.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/postag/POSModelLoader.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/postag/POSModelLoader.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/postag/POSTaggerConverterTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/postag/POSTaggerConverterTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/postag/POSTaggerConverterTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/postag/POSTaggerConverterTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/postag/POSTaggerCrossValidatorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/postag/POSTaggerCrossValidatorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/postag/POSTaggerCrossValidatorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/postag/POSTaggerCrossValidatorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/postag/POSTaggerEvaluatorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/postag/POSTaggerEvaluatorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/postag/POSTaggerEvaluatorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/postag/POSTaggerEvaluatorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/postag/POSTaggerFineGrainedReportListener.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/postag/POSTaggerFineGrainedReportListener.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/postag/POSTaggerFineGrainedReportListener.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/postag/POSTaggerFineGrainedReportListener.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/postag/POSTaggerTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/postag/POSTaggerTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/postag/POSTaggerTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/postag/POSTaggerTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/postag/POSTaggerTrainerTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/postag/POSTaggerTrainerTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/postag/POSTaggerTrainerTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/postag/POSTaggerTrainerTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/postag/TrainingParams.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/postag/TrainingParams.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/postag/TrainingParams.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/postag/TrainingParams.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceDetectorConverterTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceDetectorConverterTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceDetectorConverterTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceDetectorConverterTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceDetectorCrossValidatorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceDetectorCrossValidatorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceDetectorCrossValidatorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceDetectorCrossValidatorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceDetectorEvaluatorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceDetectorEvaluatorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceDetectorEvaluatorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceDetectorEvaluatorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceDetectorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceDetectorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceDetectorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceDetectorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceDetectorTrainerTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceDetectorTrainerTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceDetectorTrainerTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceDetectorTrainerTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceEvaluationErrorListener.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceEvaluationErrorListener.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceEvaluationErrorListener.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceEvaluationErrorListener.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceModelLoader.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceModelLoader.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceModelLoader.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/sentdetect/SentenceModelLoader.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/sentdetect/TrainingParams.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/sentdetect/TrainingParams.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/sentdetect/TrainingParams.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/sentdetect/TrainingParams.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/CommandLineTokenizer.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/CommandLineTokenizer.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/CommandLineTokenizer.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/CommandLineTokenizer.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/DetokenEvaluationErrorListener.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/DetokenEvaluationErrorListener.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/DetokenEvaluationErrorListener.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/DetokenEvaluationErrorListener.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/DetokenizationDictionaryLoader.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/DetokenizationDictionaryLoader.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/DetokenizationDictionaryLoader.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/DetokenizationDictionaryLoader.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/DictionaryDetokenizerTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/DictionaryDetokenizerTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/DictionaryDetokenizerTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/DictionaryDetokenizerTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/SimpleTokenizerTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/SimpleTokenizerTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/SimpleTokenizerTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/SimpleTokenizerTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/TokenEvaluationErrorListener.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/TokenEvaluationErrorListener.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/TokenEvaluationErrorListener.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/TokenEvaluationErrorListener.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerConverterTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerConverterTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerConverterTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerConverterTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerCrossValidatorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerCrossValidatorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerCrossValidatorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerCrossValidatorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerMEEvaluatorTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerMEEvaluatorTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerMEEvaluatorTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerMEEvaluatorTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerMETool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerMETool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerMETool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerMETool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerModelLoader.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerModelLoader.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerModelLoader.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerModelLoader.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerTrainerTool.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerTrainerTool.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerTrainerTool.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/TokenizerTrainerTool.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/TrainingParams.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/TrainingParams.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/TrainingParams.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/cmdline/tokenizer/TrainingParams.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/parser/ParserEvaluator.java b/opennlp-core/opennlp-cli/src/main/java/opennlp/tools/parser/ParserEvaluator.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/parser/ParserEvaluator.java
rename to opennlp-core/opennlp-cli/src/main/java/opennlp/tools/parser/ParserEvaluator.java
diff --git a/opennlp-core/opennlp-cli/src/main/resources/opennlp/tools/util/opennlp.version b/opennlp-core/opennlp-cli/src/main/resources/opennlp/tools/util/opennlp.version
new file mode 100644
index 000000000..70bfa1078
--- /dev/null
+++ b/opennlp-core/opennlp-cli/src/main/resources/opennlp/tools/util/opennlp.version
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreemnets. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Version is injected by the maven build, fall back version is 0.0.0-SNAPSHOT
+OpenNLP-Version: ${project.version}
\ No newline at end of file
diff --git a/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/AbstractLoggerTest.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/AbstractLoggerTest.java
new file mode 100644
index 000000000..79c944c5b
--- /dev/null
+++ b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/AbstractLoggerTest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package opennlp.tools;
+
+import java.util.Objects;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * An abstract class to configure the {@link Logger} instance to help with unit-testing.
+ */
+public abstract class AbstractLoggerTest {
+
+ public static final String LOGGER_OPENNLP = "opennlp";
+
+ /**
+ * Prepare the logging resource.
+ * @param loggerName Name of the {@link Logger}.
+ */
+ public static void prepare(String loggerName) {
+ getLogger(loggerName).setLevel(Level.INFO);
+ }
+
+ /*
+ * Restores the logging resource to its default config.
+ */
+ public static void restore(String loggerName) {
+ getLogger(loggerName).setLevel(Level.OFF);
+ }
+
+ private static Logger getLogger(String loggerName) {
+ Logger logger = (Logger) LoggerFactory.getLogger(loggerName);
+ if (Objects.isNull(logger)) {
+ throw new IllegalArgumentException("A logger instance couldn't be created for the given logger "
+ + loggerName);
+ }
+ return logger;
+ }
+}
+
diff --git a/opennlp-tools/src/test/java/opennlp/tools/AbstractModelLoaderTest.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/AbstractModelLoaderTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/AbstractModelLoaderTest.java
rename to opennlp-core/opennlp-cli/src/test/java/opennlp/tools/AbstractModelLoaderTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/AbstractTempDirTest.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/AbstractTempDirTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/AbstractTempDirTest.java
rename to opennlp-core/opennlp-cli/src/test/java/opennlp/tools/AbstractTempDirTest.java
diff --git a/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/EnabledWhenCDNAvailable.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/EnabledWhenCDNAvailable.java
new file mode 100644
index 000000000..fccc55266
--- /dev/null
+++ b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/EnabledWhenCDNAvailable.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package opennlp.tools;
+
+import java.io.IOException;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.URL;
+import javax.net.ssl.HttpsURLConnection;
+
+import org.junit.jupiter.api.extension.ConditionEvaluationResult;
+import org.junit.jupiter.api.extension.ExecutionCondition;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+import static org.junit.platform.commons.util.AnnotationUtils.findAnnotation;
+
+/**
+ * A custom JUnit5 conditional annotation which can be used to enable/disable tests at runtime.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@ExtendWith(EnabledWhenCDNAvailable.CDNAvailableCondition.class)
+public @interface EnabledWhenCDNAvailable {
+
+ String hostname();
+
+ int TIMEOUT_MS = 2000;
+
+ // JUnit5 execution condition to decide whether tests can assume CDN downloads are possible (= online).
+ class CDNAvailableCondition implements ExecutionCondition {
+
+ @Override
+ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
+ final var optional = findAnnotation(context.getElement(), EnabledWhenCDNAvailable.class);
+ if (optional.isPresent()) {
+ final EnabledWhenCDNAvailable annotation = optional.get();
+ final String host = annotation.hostname();
+ try (Socket socket = new Socket()) {
+ // First, try to establish a socket connection to ensure the host is reachable
+ socket.connect(new InetSocketAddress(host, 443), TIMEOUT_MS);
+
+ // Then, try to check the HTTP status by making an HTTPS request
+ final URL url = new URL("https://" + host);
+ final HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
+ connection.setConnectTimeout(TIMEOUT_MS);
+ connection.setReadTimeout(TIMEOUT_MS);
+ int statusCode = connection.getResponseCode();
+
+ // If the HTTP status code indicates success (2xx range), return enabled
+ if (statusCode >= 200 && statusCode < 300) {
+ return ConditionEvaluationResult.enabled(
+ "Resource (CDN) reachable with status code: " + statusCode);
+ } else {
+ return ConditionEvaluationResult.disabled(
+ "Resource (CDN) reachable, but HTTP status code: " + statusCode);
+
+ }
+ } catch (IOException e) {
+ return ConditionEvaluationResult.disabled(
+ "Resource (CDN) unreachable.");
+ }
+ }
+ return ConditionEvaluationResult.enabled(
+ "Nothing annotated with EnabledWhenCDNAvailable.");
+ }
+ }
+
+}
diff --git a/opennlp-tools/src/test/java/opennlp/tools/cmdline/ArgumentParserTest.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/ArgumentParserTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/cmdline/ArgumentParserTest.java
rename to opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/ArgumentParserTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/cmdline/CLITest.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/CLITest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/cmdline/CLITest.java
rename to opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/CLITest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/cmdline/TerminateToolExceptionTest.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/TerminateToolExceptionTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/cmdline/TerminateToolExceptionTest.java
rename to opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/TerminateToolExceptionTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/cmdline/TokenNameFinderToolTest.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/TokenNameFinderToolTest.java
similarity index 97%
rename from opennlp-tools/src/test/java/opennlp/tools/cmdline/TokenNameFinderToolTest.java
rename to opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/TokenNameFinderToolTest.java
index 190fa9d97..da3d9e1fa 100644
--- a/opennlp-tools/src/test/java/opennlp/tools/cmdline/TokenNameFinderToolTest.java
+++ b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/TokenNameFinderToolTest.java
@@ -44,6 +44,7 @@
import opennlp.tools.namefind.TokenNameFinderModel;
import opennlp.tools.util.MockInputStreamFactory;
import opennlp.tools.util.ObjectStream;
+import opennlp.tools.util.Parameters;
import opennlp.tools.util.PlainTextByLineStream;
import opennlp.tools.util.TrainingParameters;
@@ -127,8 +128,8 @@ private File trainModel() throws IOException {
StandardCharsets.ISO_8859_1);
TrainingParameters params = new TrainingParameters();
- params.put(TrainingParameters.ITERATIONS_PARAM, 70);
- params.put(TrainingParameters.CUTOFF_PARAM, 1);
+ params.put(Parameters.ITERATIONS_PARAM, 70);
+ params.put(Parameters.CUTOFF_PARAM, 1);
TokenNameFinderModel model;
TokenNameFinderFactory nameFinderFactory = new TokenNameFinderFactory();
diff --git a/opennlp-tools/src/test/java/opennlp/tools/cmdline/chunker/ChunkerModelLoaderTest.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/chunker/ChunkerModelLoaderTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/cmdline/chunker/ChunkerModelLoaderTest.java
rename to opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/chunker/ChunkerModelLoaderTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/cmdline/langdetect/LanguageDetectorModelLoaderTest.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/langdetect/LanguageDetectorModelLoaderTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/cmdline/langdetect/LanguageDetectorModelLoaderTest.java
rename to opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/langdetect/LanguageDetectorModelLoaderTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/cmdline/languagemodel/NGramLanguageModelToolTest.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/languagemodel/NGramLanguageModelToolTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/cmdline/languagemodel/NGramLanguageModelToolTest.java
rename to opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/languagemodel/NGramLanguageModelToolTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/cmdline/lemmatizer/LemmatizerModelLoaderIT.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/lemmatizer/LemmatizerModelLoaderIT.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/cmdline/lemmatizer/LemmatizerModelLoaderIT.java
rename to opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/lemmatizer/LemmatizerModelLoaderIT.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/cmdline/namefind/TokenNameFinderModelLoaderTest.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/namefind/TokenNameFinderModelLoaderTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/cmdline/namefind/TokenNameFinderModelLoaderTest.java
rename to opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/namefind/TokenNameFinderModelLoaderTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/cmdline/namefind/generator/AbstractNewsGenerator.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/namefind/generator/AbstractNewsGenerator.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/cmdline/namefind/generator/AbstractNewsGenerator.java
rename to opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/namefind/generator/AbstractNewsGenerator.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/cmdline/namefind/generator/RandomEnglishNewsGenerator.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/namefind/generator/RandomEnglishNewsGenerator.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/cmdline/namefind/generator/RandomEnglishNewsGenerator.java
rename to opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/namefind/generator/RandomEnglishNewsGenerator.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/cmdline/namefind/generator/RandomGermanNewsGenerator.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/namefind/generator/RandomGermanNewsGenerator.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/cmdline/namefind/generator/RandomGermanNewsGenerator.java
rename to opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/namefind/generator/RandomGermanNewsGenerator.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/cmdline/postag/POSModelLoaderIT.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/postag/POSModelLoaderIT.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/cmdline/postag/POSModelLoaderIT.java
rename to opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/postag/POSModelLoaderIT.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/cmdline/sentdetect/SentenceModelLoaderIT.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/sentdetect/SentenceModelLoaderIT.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/cmdline/sentdetect/SentenceModelLoaderIT.java
rename to opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/sentdetect/SentenceModelLoaderIT.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/cmdline/tokenizer/TokenizerModelLoaderIT.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/tokenizer/TokenizerModelLoaderIT.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/cmdline/tokenizer/TokenizerModelLoaderIT.java
rename to opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/tokenizer/TokenizerModelLoaderIT.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/cmdline/tokenizer/TokenizerTrainerToolTest.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/tokenizer/TokenizerTrainerToolTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/cmdline/tokenizer/TokenizerTrainerToolTest.java
rename to opennlp-core/opennlp-cli/src/test/java/opennlp/tools/cmdline/tokenizer/TokenizerTrainerToolTest.java
diff --git a/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/util/MockInputStreamFactory.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/util/MockInputStreamFactory.java
new file mode 100644
index 000000000..79aedc3ea
--- /dev/null
+++ b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/util/MockInputStreamFactory.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package opennlp.tools.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+
+public class MockInputStreamFactory implements InputStreamFactory {
+
+ private final File inputSourceFile;
+ private final String inputSourceStr;
+ private final Charset charset;
+
+ public MockInputStreamFactory(File file) {
+ this.inputSourceFile = file;
+ this.inputSourceStr = null;
+ this.charset = null;
+ }
+
+ public MockInputStreamFactory(String str) {
+ this(str, StandardCharsets.UTF_8);
+ }
+
+ public MockInputStreamFactory(String str, Charset charset) {
+ this.inputSourceFile = null;
+ this.inputSourceStr = str;
+ this.charset = charset;
+ }
+
+ @Override
+ public InputStream createInputStream() {
+ if (inputSourceFile != null) {
+ return getClass().getClassLoader().getResourceAsStream(inputSourceFile.getPath());
+ }
+ else {
+ return new ByteArrayInputStream(inputSourceStr.getBytes(charset));
+ }
+ }
+}
diff --git a/opennlp-core/opennlp-cli/src/test/resources/logback-test.xml b/opennlp-core/opennlp-cli/src/test/resources/logback-test.xml
new file mode 100644
index 000000000..1baae2912
--- /dev/null
+++ b/opennlp-core/opennlp-cli/src/test/resources/logback-test.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+ %date{HH:mm:ss.SSS} [%thread] %-4level %class{36}.%method:%line - %msg%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/cmdline/languagemodel/origin_of_text_samples.txt b/opennlp-core/opennlp-cli/src/test/resources/opennlp/tools/cmdline/languagemodel/origin_of_text_samples.txt
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/cmdline/languagemodel/origin_of_text_samples.txt
rename to opennlp-core/opennlp-cli/src/test/resources/opennlp/tools/cmdline/languagemodel/origin_of_text_samples.txt
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/cmdline/languagemodel/sentences_set_1.txt b/opennlp-core/opennlp-cli/src/test/resources/opennlp/tools/cmdline/languagemodel/sentences_set_1.txt
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/cmdline/languagemodel/sentences_set_1.txt
rename to opennlp-core/opennlp-cli/src/test/resources/opennlp/tools/cmdline/languagemodel/sentences_set_1.txt
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/cmdline/languagemodel/sentences_set_2.txt b/opennlp-core/opennlp-cli/src/test/resources/opennlp/tools/cmdline/languagemodel/sentences_set_2.txt
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/cmdline/languagemodel/sentences_set_2.txt
rename to opennlp-core/opennlp-cli/src/test/resources/opennlp/tools/cmdline/languagemodel/sentences_set_2.txt
diff --git a/opennlp-core/opennlp-cli/src/test/resources/opennlp/tools/namefind/AnnotatedSentencesWithTypes.txt b/opennlp-core/opennlp-cli/src/test/resources/opennlp/tools/namefind/AnnotatedSentencesWithTypes.txt
new file mode 100644
index 000000000..92036b7c6
--- /dev/null
+++ b/opennlp-core/opennlp-cli/src/test/resources/opennlp/tools/namefind/AnnotatedSentencesWithTypes.txt
@@ -0,0 +1,130 @@
+Last September, I tried to find out the address of an old school friend whom I hadnt't seen for 15 years.
+I just knew his name , Alan McKennedy , and I'd heard the rumour that he'd moved to Scotland, the country of his ancestors.
+So I called Julie , a friend who's still in contact with him.
+She told me that he lived in 23213 Edinburgh, Worcesterstreet 12.
+I wrote him a letter right away and he answered soon, sounding very happy and delighted.
+
+Last year, I wanted to write a letter to my grandaunt.
+Her 86th birthday was on October 6, and I no longer wanted to be hesitant to get in touch with her.
+I didn`t know her face-to-face, and so it wasn't easy for me to find out her address.
+As she had two apartments in different countries, I decided to write to both.
+The first was in 12424 Paris in Rue-de-Grandes-Illusions 5.
+But Marie Clara , as my aunt is called, prefered her apartment in Berlin.
+It's postcode is 30202. She lived there, in beautiful Kaiserstraße 13, particulary in summer.
+
+Hi my name is Stefanie Schmidt , how much is a taxi from Ostbahnhof to Hauptbahnhof?
+About 10 Euro, I reckon.
+That sounds good.
+So please call a driver to Leonardstraße 112, near the Ostbahnhof in 56473 Hamburg.
+I'd like to be at Silberhornstraße 12 as soon as possible.
+Thank you very much!
+
+Hi Mike , it's Stefanie Schmidt .
+I'm in Nürnberg at the moment and I've got the problem that my bike has broken.
+Could you please pick me up from Seidlstraße 56, I'm in the Cafe "Mondnacht" at the moment.
+Please hurry up, I need to be back in Ulm at 8 p.m.!
+
+My husband George and me recently celebrated our 10th wedding anniversary.
+We got married on March 11, 1995.
+Therefore, we found a photo album with pictures of our first own apartment, which was in 81234 Munich.
+As a young married couple, we didn't have enough money to afford a bigger lodge than this one in Blumenweg 1.
+But only five years later, my husband was offered a well-payed job in 17818 Hamburg, so we moved there.
+Since then, our guests have to ring at Veilchenstraße 11 if they want to visit us, Luise and George Bauer .
+
+I read your help-wanted ad with great attention.
+I'm a student of informatics, 6th semester, and I'm very interested in your part-time job offer.
+I have a competent knowledge of programming and foreign languages, like French and Italian.
+I'm looking forward to your reply.
+
+ Alisa Fernandes , a tourist from Spain, went to the reception desk of the famous Highfly-Hotel in 30303 Berlin.
+As she felt quite homesick, she asked the staff if they knew a good Spanish restaurant in Berlin.
+The concierge told her to go to the "Tapasbar" in Chesterstr. 2.
+ Alisa appreciated the hint and enjoyed a delicious traditional meal.
+
+An old friend from France is currently travelling around Europe.
+Yesterday, she arrived in Berlin and we met up spontaneously.
+She wanted me to show her some famous sights, like the Brandenburger Tor and the Reichstag.
+But it wasn't easy to meet up in the city because she hardly knows any streetname or building.
+So I proposed to meet at a quite local point: the cafe "Daily's" in Unter-den-Linden 18, 30291 Berlin.
+It is five minutes away from the underground station "Westbad".
+She found it instantly and we spent a great day in the capital.
+
+Where did you get those great shoes?
+They look amazing, I love the colour.
+Are they made of leather?
+No, that's faked.
+But anyway, I like them too. I got them from Hamburg.
+Don't you know the famous shop in Veilchenstraße?
+It's called "Twentytwo".
+I've never heard of that before.
+Could you give me the complete address?
+Sure, it's in Veilchenstraße 12, in 78181 Hamburg.
+I deem it best to write a letter to the owner if the shoes are still available.
+His name is Gerhard Fritsch.
+
+Hi, am I talking to the inquiries?
+My name is Mike Sander and I'd like to know if it is possible to get information about an address if I merely know the name and the phone number of a person!
+How is he or she called?
+His name is Stefan Miller and his number is the 030/827234.
+I'll have a look in the computer... I found a Stefan Miller who lives in Leipzig. Is that right?
+Yes, it definitely is.
+So Stefan Miller lives in Heinrich-Heine-Straße 112, in 20193 Leipzig.
+Thank you very much for the information.
+Bye!
+
+On July 14, the father of a family got painfully injured after he had tried to start a barbecue.
+The flaring flames burnt instantly through his jacket, which he managed to pull off last-minute.
+Although the wounds weren't life-threatening, it was urgent to bring him directly into ambulance.
+But the only hospital that had opened that Sunday was the Paracelsus Hospital in 83939 Weilheim, which was 2 hours away.
+Convulsed with pain, the man finally arrived in Stifterstraße 15, where the personal immediately took care of him.
+
+Last year, I worked as a delivery boy for a small local magazine.
+I worked in the area of 83454 Ottobrunn.
+I had a list with the home addresses of our costumers whom I brought their papers once a week.
+An elderly lady, who was called Elenor Meier , lived in Gärtnerweg 6, and I always drove there first, because I liked her the most.
+Afterwards, I went to a student, Gina Schneider , who lived still in her parent's house in Gärtnerweg 25.
+The last in line was the retired teacher Bruno Schulz in Dramenstraße 15.
+He was friendly enough to tip sometimes.
+
+Our business company was founded in 1912 by the singer and entertainer Michel Seile .
+He opened the first agency in Erding, a small town near Munich.
+Now, more than 90 years of turbulent ups and downs later, we finally decided to situate our company in a more central and frequented area.
+Last year, we moved into an empty factory building in 30303 Berlin.
+It is located in Barmerstr. 34.
+
+When George Miller , a tourist from England, came to Munich, he had no idea how to read the city maps.
+He depended completely on the help and information of German pedestrians.
+One day, he simply could not find the famous Lenbachhaus.
+So he asked a young woman for help.
+She pointed at a street sign and explained to him that he'd find the Lenbachhaus in Luisenstraße 33, which is in 80333 Munich.
+ Miller was very grateful and could finally enjoy the exhibition.
+
+On March 15, there was an accident near Munich.
+The driver got badly injured.
+Driving alone not far from her home, the middle-aged woman crashed at high speed into a tree.
+A resident, who lives near the street where the accident took place, called instantly the police.
+He reported what had happened and gave his name and address to the officer.
+He's called Peter Schubert and he lives at Max-Löw-Straße 13 in 84630 Gauting.
+The police arrived ten minutes later and brought the woman into hospital.
+Although she had multiple trauma, she's out of mortal danger.
+
+Hi, how are you?
+Arent't you a friend of Natalie ?
+Yeah for sure. How did you know that?
+I saw you sitting next to her at uni.
+Yeah she's my best friend.
+Are you going to her party next friday?
+Oh yes, I'd really like to.
+But in fact I don't know yet where it takes place.
+I can tell you: ring at Baumann, Meisenstraße 5, in 81737 Munich.
+The party starts at 9 p.m..
+I hope you'll find it.
+Thank you very much, see you next friday!
+
+My name is Michael Hinterhofer .
+When I was 21, I moved out from my parents' home into my first own appartment in order to study in a bigger city.
+My new home was in Lilienstraße 1 in 25334 Hamburg.
+But I realized quickly that life in a metropolis wasn't relaxed enough for me.
+So I decided to move into a smaller town.
+Now I'm a tenant with an elderly widow. We live in Bürgerstraße 2 in 63737 Heidelberg.
+I really like the smalltown flair and my studies at Heidelberg's notable university.
diff --git a/opennlp-core/opennlp-formats/pom.xml b/opennlp-core/opennlp-formats/pom.xml
new file mode 100644
index 000000000..349c72829
--- /dev/null
+++ b/opennlp-core/opennlp-formats/pom.xml
@@ -0,0 +1,115 @@
+
+
+ 4.0.0
+
+ org.apache.opennlp
+ opennlp-core
+ 3.0.0-SNAPSHOT
+
+
+ opennlp-formats
+ jar
+ Apache OpenNLP Core Formats
+
+
+
+
+ opennlp-api
+ ${project.groupId}
+
+
+ opennlp-runtime
+ ${project.groupId}
+
+
+
+
+ org.slf4j
+ slf4j-api
+
+
+
+
+
+ opennlp-ml-perceptron
+ ${project.groupId}
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-params
+ test
+
+
+
+
+ com.ginsberg
+ junit5-system-exit
+ ${junit5-system-exit.version}
+ test
+
+
+
+ io.github.hakky54
+ logcaptor
+ ${logcaptor.version}
+ test
+
+
+
+
+
+
+ src/main/resources
+ true
+
+
+
+
+ maven-javadoc-plugin
+
+ opennlp.tools.cmdline
+
+
+
+ create-javadoc-jar
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ -Xmx2048m -DOPENNLP_DOWNLOAD_HOME=${opennlp.download.home} -javaagent:${settings.localRepository}/com/ginsberg/junit5-system-exit/${junit5-system-exit.version}/junit5-system-exit-${junit5-system-exit.version}.jar
+ ${opennlp.forkCount}
+ false
+
+ **/stemmer/*
+ **/stemmer/snowball/*
+ **/*IT.java
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+
+
+
+
+
+
\ No newline at end of file
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/StreamFactoryRegistry.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/cmdline/StreamFactoryRegistry.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/cmdline/StreamFactoryRegistry.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/cmdline/StreamFactoryRegistry.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/AbstractSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/AbstractSampleStreamFactory.java
similarity index 89%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/AbstractSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/AbstractSampleStreamFactory.java
index da9a36d18..8a92d45ae 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/AbstractSampleStreamFactory.java
+++ b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/AbstractSampleStreamFactory.java
@@ -20,8 +20,8 @@
import java.io.IOException;
import opennlp.tools.cmdline.ArgumentParser;
-import opennlp.tools.cmdline.CmdLineUtil;
import opennlp.tools.cmdline.ObjectStreamFactory;
+import opennlp.tools.cmdline.TerminateToolException;
import opennlp.tools.cmdline.params.BasicFormatParams;
import opennlp.tools.util.InputStreamFactory;
import opennlp.tools.util.ObjectStream;
@@ -61,10 +61,11 @@ protected
P validateBasicFormatParameters(String[]
throw new IllegalArgumentException("Passed args must not be null!");
}
P params = ArgumentParser.parse(args, clazz);
- CmdLineUtil.checkInputFile("Data", params.getData());
+ FormatUtil.checkInputFile("Data", params.getData());
return params;
}
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/BioNLP2004NameSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/BioNLP2004NameSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/BioNLP2004NameSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/BioNLP2004NameSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/BioNLP2004NameSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/BioNLP2004NameSampleStreamFactory.java
similarity index 91%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/BioNLP2004NameSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/BioNLP2004NameSampleStreamFactory.java
index 0b7bfe3cf..f43d09cd7 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/BioNLP2004NameSampleStreamFactory.java
+++ b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/BioNLP2004NameSampleStreamFactory.java
@@ -20,8 +20,8 @@
import java.io.IOException;
import opennlp.tools.cmdline.ArgumentParser.ParameterDescription;
-import opennlp.tools.cmdline.CmdLineUtil;
import opennlp.tools.cmdline.StreamFactoryRegistry;
+import opennlp.tools.cmdline.TerminateToolException;
import opennlp.tools.cmdline.params.BasicFormatParams;
import opennlp.tools.namefind.NameSample;
import opennlp.tools.util.ObjectStream;
@@ -75,10 +75,10 @@ public ObjectStream create(String[] args) {
try {
return new BioNLP2004NameSampleStream(
- CmdLineUtil.createInputStreamFactory(params.getData()), typesToGenerate);
+ FormatUtil.createInputStreamFactory(params.getData()), typesToGenerate);
} catch (IOException ex) {
- CmdLineUtil.handleCreateObjectStreamError(ex);
+ throw new TerminateToolException(-1,
+ "IO Error while creating an Input Stream: " + ex.getMessage(), ex);
}
- return null;
}
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ChunkerSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ChunkerSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ChunkerSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ChunkerSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/Conll02NameSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/Conll02NameSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/Conll02NameSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/Conll02NameSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/Conll02NameSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/Conll02NameSampleStreamFactory.java
similarity index 94%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/Conll02NameSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/Conll02NameSampleStreamFactory.java
index 91cca6671..47c0db4d1 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/Conll02NameSampleStreamFactory.java
+++ b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/Conll02NameSampleStreamFactory.java
@@ -20,7 +20,6 @@
import java.io.IOException;
import opennlp.tools.cmdline.ArgumentParser.ParameterDescription;
-import opennlp.tools.cmdline.CmdLineUtil;
import opennlp.tools.cmdline.StreamFactoryRegistry;
import opennlp.tools.cmdline.TerminateToolException;
import opennlp.tools.cmdline.params.BasicFormatParams;
@@ -95,9 +94,10 @@ else if ("es".equals(params.getLang()) || "spa".equals(params.getLang())) {
try {
return new Conll02NameSampleStream(lang,
- CmdLineUtil.createInputStreamFactory(params.getData()), typesToGenerate);
+ FormatUtil.createInputStreamFactory(params.getData()), typesToGenerate);
} catch (IOException e) {
- throw CmdLineUtil.createObjectStreamError(e);
+ throw new TerminateToolException(-1,
+ "IO Error while creating an Input Stream: " + e.getMessage(), e);
}
}
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/Conll03NameSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/Conll03NameSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/Conll03NameSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/Conll03NameSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/Conll03NameSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/Conll03NameSampleStreamFactory.java
similarity index 93%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/Conll03NameSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/Conll03NameSampleStreamFactory.java
index d1a615092..b2741169c 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/Conll03NameSampleStreamFactory.java
+++ b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/Conll03NameSampleStreamFactory.java
@@ -20,7 +20,6 @@
import java.io.IOException;
import opennlp.tools.cmdline.ArgumentParser.ParameterDescription;
-import opennlp.tools.cmdline.CmdLineUtil;
import opennlp.tools.cmdline.StreamFactoryRegistry;
import opennlp.tools.cmdline.TerminateToolException;
import opennlp.tools.cmdline.params.BasicFormatParams;
@@ -91,9 +90,10 @@ else if ("deu".equals(params.getLang())) {
try {
return new Conll03NameSampleStream(lang,
- CmdLineUtil.createInputStreamFactory(params.getData()), typesToGenerate);
+ FormatUtil.createInputStreamFactory(params.getData()), typesToGenerate);
} catch (IOException e) {
- throw CmdLineUtil.createObjectStreamError(e);
+ throw new TerminateToolException(-1,
+ "IO Error while creating an Input Stream: " + e.getMessage(), e);
}
}
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ConllXPOSSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ConllXPOSSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ConllXPOSSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ConllXPOSSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ConllXPOSSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ConllXPOSSampleStreamFactory.java
similarity index 88%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ConllXPOSSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ConllXPOSSampleStreamFactory.java
index a7a586d9b..a1fc0aafe 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/ConllXPOSSampleStreamFactory.java
+++ b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ConllXPOSSampleStreamFactory.java
@@ -20,8 +20,8 @@
import java.io.IOException;
import java.nio.charset.StandardCharsets;
-import opennlp.tools.cmdline.CmdLineUtil;
import opennlp.tools.cmdline.StreamFactoryRegistry;
+import opennlp.tools.cmdline.TerminateToolException;
import opennlp.tools.cmdline.params.BasicFormatParams;
import opennlp.tools.commons.Internal;
import opennlp.tools.postag.POSSample;
@@ -58,11 +58,11 @@ public ObjectStream create(String[] args) {
Parameters params = validateBasicFormatParameters(args, Parameters.class);
try {
- InputStreamFactory inFactory = CmdLineUtil.createInputStreamFactory(params.getData());
+ InputStreamFactory inFactory = FormatUtil.createInputStreamFactory(params.getData());
return new ConllXPOSSampleStream(inFactory, StandardCharsets.UTF_8);
} catch (IOException e) {
- CmdLineUtil.handleCreateObjectStreamError(e);
- return null;
+ throw new TerminateToolException(-1,
+ "IO Error while creating an Input Stream: " + e.getMessage(), e);
}
}
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ConllXSentenceSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ConllXSentenceSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ConllXSentenceSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ConllXSentenceSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ConllXTokenSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ConllXTokenSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ConllXTokenSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ConllXTokenSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/DetokenizerSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/DetokenizerSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/DetokenizerSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/DetokenizerSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/DirectorySampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/DirectorySampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/DirectorySampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/DirectorySampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/DocumentSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/DocumentSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/DocumentSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/DocumentSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/EvalitaNameSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/EvalitaNameSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/EvalitaNameSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/EvalitaNameSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/EvalitaNameSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/EvalitaNameSampleStreamFactory.java
similarity index 93%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/EvalitaNameSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/EvalitaNameSampleStreamFactory.java
index 066861f30..771cfbab1 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/EvalitaNameSampleStreamFactory.java
+++ b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/EvalitaNameSampleStreamFactory.java
@@ -20,7 +20,6 @@
import java.io.IOException;
import opennlp.tools.cmdline.ArgumentParser.ParameterDescription;
-import opennlp.tools.cmdline.CmdLineUtil;
import opennlp.tools.cmdline.StreamFactoryRegistry;
import opennlp.tools.cmdline.TerminateToolException;
import opennlp.tools.cmdline.params.BasicFormatParams;
@@ -91,9 +90,10 @@ public ObjectStream create(String[] args) {
try {
return new EvalitaNameSampleStream(lang,
- CmdLineUtil.createInputStreamFactory(params.getData()), typesToGenerate);
+ FormatUtil.createInputStreamFactory(params.getData()), typesToGenerate);
} catch (IOException e) {
- throw CmdLineUtil.createObjectStreamError(e);
+ throw new TerminateToolException(-1,
+ "IO Error while creating an Input Stream: " + e.getMessage(), e);
}
}
}
diff --git a/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/FormatUtil.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/FormatUtil.java
new file mode 100644
index 000000000..ce95e61d0
--- /dev/null
+++ b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/FormatUtil.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package opennlp.tools.formats;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import opennlp.tools.cmdline.TerminateToolException;
+import opennlp.tools.commons.Internal;
+import opennlp.tools.util.InputStreamFactory;
+import opennlp.tools.util.MarkableFileInputStreamFactory;
+
+/**
+ * Utility class for the OpenNLP formats package.
+ *
+ * Note: Do not use this class, internal use only!
+ */
+@Internal
+public class FormatUtil {
+
+ public static InputStreamFactory createInputStreamFactory(File file) {
+ try {
+ return new MarkableFileInputStreamFactory(file);
+ } catch (FileNotFoundException e) {
+ throw new TerminateToolException(-1, "File '" + file + "' cannot be found", e);
+ }
+ }
+
+ /**
+ * Check that the given input file is valid.
+ *
+ * To pass the test it must:
+ * - exist
+ * - not be a directory,
+ * - and be accessibly.
+ *
+ * @param name the name which is used to refer to the file in an error message, it
+ * should start with a capital letter.
+ *
+ * @param inFile the particular {@link File} to check to qualify an input file
+ *
+ * @throws TerminateToolException if test does not pass this exception is
+ * thrown and an error message is printed to the console.
+ */
+ public static void checkInputFile(String name, File inFile) {
+
+ String isFailure = null;
+
+ if (inFile.isDirectory()) {
+ isFailure = "The " + name + " file is a directory!";
+ }
+ else if (!inFile.exists()) {
+ isFailure = "The " + name + " file does not exist!";
+ }
+ else if (!inFile.canRead()) {
+ isFailure = "No permissions to read the " + name + " file!";
+ }
+
+ if (null != isFailure) {
+ throw new TerminateToolException(-1, isFailure + " Path: " + inFile.getAbsolutePath());
+ }
+ }
+}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/LanguageDetectorSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/LanguageDetectorSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/LanguageDetectorSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/LanguageDetectorSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/LanguageSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/LanguageSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/LanguageSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/LanguageSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/LemmatizerSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/LemmatizerSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/LemmatizerSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/LemmatizerSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/NameFinderCensus90NameStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/NameFinderCensus90NameStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/NameFinderCensus90NameStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/NameFinderCensus90NameStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/NameSampleDataStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/NameSampleDataStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/NameSampleDataStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/NameSampleDataStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ParseSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ParseSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ParseSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ParseSampleStreamFactory.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ResourceAsStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ResourceAsStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ResourceAsStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ResourceAsStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/SentenceSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/SentenceSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/SentenceSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/SentenceSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/TokenSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/TokenSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/TokenSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/TokenSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/TwentyNewsgroupSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/TwentyNewsgroupSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/TwentyNewsgroupSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/TwentyNewsgroupSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/TwentyNewsgroupSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/TwentyNewsgroupSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/TwentyNewsgroupSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/TwentyNewsgroupSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/WordTagSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/WordTagSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/WordTagSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/WordTagSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ad/ADChunkSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/ADChunkSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ad/ADChunkSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/ADChunkSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ad/ADChunkSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/ADChunkSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ad/ADChunkSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/ADChunkSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ad/ADNameSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/ADNameSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ad/ADNameSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/ADNameSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ad/ADNameSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/ADNameSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ad/ADNameSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/ADNameSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ad/ADPOSSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/ADPOSSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ad/ADPOSSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/ADPOSSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ad/ADPOSSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/ADPOSSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ad/ADPOSSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/ADPOSSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ad/ADSentenceSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/ADSentenceSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ad/ADSentenceSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/ADSentenceSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ad/ADSentenceSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/ADSentenceSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ad/ADSentenceSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/ADSentenceSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ad/ADSentenceStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/ADSentenceStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ad/ADSentenceStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/ADSentenceStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ad/ADTokenSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/ADTokenSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ad/ADTokenSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/ADTokenSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ad/PortugueseContractionUtility.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/PortugueseContractionUtility.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ad/PortugueseContractionUtility.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ad/PortugueseContractionUtility.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/brat/AnnotationConfiguration.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/AnnotationConfiguration.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/brat/AnnotationConfiguration.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/AnnotationConfiguration.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/brat/AnnotatorNoteAnnotation.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/AnnotatorNoteAnnotation.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/brat/AnnotatorNoteAnnotation.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/AnnotatorNoteAnnotation.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/brat/AttributeAnnotation.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/AttributeAnnotation.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/brat/AttributeAnnotation.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/AttributeAnnotation.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratAnnotation.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/BratAnnotation.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratAnnotation.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/BratAnnotation.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratAnnotationStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/BratAnnotationStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratAnnotationStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/BratAnnotationStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratDocument.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/BratDocument.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratDocument.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/BratDocument.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratDocumentParser.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/BratDocumentParser.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratDocumentParser.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/BratDocumentParser.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratDocumentStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/BratDocumentStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratDocumentStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/BratDocumentStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratNameSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/BratNameSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratNameSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/BratNameSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratNameSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/BratNameSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratNameSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/BratNameSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/brat/EventAnnotation.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/EventAnnotation.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/brat/EventAnnotation.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/EventAnnotation.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/brat/RelationAnnotation.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/RelationAnnotation.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/brat/RelationAnnotation.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/RelationAnnotation.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/brat/SegmenterObjectStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/SegmenterObjectStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/brat/SegmenterObjectStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/SegmenterObjectStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/brat/SpanAnnotation.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/SpanAnnotation.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/brat/SpanAnnotation.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/brat/SpanAnnotation.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluLemmaSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluLemmaSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluLemmaSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluLemmaSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluLemmaSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluLemmaSampleStreamFactory.java
similarity index 88%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluLemmaSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluLemmaSampleStreamFactory.java
index 2dedf86ce..371a8c9af 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluLemmaSampleStreamFactory.java
+++ b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluLemmaSampleStreamFactory.java
@@ -20,14 +20,13 @@
import java.io.IOException;
import opennlp.tools.cmdline.ArgumentParser;
-import opennlp.tools.cmdline.CmdLineUtil;
import opennlp.tools.cmdline.StreamFactoryRegistry;
import opennlp.tools.cmdline.TerminateToolException;
import opennlp.tools.cmdline.params.BasicFormatParams;
import opennlp.tools.commons.Internal;
import opennlp.tools.formats.AbstractSampleStreamFactory;
+import opennlp.tools.formats.FormatUtil;
import opennlp.tools.lemmatizer.LemmaSample;
-import opennlp.tools.util.InputStreamFactory;
import opennlp.tools.util.ObjectStream;
/**
@@ -66,14 +65,12 @@ public ObjectStream create(String[] args) {
default -> throw new TerminateToolException(-1, "Unknown tagset parameter: " + params.getTagset());
};
- InputStreamFactory inFactory =
- CmdLineUtil.createInputStreamFactory(params.getData());
-
try {
- return new ConlluLemmaSampleStream(new ConlluStream(inFactory), tagset);
+ return new ConlluLemmaSampleStream(new ConlluStream(
+ FormatUtil.createInputStreamFactory(params.getData())), tagset);
} catch (IOException e) {
- CmdLineUtil.handleCreateObjectStreamError(e);
+ throw new TerminateToolException(-1,
+ "IO Error while creating an Input Stream: " + e.getMessage(), e);
}
- return null;
}
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluPOSSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluPOSSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluPOSSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluPOSSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluPOSSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluPOSSampleStreamFactory.java
similarity index 88%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluPOSSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluPOSSampleStreamFactory.java
index 9a40b0a17..7e285948c 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluPOSSampleStreamFactory.java
+++ b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluPOSSampleStreamFactory.java
@@ -20,14 +20,13 @@
import java.io.IOException;
import opennlp.tools.cmdline.ArgumentParser;
-import opennlp.tools.cmdline.CmdLineUtil;
import opennlp.tools.cmdline.StreamFactoryRegistry;
import opennlp.tools.cmdline.TerminateToolException;
import opennlp.tools.cmdline.params.BasicFormatParams;
import opennlp.tools.commons.Internal;
import opennlp.tools.formats.AbstractSampleStreamFactory;
+import opennlp.tools.formats.FormatUtil;
import opennlp.tools.postag.POSSample;
-import opennlp.tools.util.InputStreamFactory;
import opennlp.tools.util.ObjectStream;
/**
@@ -68,14 +67,12 @@ public ObjectStream create(String[] args) {
default -> throw new TerminateToolException(-1, "Unknown tagset parameter: " + params.getTagset());
};
- InputStreamFactory inFactory =
- CmdLineUtil.createInputStreamFactory(params.getData());
-
try {
- return new ConlluPOSSampleStream(new ConlluStream(inFactory), tagset);
+ return new ConlluPOSSampleStream(new ConlluStream(
+ FormatUtil.createInputStreamFactory(params.getData())), tagset);
} catch (IOException e) {
- CmdLineUtil.handleCreateObjectStreamError(e);
+ throw new TerminateToolException(-1,
+ "IO Error while creating an Input Stream: " + e.getMessage(), e);
}
- return null;
}
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluSentence.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluSentence.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluSentence.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluSentence.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluSentenceSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluSentenceSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluSentenceSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluSentenceSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluSentenceSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluSentenceSampleStreamFactory.java
similarity index 87%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluSentenceSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluSentenceSampleStreamFactory.java
index 6e6657595..629275bb4 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluSentenceSampleStreamFactory.java
+++ b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluSentenceSampleStreamFactory.java
@@ -20,13 +20,13 @@
import java.io.IOException;
import opennlp.tools.cmdline.ArgumentParser;
-import opennlp.tools.cmdline.CmdLineUtil;
import opennlp.tools.cmdline.StreamFactoryRegistry;
+import opennlp.tools.cmdline.TerminateToolException;
import opennlp.tools.cmdline.params.BasicFormatParams;
import opennlp.tools.commons.Internal;
import opennlp.tools.formats.AbstractSampleStreamFactory;
+import opennlp.tools.formats.FormatUtil;
import opennlp.tools.sentdetect.SentenceSample;
-import opennlp.tools.util.InputStreamFactory;
import opennlp.tools.util.ObjectStream;
/**
@@ -59,15 +59,13 @@ protected ConlluSentenceSampleStreamFactory(Class params) {
public ObjectStream create(String[] args) {
Parameters params = validateBasicFormatParameters(args, Parameters.class);
- InputStreamFactory inFactory =
- CmdLineUtil.createInputStreamFactory(params.getData());
-
try {
- return new ConlluSentenceSampleStream(new ConlluStream(inFactory),
+ return new ConlluSentenceSampleStream(new ConlluStream(
+ FormatUtil.createInputStreamFactory(params.getData())),
Integer.parseInt(params.getSentencesPerSample()));
} catch (IOException e) {
- CmdLineUtil.handleCreateObjectStreamError(e);
+ throw new TerminateToolException(-1,
+ "IO Error while creating an Input Stream: " + e.getMessage(), e);
}
- return null;
}
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluTagset.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluTagset.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluTagset.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluTagset.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluTokenSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluTokenSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluTokenSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluTokenSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluTokenSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluTokenSampleStreamFactory.java
similarity index 85%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluTokenSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluTokenSampleStreamFactory.java
index ac3b18d47..7a395790c 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluTokenSampleStreamFactory.java
+++ b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluTokenSampleStreamFactory.java
@@ -19,13 +19,13 @@
import java.io.IOException;
-import opennlp.tools.cmdline.CmdLineUtil;
import opennlp.tools.cmdline.StreamFactoryRegistry;
+import opennlp.tools.cmdline.TerminateToolException;
import opennlp.tools.cmdline.params.BasicFormatParams;
import opennlp.tools.commons.Internal;
import opennlp.tools.formats.AbstractSampleStreamFactory;
+import opennlp.tools.formats.FormatUtil;
import opennlp.tools.tokenize.TokenSample;
-import opennlp.tools.util.InputStreamFactory;
import opennlp.tools.util.ObjectStream;
/**
@@ -55,14 +55,12 @@ protected ConlluTokenSampleStreamFactory(Class params) {
public ObjectStream create(String[] args) {
Parameters params = validateBasicFormatParameters(args, Parameters.class);
- InputStreamFactory inFactory =
- CmdLineUtil.createInputStreamFactory(params.getData());
-
try {
- return new ConlluTokenSampleStream(new ConlluStream(inFactory));
+ return new ConlluTokenSampleStream(new ConlluStream(
+ FormatUtil.createInputStreamFactory(params.getData())));
} catch (IOException e) {
- CmdLineUtil.handleCreateObjectStreamError(e);
+ throw new TerminateToolException(-1,
+ "IO Error while creating an Input Stream: " + e.getMessage(), e);
}
- return null;
}
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluWordLine.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluWordLine.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/conllu/ConlluWordLine.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/conllu/ConlluWordLine.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/convert/AbstractToSentenceSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/AbstractToSentenceSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/convert/AbstractToSentenceSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/AbstractToSentenceSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/convert/FileToByteArraySampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/FileToByteArraySampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/convert/FileToByteArraySampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/FileToByteArraySampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/convert/FileToStringSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/FileToStringSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/convert/FileToStringSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/FileToStringSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/convert/NameToSentenceSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/NameToSentenceSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/convert/NameToSentenceSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/NameToSentenceSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/convert/NameToSentenceSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/NameToSentenceSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/convert/NameToSentenceSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/NameToSentenceSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/convert/NameToTokenSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/NameToTokenSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/convert/NameToTokenSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/NameToTokenSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/convert/NameToTokenSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/NameToTokenSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/convert/NameToTokenSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/NameToTokenSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/convert/POSToSentenceSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/POSToSentenceSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/convert/POSToSentenceSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/POSToSentenceSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/convert/POSToSentenceSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/POSToSentenceSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/convert/POSToSentenceSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/POSToSentenceSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/convert/POSToTokenSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/POSToTokenSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/convert/POSToTokenSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/POSToTokenSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/convert/POSToTokenSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/POSToTokenSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/convert/POSToTokenSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/POSToTokenSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/convert/ParseToPOSSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/ParseToPOSSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/convert/ParseToPOSSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/ParseToPOSSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/convert/ParseToPOSSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/ParseToPOSSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/convert/ParseToPOSSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/ParseToPOSSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/convert/ParseToSentenceSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/ParseToSentenceSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/convert/ParseToSentenceSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/ParseToSentenceSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/convert/ParseToTokenSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/ParseToTokenSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/convert/ParseToTokenSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/convert/ParseToTokenSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/frenchtreebank/ConstitDocumentHandler.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/frenchtreebank/ConstitDocumentHandler.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/frenchtreebank/ConstitDocumentHandler.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/frenchtreebank/ConstitDocumentHandler.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/frenchtreebank/ConstitParseSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/frenchtreebank/ConstitParseSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/frenchtreebank/ConstitParseSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/frenchtreebank/ConstitParseSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/frenchtreebank/ConstitParseSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/frenchtreebank/ConstitParseSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/frenchtreebank/ConstitParseSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/frenchtreebank/ConstitParseSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankDocument.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankDocument.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankDocument.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankDocument.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankSentenceStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankSentenceStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankSentenceStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankSentenceStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankSentenceStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankSentenceStreamFactory.java
similarity index 92%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankSentenceStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankSentenceStreamFactory.java
index 5c1036f12..a8cb2ed90 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankSentenceStreamFactory.java
+++ b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankSentenceStreamFactory.java
@@ -19,8 +19,8 @@
import java.io.IOException;
-import opennlp.tools.cmdline.CmdLineUtil;
import opennlp.tools.cmdline.StreamFactoryRegistry;
+import opennlp.tools.cmdline.TerminateToolException;
import opennlp.tools.cmdline.params.BasicFormatParams;
import opennlp.tools.commons.Internal;
import opennlp.tools.formats.AbstractSampleStreamFactory;
@@ -58,7 +58,8 @@ public ObjectStream create(String[] args) {
try {
isbDoc = IrishSentenceBankDocument.parse(params.getData());
} catch (IOException ex) {
- CmdLineUtil.handleCreateObjectStreamError(ex);
+ throw new TerminateToolException(-1,
+ "IO Error while creating an Input Stream: " + ex.getMessage(), ex);
}
return new IrishSentenceBankSentenceStream(isbDoc);
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankTokenSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankTokenSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankTokenSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankTokenSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankTokenSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankTokenSampleStreamFactory.java
similarity index 92%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankTokenSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankTokenSampleStreamFactory.java
index b41d57413..80560e9ea 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankTokenSampleStreamFactory.java
+++ b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankTokenSampleStreamFactory.java
@@ -19,8 +19,8 @@
import java.io.IOException;
-import opennlp.tools.cmdline.CmdLineUtil;
import opennlp.tools.cmdline.StreamFactoryRegistry;
+import opennlp.tools.cmdline.TerminateToolException;
import opennlp.tools.cmdline.params.BasicFormatParams;
import opennlp.tools.commons.Internal;
import opennlp.tools.formats.DetokenizerSampleStreamFactory;
@@ -58,7 +58,8 @@ public ObjectStream create(String[] args) {
try {
isbDoc = IrishSentenceBankDocument.parse(params.getData());
} catch (IOException ex) {
- CmdLineUtil.handleCreateObjectStreamError(ex);
+ throw new TerminateToolException(-1,
+ "IO Error while creating an Input Stream: " + ex.getMessage(), ex);
}
return new IrishSentenceBankTokenSampleStream(isbDoc);
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/leipzig/LeipzigLanguageSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/leipzig/LeipzigLanguageSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/leipzig/LeipzigLanguageSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/leipzig/LeipzigLanguageSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/leipzig/LeipzigLanguageSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/leipzig/LeipzigLanguageSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/leipzig/LeipzigLanguageSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/leipzig/LeipzigLanguageSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/leipzig/SampleShuffleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/leipzig/SampleShuffleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/leipzig/SampleShuffleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/leipzig/SampleShuffleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/leipzig/SampleSkipStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/leipzig/SampleSkipStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/leipzig/SampleSkipStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/leipzig/SampleSkipStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/letsmt/DetokenizeSentenceSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/letsmt/DetokenizeSentenceSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/letsmt/DetokenizeSentenceSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/letsmt/DetokenizeSentenceSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/letsmt/LetsmtDocument.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/letsmt/LetsmtDocument.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/letsmt/LetsmtDocument.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/letsmt/LetsmtDocument.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/letsmt/LetsmtSentenceStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/letsmt/LetsmtSentenceStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/letsmt/LetsmtSentenceStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/letsmt/LetsmtSentenceStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/letsmt/LetsmtSentenceStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/letsmt/LetsmtSentenceStreamFactory.java
similarity index 96%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/letsmt/LetsmtSentenceStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/letsmt/LetsmtSentenceStreamFactory.java
index 1077ab37b..e774372ba 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/letsmt/LetsmtSentenceStreamFactory.java
+++ b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/letsmt/LetsmtSentenceStreamFactory.java
@@ -21,7 +21,6 @@
import java.io.IOException;
import opennlp.tools.cmdline.ArgumentParser;
-import opennlp.tools.cmdline.CmdLineUtil;
import opennlp.tools.cmdline.StreamFactoryRegistry;
import opennlp.tools.cmdline.TerminateToolException;
import opennlp.tools.cmdline.params.BasicFormatParams;
@@ -67,7 +66,8 @@ public ObjectStream create(String[] args) {
try {
letsmtDoc = LetsmtDocument.parse(params.getData());
} catch (IOException ex) {
- CmdLineUtil.handleCreateObjectStreamError(ex);
+ throw new TerminateToolException(-1,
+ "IO Error while creating an Input Stream: " + ex.getMessage(), ex);
}
// TODO Implement a filter stream to remove splits which are not at an eos char
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/Masc.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/Masc.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/masc/Masc.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/Masc.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascDocument.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascDocument.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascDocument.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascDocument.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascDocumentStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascDocumentStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascDocumentStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascDocumentStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascNamedEntityParser.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascNamedEntityParser.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascNamedEntityParser.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascNamedEntityParser.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascNamedEntitySampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascNamedEntitySampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascNamedEntitySampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascNamedEntitySampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascNamedEntitySampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascNamedEntitySampleStreamFactory.java
similarity index 94%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascNamedEntitySampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascNamedEntitySampleStreamFactory.java
index ab85f88d5..94303a102 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascNamedEntitySampleStreamFactory.java
+++ b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascNamedEntitySampleStreamFactory.java
@@ -21,8 +21,8 @@
import java.io.IOException;
import opennlp.tools.cmdline.ArgumentParser;
-import opennlp.tools.cmdline.CmdLineUtil;
import opennlp.tools.cmdline.StreamFactoryRegistry;
+import opennlp.tools.cmdline.TerminateToolException;
import opennlp.tools.cmdline.params.BasicFormatParams;
import opennlp.tools.commons.Internal;
import opennlp.tools.formats.AbstractSampleStreamFactory;
@@ -73,8 +73,8 @@ public ObjectStream create(String[] args) {
return new MascNamedEntitySampleStream(
new MascDocumentStream(params.getData(), params.getRecurrentSearch(), fileFilter));
} catch (IOException e) {
- CmdLineUtil.handleCreateObjectStreamError(e);
+ throw new TerminateToolException(-1,
+ "IO Error while creating an Input Stream: " + e.getMessage(), e);
}
- return null;
}
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascPOSSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascPOSSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascPOSSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascPOSSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascPOSSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascPOSSampleStreamFactory.java
similarity index 93%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascPOSSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascPOSSampleStreamFactory.java
index b3bceddec..2e1798391 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascPOSSampleStreamFactory.java
+++ b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascPOSSampleStreamFactory.java
@@ -21,8 +21,8 @@
import java.io.IOException;
import opennlp.tools.cmdline.ArgumentParser;
-import opennlp.tools.cmdline.CmdLineUtil;
import opennlp.tools.cmdline.StreamFactoryRegistry;
+import opennlp.tools.cmdline.TerminateToolException;
import opennlp.tools.cmdline.params.BasicFormatParams;
import opennlp.tools.commons.Internal;
import opennlp.tools.formats.AbstractSampleStreamFactory;
@@ -73,10 +73,9 @@ public ObjectStream create(String[] args) {
return new MascPOSSampleStream(
new MascDocumentStream(params.getData(), params.getRecurrentSearch(), fileFilter));
} catch (IOException e) {
- // That will throw an exception
- CmdLineUtil.handleCreateObjectStreamError(e);
+ throw new TerminateToolException(-1,
+ "IO Error while creating an Input Stream: " + e.getMessage(), e);
}
- return null;
}
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascPennTagParser.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascPennTagParser.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascPennTagParser.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascPennTagParser.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascSentence.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascSentence.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascSentence.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascSentence.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascSentenceParser.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascSentenceParser.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascSentenceParser.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascSentenceParser.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascSentenceSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascSentenceSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascSentenceSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascSentenceSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascSentenceSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascSentenceSampleStreamFactory.java
similarity index 94%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascSentenceSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascSentenceSampleStreamFactory.java
index 9b6eeb435..759d6883f 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascSentenceSampleStreamFactory.java
+++ b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascSentenceSampleStreamFactory.java
@@ -21,8 +21,8 @@
import java.io.IOException;
import opennlp.tools.cmdline.ArgumentParser;
-import opennlp.tools.cmdline.CmdLineUtil;
import opennlp.tools.cmdline.StreamFactoryRegistry;
+import opennlp.tools.cmdline.TerminateToolException;
import opennlp.tools.cmdline.params.BasicFormatParams;
import opennlp.tools.commons.Internal;
import opennlp.tools.formats.AbstractSampleStreamFactory;
@@ -77,10 +77,9 @@ public ObjectStream create(String[] args) {
new MascDocumentStream(params.getData(), params.getRecurrentSearch(), fileFilter),
Integer.parseInt(params.getSentencesPerSample()));
} catch (IOException e) {
- // That will throw an exception
- CmdLineUtil.handleCreateObjectStreamError(e);
+ throw new TerminateToolException(-1,
+ "IO Error while creating an Input Stream: " + e.getMessage(), e);
}
- return null;
}
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascToken.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascToken.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascToken.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascToken.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascTokenSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascTokenSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascTokenSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascTokenSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascTokenSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascTokenSampleStreamFactory.java
similarity index 94%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascTokenSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascTokenSampleStreamFactory.java
index 8a70c0b74..5349a27d3 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascTokenSampleStreamFactory.java
+++ b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascTokenSampleStreamFactory.java
@@ -21,8 +21,8 @@
import java.io.IOException;
import opennlp.tools.cmdline.ArgumentParser;
-import opennlp.tools.cmdline.CmdLineUtil;
import opennlp.tools.cmdline.StreamFactoryRegistry;
+import opennlp.tools.cmdline.TerminateToolException;
import opennlp.tools.cmdline.params.BasicFormatParams;
import opennlp.tools.commons.Internal;
import opennlp.tools.formats.AbstractSampleStreamFactory;
@@ -76,10 +76,9 @@ public ObjectStream create(String[] args) {
return new MascTokenSampleStream(
new MascDocumentStream(params.getData(), params.getRecurrentSearch(), fileFilter));
} catch (IOException e) {
- // That will throw an exception
- CmdLineUtil.handleCreateObjectStreamError(e);
+ throw new TerminateToolException(-1,
+ "IO Error while creating an Input Stream: " + e.getMessage(), e);
}
- return null;
}
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascWord.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascWord.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascWord.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascWord.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascWordParser.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascWordParser.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/masc/MascWordParser.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/masc/MascWordParser.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/moses/MosesSentenceSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/moses/MosesSentenceSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/moses/MosesSentenceSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/moses/MosesSentenceSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/moses/MosesSentenceSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/moses/MosesSentenceSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/moses/MosesSentenceSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/moses/MosesSentenceSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/muc/DocumentSplitterStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/muc/DocumentSplitterStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/muc/DocumentSplitterStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/muc/DocumentSplitterStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/muc/Muc6NameSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/muc/Muc6NameSampleStreamFactory.java
similarity index 79%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/muc/Muc6NameSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/muc/Muc6NameSampleStreamFactory.java
index 4acb31d1e..0ac482849 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/muc/Muc6NameSampleStreamFactory.java
+++ b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/muc/Muc6NameSampleStreamFactory.java
@@ -18,6 +18,7 @@
package opennlp.tools.formats.muc;
import java.io.File;
+import java.io.IOException;
import java.nio.charset.StandardCharsets;
import opennlp.tools.cmdline.ArgumentParser;
@@ -25,7 +26,6 @@
import opennlp.tools.cmdline.StreamFactoryRegistry;
import opennlp.tools.cmdline.TerminateToolException;
import opennlp.tools.cmdline.params.BasicFormatParams;
-import opennlp.tools.cmdline.tokenizer.TokenizerModelLoader;
import opennlp.tools.commons.Internal;
import opennlp.tools.formats.AbstractSampleStreamFactory;
import opennlp.tools.formats.DirectorySampleStream;
@@ -68,15 +68,19 @@ public ObjectStream create(String[] args) {
if (!params.getData().isDirectory() || !params.getData().exists()) {
throw new TerminateToolException(-1, "The specified data directory is not valid!");
}
+ try {
+ TokenizerModel tokenizerModel = new TokenizerModel(params.getTokenizerModel());
+ Tokenizer tokenizer = new ThreadSafeTokenizerME(tokenizerModel);
- TokenizerModel tokenizerModel = new TokenizerModelLoader().load(params.getTokenizerModel());
- Tokenizer tokenizer = new ThreadSafeTokenizerME(tokenizerModel);
+ ObjectStream mucDocStream = new FileToStringSampleStream(
+ new DirectorySampleStream(params.getData(),
+ file -> StringUtil.toLowerCase(file.getName()).endsWith(".sgm"), false),
+ StandardCharsets.UTF_8);
- ObjectStream mucDocStream = new FileToStringSampleStream(
- new DirectorySampleStream(params.getData(),
- file -> StringUtil.toLowerCase(file.getName()).endsWith(".sgm"), false),
- StandardCharsets.UTF_8);
-
- return new MucNameSampleStream(tokenizer, mucDocStream);
+ return new MucNameSampleStream(tokenizer, mucDocStream);
+ } catch (IOException e) {
+ throw new TerminateToolException(-1,
+ "IO Error while creating an Input Stream: " + e.getMessage(), e);
+ }
}
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/muc/MucElementNames.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/muc/MucElementNames.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/muc/MucElementNames.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/muc/MucElementNames.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/muc/MucNameContentHandler.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/muc/MucNameContentHandler.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/muc/MucNameContentHandler.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/muc/MucNameContentHandler.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/muc/MucNameSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/muc/MucNameSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/muc/MucNameSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/muc/MucNameSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/muc/SgmlParser.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/muc/SgmlParser.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/muc/SgmlParser.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/muc/SgmlParser.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/nkjp/NKJPSegmentationDocument.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/nkjp/NKJPSegmentationDocument.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/nkjp/NKJPSegmentationDocument.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/nkjp/NKJPSegmentationDocument.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/nkjp/NKJPSentenceSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/nkjp/NKJPSentenceSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/nkjp/NKJPSentenceSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/nkjp/NKJPSentenceSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/nkjp/NKJPSentenceSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/nkjp/NKJPSentenceSampleStreamFactory.java
similarity index 89%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/nkjp/NKJPSentenceSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/nkjp/NKJPSentenceSampleStreamFactory.java
index da9e59892..37596e5ba 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/nkjp/NKJPSentenceSampleStreamFactory.java
+++ b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/nkjp/NKJPSentenceSampleStreamFactory.java
@@ -21,11 +21,12 @@
import java.io.IOException;
import opennlp.tools.cmdline.ArgumentParser;
-import opennlp.tools.cmdline.CmdLineUtil;
import opennlp.tools.cmdline.StreamFactoryRegistry;
+import opennlp.tools.cmdline.TerminateToolException;
import opennlp.tools.cmdline.params.BasicFormatParams;
import opennlp.tools.commons.Internal;
import opennlp.tools.formats.AbstractSampleStreamFactory;
+import opennlp.tools.formats.FormatUtil;
import opennlp.tools.sentdetect.SentenceSample;
import opennlp.tools.util.ObjectStream;
@@ -57,7 +58,7 @@ protected NKJPSentenceSampleStreamFactory(Class params) {
@Override
public ObjectStream create(String[] args) {
Parameters params = validateBasicFormatParameters(args, Parameters.class);
- CmdLineUtil.checkInputFile("Text", params.getTextFile());
+ FormatUtil.checkInputFile("Text", params.getTextFile());
NKJPSegmentationDocument segDoc = null;
NKJPTextDocument textDoc = null;
@@ -65,7 +66,8 @@ public ObjectStream create(String[] args) {
segDoc = NKJPSegmentationDocument.parse(params.getData());
textDoc = NKJPTextDocument.parse(params.getTextFile());
} catch (IOException ex) {
- CmdLineUtil.handleCreateObjectStreamError(ex);
+ throw new TerminateToolException(-1,
+ "IO Error while creating an Input Stream: " + ex.getMessage(), ex);
}
return new NKJPSentenceSampleStream(segDoc, textDoc);
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/nkjp/NKJPTextDocument.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/nkjp/NKJPTextDocument.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/nkjp/NKJPTextDocument.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/nkjp/NKJPTextDocument.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/DocumentToLineStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ontonotes/DocumentToLineStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/DocumentToLineStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ontonotes/DocumentToLineStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesFormatParameters.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesFormatParameters.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesFormatParameters.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesFormatParameters.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesNameSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesNameSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesNameSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesNameSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesNameSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesNameSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesNameSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesNameSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesPOSSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesPOSSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesPOSSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesPOSSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesParseSampleStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesParseSampleStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesParseSampleStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesParseSampleStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesParseSampleStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesParseSampleStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesParseSampleStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesParseSampleStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/MarkableFileInputStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/util/MarkableFileInputStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/MarkableFileInputStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/util/MarkableFileInputStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/MarkableFileInputStreamFactory.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/util/MarkableFileInputStreamFactory.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/MarkableFileInputStreamFactory.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/util/MarkableFileInputStreamFactory.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/ParagraphStream.java b/opennlp-core/opennlp-formats/src/main/java/opennlp/tools/util/ParagraphStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/util/ParagraphStream.java
rename to opennlp-core/opennlp-formats/src/main/java/opennlp/tools/util/ParagraphStream.java
diff --git a/opennlp-core/opennlp-formats/src/main/resources/opennlp/tools/util/opennlp.version b/opennlp-core/opennlp-formats/src/main/resources/opennlp/tools/util/opennlp.version
new file mode 100644
index 000000000..70bfa1078
--- /dev/null
+++ b/opennlp-core/opennlp-formats/src/main/resources/opennlp/tools/util/opennlp.version
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreemnets. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Version is injected by the maven build, fall back version is 0.0.0-SNAPSHOT
+OpenNLP-Version: ${project.version}
\ No newline at end of file
diff --git a/opennlp-tools/src/main/java/opennlp/tools/package-info.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/AbstractTempDirTest.java
similarity index 59%
rename from opennlp-tools/src/main/java/opennlp/tools/package-info.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/AbstractTempDirTest.java
index 7204600d8..baba5932f 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/package-info.java
+++ b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/AbstractTempDirTest.java
@@ -15,7 +15,29 @@
* limitations under the License.
*/
-/**
- * Contains packages which solve common NLP tasks.
- */
package opennlp.tools;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+
+// TODO: OPENNLP-1430 Remove workaround for @TempDir
+// after https://github.com/junit-team/junit5/issues/2811 is fixed.
+public abstract class AbstractTempDirTest {
+
+ protected Path tempDir;
+
+ @BeforeEach
+ public void before() throws IOException {
+ tempDir = Files.createTempDirectory(this.getClass().getSimpleName());
+ }
+
+ @AfterEach
+ void after() {
+ tempDir.toFile().deleteOnExit();
+ }
+
+}
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/AbstractFormatTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/AbstractFormatTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/AbstractFormatTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/AbstractFormatTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/AbstractSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/AbstractSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/AbstractSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/AbstractSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/AbstractSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/AbstractSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/AbstractSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/AbstractSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/BioNLP2004NameSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/BioNLP2004NameSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/BioNLP2004NameSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/BioNLP2004NameSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ChunkerSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ChunkerSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ChunkerSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ChunkerSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/Conll02NameSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/Conll02NameSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/Conll02NameSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/Conll02NameSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/Conll02NameSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/Conll02NameSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/Conll02NameSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/Conll02NameSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/Conll03NameSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/Conll03NameSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/Conll03NameSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/Conll03NameSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/Conll03NameSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/Conll03NameSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/Conll03NameSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/Conll03NameSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ConllXPOSSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ConllXPOSSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ConllXPOSSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ConllXPOSSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ConllXPOSSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ConllXPOSSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ConllXPOSSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ConllXPOSSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ConllXSentenceSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ConllXSentenceSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ConllXSentenceSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ConllXSentenceSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ConllXTokenSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ConllXTokenSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ConllXTokenSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ConllXTokenSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/DirectorySampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/DirectorySampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/DirectorySampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/DirectorySampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/EvalitaNameSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/EvalitaNameSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/EvalitaNameSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/EvalitaNameSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/EvalitaNameSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/EvalitaNameSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/EvalitaNameSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/EvalitaNameSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/LanguageDetectorSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/LanguageDetectorSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/LanguageDetectorSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/LanguageDetectorSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/LemmatizerSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/LemmatizerSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/LemmatizerSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/LemmatizerSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/NameFinderCensus90NameStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/NameFinderCensus90NameStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/NameFinderCensus90NameStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/NameFinderCensus90NameStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/NameSampleDataStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/NameSampleDataStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/NameSampleDataStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/NameSampleDataStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ParseSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ParseSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ParseSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ParseSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/SentenceSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/SentenceSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/SentenceSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/SentenceSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/TokenSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/TokenSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/TokenSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/TokenSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/TwentyNewsgroupSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/TwentyNewsgroupSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/TwentyNewsgroupSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/TwentyNewsgroupSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/WordTagSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/WordTagSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/WordTagSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/WordTagSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ad/ADChunkSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/ADChunkSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ad/ADChunkSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/ADChunkSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ad/ADChunkSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/ADChunkSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ad/ADChunkSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/ADChunkSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ad/ADNameSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/ADNameSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ad/ADNameSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/ADNameSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ad/ADPOSSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/ADPOSSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ad/ADPOSSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/ADPOSSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ad/ADPOSSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/ADPOSSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ad/ADPOSSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/ADPOSSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ad/ADParagraphStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/ADParagraphStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ad/ADParagraphStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/ADParagraphStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ad/ADSentenceSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/ADSentenceSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ad/ADSentenceSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/ADSentenceSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ad/ADSentenceSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/ADSentenceSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ad/ADSentenceSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/ADSentenceSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ad/ADTokenSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/ADTokenSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ad/ADTokenSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/ADTokenSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ad/ADTokenSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/ADTokenSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ad/ADTokenSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/ADTokenSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ad/AbstractADSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/AbstractADSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ad/AbstractADSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ad/AbstractADSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/brat/AbstractBratTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/brat/AbstractBratTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/brat/AbstractBratTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/brat/AbstractBratTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/brat/BratAnnotationStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/brat/BratAnnotationStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/brat/BratAnnotationStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/brat/BratAnnotationStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/brat/BratDocumentParserTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/brat/BratDocumentParserTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/brat/BratDocumentParserTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/brat/BratDocumentParserTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/brat/BratDocumentTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/brat/BratDocumentTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/brat/BratDocumentTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/brat/BratDocumentTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/brat/BratNameSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/brat/BratNameSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/brat/BratNameSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/brat/BratNameSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/brat/BratNameSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/brat/BratNameSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/brat/BratNameSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/brat/BratNameSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/conllu/AbstractConlluSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/AbstractConlluSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/conllu/AbstractConlluSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/AbstractConlluSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/conllu/ConlluLemmaSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluLemmaSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/conllu/ConlluLemmaSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluLemmaSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/conllu/ConlluLemmaSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluLemmaSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/conllu/ConlluLemmaSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluLemmaSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/conllu/ConlluPOSSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluPOSSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/conllu/ConlluPOSSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluPOSSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/conllu/ConlluPOSSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluPOSSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/conllu/ConlluPOSSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluPOSSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/conllu/ConlluSentenceSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluSentenceSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/conllu/ConlluSentenceSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluSentenceSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/conllu/ConlluSentenceSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluSentenceSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/conllu/ConlluSentenceSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluSentenceSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/conllu/ConlluStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/conllu/ConlluStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/conllu/ConlluTokenSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluTokenSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/conllu/ConlluTokenSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluTokenSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/conllu/ConlluTokenSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluTokenSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/conllu/ConlluTokenSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluTokenSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/conllu/ConlluWordLineTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluWordLineTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/conllu/ConlluWordLineTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/conllu/ConlluWordLineTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/convert/AbstractConvertTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/convert/AbstractConvertTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/convert/AbstractConvertTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/convert/AbstractConvertTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/convert/FileToByteArraySampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/convert/FileToByteArraySampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/convert/FileToByteArraySampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/convert/FileToByteArraySampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/convert/FileToStringSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/convert/FileToStringSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/convert/FileToStringSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/convert/FileToStringSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/convert/NameToSentenceSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/convert/NameToSentenceSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/convert/NameToSentenceSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/convert/NameToSentenceSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/convert/NameToTokenSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/convert/NameToTokenSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/convert/NameToTokenSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/convert/NameToTokenSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/convert/POSToSentenceSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/convert/POSToSentenceSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/convert/POSToSentenceSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/convert/POSToSentenceSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/convert/POSToTokenSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/convert/POSToTokenSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/convert/POSToTokenSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/convert/POSToTokenSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/convert/ParseToPOSSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/convert/ParseToPOSSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/convert/ParseToPOSSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/convert/ParseToPOSSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/convert/ParseToSentenceSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/convert/ParseToSentenceSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/convert/ParseToSentenceSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/convert/ParseToSentenceSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/convert/ParseToTokenSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/convert/ParseToTokenSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/convert/ParseToTokenSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/convert/ParseToTokenSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/frenchtreebank/ConstitParseSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/frenchtreebank/ConstitParseSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/frenchtreebank/ConstitParseSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/frenchtreebank/ConstitParseSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/frenchtreebank/ConstitParseSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/frenchtreebank/ConstitParseSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/frenchtreebank/ConstitParseSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/frenchtreebank/ConstitParseSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankDocumentTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankDocumentTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankDocumentTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankDocumentTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankSentenceStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankSentenceStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankSentenceStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankSentenceStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankTokenSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankTokenSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankTokenSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/irishsentencebank/IrishSentenceBankTokenSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/leipzig/LeipzigLanguageSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/leipzig/LeipzigLanguageSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/leipzig/LeipzigLanguageSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/leipzig/LeipzigLanguageSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/leipzig/LeipzigLanguageSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/leipzig/LeipzigLanguageSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/leipzig/LeipzigLanguageSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/leipzig/LeipzigLanguageSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/letsmt/LetsmtDocumentTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/letsmt/LetsmtDocumentTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/letsmt/LetsmtDocumentTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/letsmt/LetsmtDocumentTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/letsmt/LetsmtSentenceStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/letsmt/LetsmtSentenceStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/letsmt/LetsmtSentenceStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/letsmt/LetsmtSentenceStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/AbstractMascSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/AbstractMascSampleStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/masc/AbstractMascSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/AbstractMascSampleStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascNamedEntitySampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/MascNamedEntitySampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascNamedEntitySampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/MascNamedEntitySampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascNamedEntitySampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/MascNamedEntitySampleStreamTest.java
similarity index 97%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascNamedEntitySampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/MascNamedEntitySampleStreamTest.java
index 543bebebf..4b902db78 100644
--- a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascNamedEntitySampleStreamTest.java
+++ b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/MascNamedEntitySampleStreamTest.java
@@ -30,6 +30,7 @@
import opennlp.tools.namefind.TokenNameFinderFactory;
import opennlp.tools.namefind.TokenNameFinderModel;
import opennlp.tools.util.ObjectStream;
+import opennlp.tools.util.Parameters;
import opennlp.tools.util.Span;
import opennlp.tools.util.TrainingParameters;
@@ -118,7 +119,7 @@ void train() {
new MascDocumentStream(directory, true, fileFilter));
TrainingParameters trainingParameters = new TrainingParameters();
- trainingParameters.put(TrainingParameters.ITERATIONS_PARAM, 100);
+ trainingParameters.put(Parameters.ITERATIONS_PARAM, 100);
TokenNameFinderModel model = NameFinderME.train("en", null, trainSample,
trainingParameters, new TokenNameFinderFactory());
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascPOSSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/MascPOSSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascPOSSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/MascPOSSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascPOSSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/MascPOSSampleStreamTest.java
similarity index 97%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascPOSSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/MascPOSSampleStreamTest.java
index 7a6d84568..2b2cbb093 100644
--- a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascPOSSampleStreamTest.java
+++ b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/MascPOSSampleStreamTest.java
@@ -30,6 +30,7 @@
import opennlp.tools.postag.POSTaggerFactory;
import opennlp.tools.postag.POSTaggerME;
import opennlp.tools.util.ObjectStream;
+import opennlp.tools.util.Parameters;
import opennlp.tools.util.TrainingParameters;
public class MascPOSSampleStreamTest extends AbstractMascSampleStreamTest {
@@ -110,7 +111,7 @@ void train() {
new MascDocumentStream(directory, true, fileFilter));
TrainingParameters trainingParameters = new TrainingParameters();
- trainingParameters.put(TrainingParameters.ITERATIONS_PARAM, 20);
+ trainingParameters.put(Parameters.ITERATIONS_PARAM, 20);
POSModel model = POSTaggerME.train("en", trainPOS,
trainingParameters, new POSTaggerFactory());
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascSentenceSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/MascSentenceSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascSentenceSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/MascSentenceSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascSentenceSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/MascSentenceSampleStreamTest.java
similarity index 97%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascSentenceSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/MascSentenceSampleStreamTest.java
index 24e7d5693..f9f8dc02b 100644
--- a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascSentenceSampleStreamTest.java
+++ b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/MascSentenceSampleStreamTest.java
@@ -33,6 +33,7 @@
import opennlp.tools.sentdetect.SentenceModel;
import opennlp.tools.sentdetect.SentenceSample;
import opennlp.tools.util.ObjectStream;
+import opennlp.tools.util.Parameters;
import opennlp.tools.util.Span;
import opennlp.tools.util.TrainingParameters;
@@ -127,7 +128,7 @@ void train() {
true, fileFilter), 1);
TrainingParameters trainingParameters = new TrainingParameters();
- trainingParameters.put(TrainingParameters.ITERATIONS_PARAM, 20);
+ trainingParameters.put(Parameters.ITERATIONS_PARAM, 20);
SentenceModel model = SentenceDetectorME.train("en", trainSentences,
new SentenceDetectorFactory(), trainingParameters);
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascTokenSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/MascTokenSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascTokenSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/MascTokenSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascTokenSampleStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/MascTokenSampleStreamTest.java
similarity index 97%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascTokenSampleStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/MascTokenSampleStreamTest.java
index 7ed972c23..d5a925eff 100644
--- a/opennlp-tools/src/test/java/opennlp/tools/formats/masc/MascTokenSampleStreamTest.java
+++ b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/masc/MascTokenSampleStreamTest.java
@@ -30,6 +30,7 @@
import opennlp.tools.tokenize.TokenizerME;
import opennlp.tools.tokenize.TokenizerModel;
import opennlp.tools.util.ObjectStream;
+import opennlp.tools.util.Parameters;
import opennlp.tools.util.Span;
import opennlp.tools.util.TrainingParameters;
@@ -130,7 +131,7 @@ void train() {
new MascDocumentStream(directory, true, fileFilter));
TrainingParameters trainingParameters = new TrainingParameters();
- trainingParameters.put(TrainingParameters.ITERATIONS_PARAM, 20);
+ trainingParameters.put(Parameters.ITERATIONS_PARAM, 20);
TokenizerModel model = TokenizerME.train(trainTokens, new TokenizerFactory(
"en", null, false, null), trainingParameters);
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/moses/MosesSentenceSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/moses/MosesSentenceSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/moses/MosesSentenceSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/moses/MosesSentenceSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/muc/DocumentSplitterStreamTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/muc/DocumentSplitterStreamTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/muc/DocumentSplitterStreamTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/muc/DocumentSplitterStreamTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/muc/Muc6NameSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/muc/Muc6NameSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/muc/Muc6NameSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/muc/Muc6NameSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/muc/SgmlParserTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/muc/SgmlParserTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/muc/SgmlParserTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/muc/SgmlParserTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/nkjp/NKJPSegmentationDocumentTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/nkjp/NKJPSegmentationDocumentTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/nkjp/NKJPSegmentationDocumentTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/nkjp/NKJPSegmentationDocumentTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/nkjp/NKJPSentenceSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/nkjp/NKJPSentenceSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/nkjp/NKJPSentenceSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/nkjp/NKJPSentenceSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/nkjp/NKJPTextDocumentTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/nkjp/NKJPTextDocumentTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/nkjp/NKJPTextDocumentTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/nkjp/NKJPTextDocumentTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ontonotes/OntoNotesNameSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ontonotes/OntoNotesNameSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ontonotes/OntoNotesNameSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ontonotes/OntoNotesNameSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ontonotes/OntoNotesPOSSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ontonotes/OntoNotesPOSSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ontonotes/OntoNotesPOSSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ontonotes/OntoNotesPOSSampleStreamFactoryTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/ontonotes/OntoNotesParseSampleStreamFactoryTest.java b/opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ontonotes/OntoNotesParseSampleStreamFactoryTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/formats/ontonotes/OntoNotesParseSampleStreamFactoryTest.java
rename to opennlp-core/opennlp-formats/src/test/java/opennlp/tools/formats/ontonotes/OntoNotesParseSampleStreamFactoryTest.java
diff --git a/opennlp-core/opennlp-formats/src/test/resources/logback-test.xml b/opennlp-core/opennlp-formats/src/test/resources/logback-test.xml
new file mode 100644
index 000000000..1baae2912
--- /dev/null
+++ b/opennlp-core/opennlp-formats/src/test/resources/logback-test.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+ %date{HH:mm:ss.SSS} [%thread] %-4level %class{36}.%method:%line - %msg%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/20newsgroup/sci.electronics/52794.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/20newsgroup/sci.electronics/52794.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/20newsgroup/sci.electronics/52794.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/20newsgroup/sci.electronics/52794.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/ad/ad.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/ad/ad.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/ad/ad.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/ad/ad.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/bionlp2004-01.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/bionlp2004-01.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/bionlp2004-01.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/bionlp2004-01.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/brat/brat-ann.conf b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/brat/brat-ann.conf
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/brat/brat-ann.conf
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/brat/brat-ann.conf
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/brat/opennlp-1193.ann b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/brat/opennlp-1193.ann
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/brat/opennlp-1193.ann
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/brat/opennlp-1193.ann
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/brat/opennlp-1193.txt b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/brat/opennlp-1193.txt
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/brat/opennlp-1193.txt
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/brat/opennlp-1193.txt
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/brat/voa-with-entities-overlapping.ann b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/brat/voa-with-entities-overlapping.ann
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/brat/voa-with-entities-overlapping.ann
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/brat/voa-with-entities-overlapping.ann
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/brat/voa-with-entities-overlapping.txt b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/brat/voa-with-entities-overlapping.txt
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/brat/voa-with-entities-overlapping.txt
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/brat/voa-with-entities-overlapping.txt
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/brat/voa-with-entities.ann b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/brat/voa-with-entities.ann
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/brat/voa-with-entities.ann
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/brat/voa-with-entities.ann
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/brat/voa-with-entities.txt b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/brat/voa-with-entities.txt
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/brat/voa-with-entities.txt
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/brat/voa-with-entities.txt
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/brat/voa-with-relations.ann b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/brat/voa-with-relations.ann
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/brat/voa-with-relations.ann
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/brat/voa-with-relations.ann
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/brat/voa-with-relations.txt b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/brat/voa-with-relations.txt
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/brat/voa-with-relations.txt
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/brat/voa-with-relations.txt
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/brown-cluster.txt b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/brown-cluster.txt
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/brown-cluster.txt
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/brown-cluster.txt
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/census90.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/census90.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/census90.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/census90.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/chunker-01.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/chunker-01.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/chunker-01.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/chunker-01.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/conll2002-es.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/conll2002-es.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/conll2002-es.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/conll2002-es.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/conll2002-nl.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/conll2002-nl.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/conll2002-nl.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/conll2002-nl.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/conll2003-de.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/conll2003-de.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/conll2003-de.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/conll2003-de.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/conll2003-en.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/conll2003-en.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/conll2003-en.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/conll2003-en.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/conllu/de-ud-train-sample.conllu b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/conllu/de-ud-train-sample.conllu
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/conllu/de-ud-train-sample.conllu
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/conllu/de-ud-train-sample.conllu
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/conllu/es-ud-sample.conllu b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/conllu/es-ud-sample.conllu
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/conllu/es-ud-sample.conllu
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/conllu/es-ud-sample.conllu
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/conllu/full-sample.conllu b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/conllu/full-sample.conllu
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/conllu/full-sample.conllu
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/conllu/full-sample.conllu
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/conllu/pt_br-ud-sample.conllu b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/conllu/pt_br-ud-sample.conllu
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/conllu/pt_br-ud-sample.conllu
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/conllu/pt_br-ud-sample.conllu
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/conllx.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/conllx.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/conllx.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/conllx.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/evalita-ner-it-01.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/evalita-ner-it-01.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/evalita-ner-it-01.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/evalita-ner-it-01.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/evalita-ner-it-02.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/evalita-ner-it-02.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/evalita-ner-it-02.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/evalita-ner-it-02.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/evalita-ner-it-03.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/evalita-ner-it-03.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/evalita-ner-it-03.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/evalita-ner-it-03.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/evalita-ner-it-broken.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/evalita-ner-it-broken.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/evalita-ner-it-broken.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/evalita-ner-it-broken.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/evalita-ner-it-incorrect.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/evalita-ner-it-incorrect.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/evalita-ner-it-incorrect.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/evalita-ner-it-incorrect.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/frenchtreebank/sample1.xml b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/frenchtreebank/sample1.xml
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/frenchtreebank/sample1.xml
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/frenchtreebank/sample1.xml
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/irishsentencebank/irishsentencebank-sample.xml b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/irishsentencebank/irishsentencebank-sample.xml
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/irishsentencebank/irishsentencebank-sample.xml
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/irishsentencebank/irishsentencebank-sample.xml
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/lang-detect-01.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/lang-detect-01.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/lang-detect-01.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/lang-detect-01.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/leipzig-en.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/leipzig-en.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/leipzig-en.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/leipzig-en.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/leipzig/samples/.hidden b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/leipzig/samples/.hidden
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/leipzig/samples/.hidden
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/leipzig/samples/.hidden
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/leipzig/samples/123-skipped.txt b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/leipzig/samples/123-skipped.txt
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/leipzig/samples/123-skipped.txt
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/leipzig/samples/123-skipped.txt
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/leipzig/samples/dan-sentences.txt b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/leipzig/samples/dan-sentences.txt
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/leipzig/samples/dan-sentences.txt
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/leipzig/samples/dan-sentences.txt
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/leipzig/samples/dontread/xxx-sentences.txt b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/leipzig/samples/dontread/xxx-sentences.txt
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/leipzig/samples/dontread/xxx-sentences.txt
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/leipzig/samples/dontread/xxx-sentences.txt
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/leipzig/samples/eng-sentences.txt b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/leipzig/samples/eng-sentences.txt
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/leipzig/samples/eng-sentences.txt
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/leipzig/samples/eng-sentences.txt
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/lemma-01.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/lemma-01.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/lemma-01.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/lemma-01.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/letsmt/letsmt-with-words.xml b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/letsmt/letsmt-with-words.xml
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/letsmt/letsmt-with-words.xml
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/letsmt/letsmt-with-words.xml
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/masc/fakeMASC-ne.xml b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/masc/fakeMASC-ne.xml
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/masc/fakeMASC-ne.xml
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/masc/fakeMASC-ne.xml
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/masc/fakeMASC-penn.xml b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/masc/fakeMASC-penn.xml
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/masc/fakeMASC-penn.xml
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/masc/fakeMASC-penn.xml
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/masc/fakeMASC-s.xml b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/masc/fakeMASC-s.xml
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/masc/fakeMASC-s.xml
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/masc/fakeMASC-s.xml
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/masc/fakeMASC-seg.xml b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/masc/fakeMASC-seg.xml
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/masc/fakeMASC-seg.xml
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/masc/fakeMASC-seg.xml
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/masc/fakeMASC.hdr b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/masc/fakeMASC.hdr
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/masc/fakeMASC.hdr
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/masc/fakeMASC.hdr
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/masc/fakeMASC.txt b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/masc/fakeMASC.txt
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/masc/fakeMASC.txt
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/masc/fakeMASC.txt
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/moses/moses-tiny.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/moses/moses-tiny.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/moses/moses-tiny.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/moses/moses-tiny.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/muc/LDC2003T13.sgm b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/muc/LDC2003T13.sgm
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/muc/LDC2003T13.sgm
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/muc/LDC2003T13.sgm
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/muc/parsertest1.sgml b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/muc/parsertest1.sgml
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/muc/parsertest1.sgml
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/muc/parsertest1.sgml
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/name-data-01.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/name-data-01.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/name-data-01.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/name-data-01.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/nkjp/ann_segmentation.xml b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/nkjp/ann_segmentation.xml
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/nkjp/ann_segmentation.xml
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/nkjp/ann_segmentation.xml
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/nkjp/text_structure.xml b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/nkjp/text_structure.xml
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/nkjp/text_structure.xml
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/nkjp/text_structure.xml
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/ontonotes/ontonotes-sample-01.name b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/ontonotes/ontonotes-sample-01.name
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/ontonotes/ontonotes-sample-01.name
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/ontonotes/ontonotes-sample-01.name
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/ontonotes/ontonotes-sample-02.parse b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/ontonotes/ontonotes-sample-02.parse
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/ontonotes/ontonotes-sample-02.parse
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/ontonotes/ontonotes-sample-02.parse
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/parse-01.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/parse-01.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/parse-01.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/parse-01.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/sentences-01.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/sentences-01.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/sentences-01.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/sentences-01.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/tokens-01.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/tokens-01.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/tokens-01.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/tokens-01.sample
diff --git a/opennlp-tools/src/test/resources/opennlp/tools/formats/word-tags-01.sample b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/word-tags-01.sample
similarity index 100%
rename from opennlp-tools/src/test/resources/opennlp/tools/formats/word-tags-01.sample
rename to opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/formats/word-tags-01.sample
diff --git a/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/tokenize/latin-detokenizer.xml b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/tokenize/latin-detokenizer.xml
new file mode 100644
index 000000000..61af4d874
--- /dev/null
+++ b/opennlp-core/opennlp-formats/src/test/resources/opennlp/tools/tokenize/latin-detokenizer.xml
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+ .
+
+
+ ?
+
+
+ !
+
+
+ ,
+
+
+ ;
+
+
+ :
+
+
+ )
+
+
+ (
+
+
+ }
+
+
+ {
+
+
+ ]
+
+
+ [
+
+
+ ``
+
+
+ ''
+
+
+ %
+
+
+ "
+
+
+ "
+
+
+ -
+
+
\ No newline at end of file
diff --git a/opennlp-dl-gpu/README.md b/opennlp-core/opennlp-ml/opennlp-dl-gpu/README.md
similarity index 100%
rename from opennlp-dl-gpu/README.md
rename to opennlp-core/opennlp-ml/opennlp-dl-gpu/README.md
diff --git a/opennlp-dl-gpu/pom.xml b/opennlp-core/opennlp-ml/opennlp-dl-gpu/pom.xml
similarity index 84%
rename from opennlp-dl-gpu/pom.xml
rename to opennlp-core/opennlp-ml/opennlp-dl-gpu/pom.xml
index c79d0084a..f5965f237 100644
--- a/opennlp-dl-gpu/pom.xml
+++ b/opennlp-core/opennlp-ml/opennlp-dl-gpu/pom.xml
@@ -19,19 +19,27 @@
under the License.
-->
-
+4.0.0org.apache.opennlp
- opennlp
+ opennlp-ml3.0.0-SNAPSHOT
- ../pom.xml
- org.apache.opennlp
+
opennlp-dl-gpu
- Apache OpenNLP DL (GPU)
+ jar
+ Apache OpenNLP Deep Learning (GPU)
+
+
+ opennlp-api
+ ${project.groupId}
+ ${project.version}
+ org.apache.opennlpopennlp-dl
@@ -43,11 +51,15 @@
+
+
com.microsoft.onnxruntimeonnxruntime_gpu${onnxruntime.version}
+
+
org.junit.jupiterjunit-jupiter-api
@@ -112,4 +124,4 @@
-
+
\ No newline at end of file
diff --git a/opennlp-dl/README.md b/opennlp-core/opennlp-ml/opennlp-dl/README.md
similarity index 100%
rename from opennlp-dl/README.md
rename to opennlp-core/opennlp-ml/opennlp-dl/README.md
diff --git a/opennlp-dl/pom.xml b/opennlp-core/opennlp-ml/opennlp-dl/pom.xml
similarity index 77%
rename from opennlp-dl/pom.xml
rename to opennlp-core/opennlp-ml/opennlp-dl/pom.xml
index ef84ee970..dfe207a01 100644
--- a/opennlp-dl/pom.xml
+++ b/opennlp-core/opennlp-ml/opennlp-dl/pom.xml
@@ -19,28 +19,41 @@
under the License.
-->
-
+4.0.0org.apache.opennlp
- opennlp
+ opennlp-ml3.0.0-SNAPSHOT
- ../pom.xml
- org.apache.opennlp
+
opennlp-dl
- Apache OpenNLP DL
+ jar
+ Apache OpenNLP Deep Learning
+
+
org.apache.opennlp
- opennlp-tools
- ${project.version}
+ opennlp-api
+
+
com.microsoft.onnxruntimeonnxruntime${onnxruntime.version}
+
+
+
+ org.apache.opennlp
+ opennlp-runtime
+ test
+
+
org.slf4jslf4j-api
@@ -77,5 +90,4 @@
-
-
+
\ No newline at end of file
diff --git a/opennlp-dl/src/main/java/opennlp/dl/AbstractDL.java b/opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/AbstractDL.java
similarity index 100%
rename from opennlp-dl/src/main/java/opennlp/dl/AbstractDL.java
rename to opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/AbstractDL.java
diff --git a/opennlp-dl/src/main/java/opennlp/dl/InferenceOptions.java b/opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/InferenceOptions.java
similarity index 100%
rename from opennlp-dl/src/main/java/opennlp/dl/InferenceOptions.java
rename to opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/InferenceOptions.java
diff --git a/opennlp-dl/src/main/java/opennlp/dl/SpanEnd.java b/opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/SpanEnd.java
similarity index 100%
rename from opennlp-dl/src/main/java/opennlp/dl/SpanEnd.java
rename to opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/SpanEnd.java
diff --git a/opennlp-dl/src/main/java/opennlp/dl/Tokens.java b/opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/Tokens.java
similarity index 100%
rename from opennlp-dl/src/main/java/opennlp/dl/Tokens.java
rename to opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/Tokens.java
diff --git a/opennlp-dl/src/main/java/opennlp/dl/doccat/DocumentCategorizerConfig.java b/opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/doccat/DocumentCategorizerConfig.java
similarity index 100%
rename from opennlp-dl/src/main/java/opennlp/dl/doccat/DocumentCategorizerConfig.java
rename to opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/doccat/DocumentCategorizerConfig.java
diff --git a/opennlp-dl/src/main/java/opennlp/dl/doccat/DocumentCategorizerDL.java b/opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/doccat/DocumentCategorizerDL.java
similarity index 100%
rename from opennlp-dl/src/main/java/opennlp/dl/doccat/DocumentCategorizerDL.java
rename to opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/doccat/DocumentCategorizerDL.java
diff --git a/opennlp-dl/src/main/java/opennlp/dl/doccat/scoring/AverageClassificationScoringStrategy.java b/opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/doccat/scoring/AverageClassificationScoringStrategy.java
similarity index 100%
rename from opennlp-dl/src/main/java/opennlp/dl/doccat/scoring/AverageClassificationScoringStrategy.java
rename to opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/doccat/scoring/AverageClassificationScoringStrategy.java
diff --git a/opennlp-dl/src/main/java/opennlp/dl/doccat/scoring/ClassificationScoringStrategy.java b/opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/doccat/scoring/ClassificationScoringStrategy.java
similarity index 100%
rename from opennlp-dl/src/main/java/opennlp/dl/doccat/scoring/ClassificationScoringStrategy.java
rename to opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/doccat/scoring/ClassificationScoringStrategy.java
diff --git a/opennlp-dl/src/main/java/opennlp/dl/namefinder/NameFinderDL.java b/opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/namefinder/NameFinderDL.java
similarity index 100%
rename from opennlp-dl/src/main/java/opennlp/dl/namefinder/NameFinderDL.java
rename to opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/namefinder/NameFinderDL.java
diff --git a/opennlp-dl/src/main/java/opennlp/dl/vectors/SentenceVectorsDL.java b/opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/vectors/SentenceVectorsDL.java
similarity index 100%
rename from opennlp-dl/src/main/java/opennlp/dl/vectors/SentenceVectorsDL.java
rename to opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/vectors/SentenceVectorsDL.java
diff --git a/opennlp-dl/src/test/java/opennlp/dl/AbstractDLTest.java b/opennlp-core/opennlp-ml/opennlp-dl/src/test/java/opennlp/dl/AbstractDLTest.java
similarity index 100%
rename from opennlp-dl/src/test/java/opennlp/dl/AbstractDLTest.java
rename to opennlp-core/opennlp-ml/opennlp-dl/src/test/java/opennlp/dl/AbstractDLTest.java
diff --git a/opennlp-dl/src/test/java/opennlp/dl/doccat/DocumentCategorizerConfigTest.java b/opennlp-core/opennlp-ml/opennlp-dl/src/test/java/opennlp/dl/doccat/DocumentCategorizerConfigTest.java
similarity index 100%
rename from opennlp-dl/src/test/java/opennlp/dl/doccat/DocumentCategorizerConfigTest.java
rename to opennlp-core/opennlp-ml/opennlp-dl/src/test/java/opennlp/dl/doccat/DocumentCategorizerConfigTest.java
diff --git a/opennlp-dl/src/test/java/opennlp/dl/doccat/DocumentCategorizerDLEval.java b/opennlp-core/opennlp-ml/opennlp-dl/src/test/java/opennlp/dl/doccat/DocumentCategorizerDLEval.java
similarity index 100%
rename from opennlp-dl/src/test/java/opennlp/dl/doccat/DocumentCategorizerDLEval.java
rename to opennlp-core/opennlp-ml/opennlp-dl/src/test/java/opennlp/dl/doccat/DocumentCategorizerDLEval.java
diff --git a/opennlp-dl/src/test/java/opennlp/dl/doccat/scoring/AverageClassificationScoringStrategyTest.java b/opennlp-core/opennlp-ml/opennlp-dl/src/test/java/opennlp/dl/doccat/scoring/AverageClassificationScoringStrategyTest.java
similarity index 100%
rename from opennlp-dl/src/test/java/opennlp/dl/doccat/scoring/AverageClassificationScoringStrategyTest.java
rename to opennlp-core/opennlp-ml/opennlp-dl/src/test/java/opennlp/dl/doccat/scoring/AverageClassificationScoringStrategyTest.java
diff --git a/opennlp-dl/src/test/java/opennlp/dl/namefinder/NameFinderDLEval.java b/opennlp-core/opennlp-ml/opennlp-dl/src/test/java/opennlp/dl/namefinder/NameFinderDLEval.java
similarity index 100%
rename from opennlp-dl/src/test/java/opennlp/dl/namefinder/NameFinderDLEval.java
rename to opennlp-core/opennlp-ml/opennlp-dl/src/test/java/opennlp/dl/namefinder/NameFinderDLEval.java
diff --git a/opennlp-dl/src/test/java/opennlp/dl/vectors/SentenceVectorsDLEval.java b/opennlp-core/opennlp-ml/opennlp-dl/src/test/java/opennlp/dl/vectors/SentenceVectorsDLEval.java
similarity index 100%
rename from opennlp-dl/src/test/java/opennlp/dl/vectors/SentenceVectorsDLEval.java
rename to opennlp-core/opennlp-ml/opennlp-dl/src/test/java/opennlp/dl/vectors/SentenceVectorsDLEval.java
diff --git a/opennlp-core/opennlp-ml/opennlp-ml-bayes/pom.xml b/opennlp-core/opennlp-ml/opennlp-ml-bayes/pom.xml
new file mode 100644
index 000000000..b08924ed6
--- /dev/null
+++ b/opennlp-core/opennlp-ml/opennlp-ml-bayes/pom.xml
@@ -0,0 +1,47 @@
+
+
+
+
+ 4.0.0
+
+ org.apache.opennlp
+ opennlp-ml
+ 3.0.0-SNAPSHOT
+
+
+ opennlp-ml-bayes
+ jar
+ Apache OpenNLP Naive Bayes
+
+
+
+
+ org.apache.opennlp
+ opennlp-api
+
+
+ org.apache.opennlp
+ opennlp-ml-commons
+
+
+
+
\ No newline at end of file
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/BinaryNaiveBayesModelReader.java b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/BinaryNaiveBayesModelReader.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/BinaryNaiveBayesModelReader.java
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/BinaryNaiveBayesModelReader.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/BinaryNaiveBayesModelWriter.java b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/BinaryNaiveBayesModelWriter.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/BinaryNaiveBayesModelWriter.java
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/BinaryNaiveBayesModelWriter.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/LogProbabilities.java b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/LogProbabilities.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/LogProbabilities.java
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/LogProbabilities.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/LogProbability.java b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/LogProbability.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/LogProbability.java
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/LogProbability.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesEvalParameters.java b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesEvalParameters.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesEvalParameters.java
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesEvalParameters.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesModel.java b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesModel.java
similarity index 98%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesModel.java
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesModel.java
index 0a92ec2fe..a436c8452 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesModel.java
+++ b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesModel.java
@@ -19,6 +19,7 @@
import java.util.Map;
+import opennlp.tools.ml.AlgorithmType;
import opennlp.tools.ml.model.AbstractModel;
import opennlp.tools.ml.model.Context;
import opennlp.tools.ml.model.EvalParameters;
@@ -49,7 +50,7 @@ public class NaiveBayesModel extends AbstractModel {
outcomeTotals = initOutcomeTotals(outcomeNames, params);
this.evalParams = new NaiveBayesEvalParameters(params, outcomeNames.length,
outcomeTotals, predLabels.length);
- modelType = ModelType.NaiveBayes;
+ modelType = AlgorithmType.NAIVE_BAYES;
}
/**
@@ -64,7 +65,7 @@ public NaiveBayesModel(Context[] params, String[] predLabels, String[] outcomeNa
outcomeTotals = initOutcomeTotals(outcomeNames, params);
this.evalParams = new NaiveBayesEvalParameters(params, outcomeNames.length,
outcomeTotals, predLabels.length);
- modelType = ModelType.NaiveBayes;
+ modelType = AlgorithmType.NAIVE_BAYES;
}
protected double[] initOutcomeTotals(String[] outcomeNames, Context[] params) {
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesModelReader.java b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesModelReader.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesModelReader.java
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesModelReader.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesModelWriter.java b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesModelWriter.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesModelWriter.java
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesModelWriter.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesTrainer.java b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesTrainer.java
similarity index 96%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesTrainer.java
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesTrainer.java
index f43f0d9a4..0a28a1eb5 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesTrainer.java
+++ b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/NaiveBayesTrainer.java
@@ -41,7 +41,7 @@
* @see NaiveBayesModel
* @see AbstractEventTrainer
*/
-public class NaiveBayesTrainer extends AbstractEventTrainer {
+public class NaiveBayesTrainer extends AbstractEventTrainer {
private static final Logger logger = LoggerFactory.getLogger(NaiveBayesTrainer.class);
@@ -122,7 +122,7 @@ public boolean isSortAndMerge() {
}
@Override
- public AbstractModel doTrain(DataIndexer indexer) throws IOException {
+ public AbstractModel doTrain(DataIndexer indexer) throws IOException {
return this.trainModel(indexer);
}
@@ -135,7 +135,7 @@ public AbstractModel doTrain(DataIndexer indexer) throws IOException {
*
* @return A valid, trained {@link AbstractModel Naive Bayes model}.
*/
- public AbstractModel trainModel(DataIndexer di) {
+ public AbstractModel trainModel(DataIndexer di) {
logger.info("Incorporating indexed data for training...");
contexts = di.getContexts();
values = di.getValues();
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/PlainTextNaiveBayesModelReader.java b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/PlainTextNaiveBayesModelReader.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/PlainTextNaiveBayesModelReader.java
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/PlainTextNaiveBayesModelReader.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/PlainTextNaiveBayesModelWriter.java b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/PlainTextNaiveBayesModelWriter.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/PlainTextNaiveBayesModelWriter.java
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/PlainTextNaiveBayesModelWriter.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/Probabilities.java b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/Probabilities.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/Probabilities.java
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/Probabilities.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/Probability.java b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/Probability.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/naivebayes/Probability.java
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/main/java/opennlp/tools/ml/naivebayes/Probability.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/ml/PrepAttachDataUtil.java b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/java/opennlp/tools/ml/PrepAttachDataUtil.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/ml/PrepAttachDataUtil.java
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/java/opennlp/tools/ml/PrepAttachDataUtil.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/ml/naivebayes/AbstractNaiveBayesTest.java b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/java/opennlp/tools/ml/naivebayes/AbstractNaiveBayesTest.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/ml/naivebayes/AbstractNaiveBayesTest.java
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/java/opennlp/tools/ml/naivebayes/AbstractNaiveBayesTest.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesCorrectnessTest.java b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesCorrectnessTest.java
similarity index 96%
rename from opennlp-tools/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesCorrectnessTest.java
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesCorrectnessTest.java
index 2c837744e..a220cb345 100644
--- a/opennlp-tools/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesCorrectnessTest.java
+++ b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesCorrectnessTest.java
@@ -32,6 +32,7 @@
import opennlp.tools.ml.model.Event;
import opennlp.tools.ml.model.MaxentModel;
import opennlp.tools.ml.model.TwoPassDataIndexer;
+import opennlp.tools.util.Parameters;
import opennlp.tools.util.TrainingParameters;
/**
@@ -39,12 +40,12 @@
*/
public class NaiveBayesCorrectnessTest extends AbstractNaiveBayesTest {
- private DataIndexer testDataIndexer;
+ private DataIndexer testDataIndexer;
@BeforeEach
void initIndexer() throws IOException {
TrainingParameters trainingParameters = new TrainingParameters();
- trainingParameters.put(TrainingParameters.CUTOFF_PARAM, 1);
+ trainingParameters.put(Parameters.CUTOFF_PARAM, 1);
trainingParameters.put(AbstractDataIndexer.SORT_PARAM, false);
testDataIndexer = new TwoPassDataIndexer();
testDataIndexer.init(trainingParameters, new HashMap<>());
diff --git a/opennlp-tools/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesModelReadWriteTest.java b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesModelReadWriteTest.java
similarity index 95%
rename from opennlp-tools/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesModelReadWriteTest.java
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesModelReadWriteTest.java
index 2aabbfc38..0c9079230 100644
--- a/opennlp-tools/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesModelReadWriteTest.java
+++ b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesModelReadWriteTest.java
@@ -31,6 +31,7 @@
import opennlp.tools.ml.model.AbstractModel;
import opennlp.tools.ml.model.DataIndexer;
import opennlp.tools.ml.model.TwoPassDataIndexer;
+import opennlp.tools.util.Parameters;
import opennlp.tools.util.TrainingParameters;
/**
@@ -38,12 +39,12 @@
*/
public class NaiveBayesModelReadWriteTest extends AbstractNaiveBayesTest {
- private DataIndexer testDataIndexer;
+ private DataIndexer testDataIndexer;
@BeforeEach
void initIndexer() throws IOException {
TrainingParameters trainingParameters = new TrainingParameters();
- trainingParameters.put(TrainingParameters.CUTOFF_PARAM, 1);
+ trainingParameters.put(Parameters.CUTOFF_PARAM, 1);
trainingParameters.put(AbstractDataIndexer.SORT_PARAM, false);
testDataIndexer = new TwoPassDataIndexer();
testDataIndexer.init(trainingParameters, new HashMap<>());
diff --git a/opennlp-tools/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesPrepAttachTest.java b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesPrepAttachTest.java
similarity index 81%
rename from opennlp-tools/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesPrepAttachTest.java
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesPrepAttachTest.java
index aea7e4b23..18e8e3cc1 100644
--- a/opennlp-tools/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesPrepAttachTest.java
+++ b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesPrepAttachTest.java
@@ -26,13 +26,13 @@
import opennlp.tools.ml.EventTrainer;
import opennlp.tools.ml.PrepAttachDataUtil;
-import opennlp.tools.ml.TrainerFactory;
import opennlp.tools.ml.model.AbstractDataIndexer;
import opennlp.tools.ml.model.DataIndexer;
import opennlp.tools.ml.model.Event;
import opennlp.tools.ml.model.MaxentModel;
import opennlp.tools.ml.model.TwoPassDataIndexer;
import opennlp.tools.util.ObjectStream;
+import opennlp.tools.util.Parameters;
import opennlp.tools.util.TrainingParameters;
/**
@@ -51,9 +51,9 @@ void initIndexer() throws IOException {
@Test
void testNaiveBayesOnPrepAttachData() throws IOException {
TrainingParameters trainingParameters = new TrainingParameters();
- trainingParameters.put(TrainingParameters.CUTOFF_PARAM, 1);
+ trainingParameters.put(Parameters.CUTOFF_PARAM, 1);
trainingParameters.put(AbstractDataIndexer.SORT_PARAM, false);
- DataIndexer testDataIndexer = new TwoPassDataIndexer();
+ DataIndexer testDataIndexer = new TwoPassDataIndexer();
testDataIndexer.init(trainingParameters, new HashMap<>());
testDataIndexer.index(trainingStream);
@@ -65,10 +65,11 @@ void testNaiveBayesOnPrepAttachData() throws IOException {
@Test
void testNaiveBayesOnPrepAttachDataUsingTrainUtil() throws IOException {
TrainingParameters trainParams = new TrainingParameters();
- trainParams.put(TrainingParameters.ALGORITHM_PARAM, NaiveBayesTrainer.NAIVE_BAYES_VALUE);
- trainParams.put(TrainingParameters.CUTOFF_PARAM, 1);
+ trainParams.put(Parameters.ALGORITHM_PARAM, NaiveBayesTrainer.NAIVE_BAYES_VALUE);
+ trainParams.put(Parameters.CUTOFF_PARAM, 1);
- EventTrainer trainer = TrainerFactory.getEventTrainer(trainParams, null);
+ EventTrainer trainer = new NaiveBayesTrainer();
+ trainer.init(trainParams, null);
MaxentModel model = trainer.train(trainingStream);
Assertions.assertInstanceOf(NaiveBayesModel.class, model);
PrepAttachDataUtil.testModel(model, 0.7897994553107205);
@@ -77,10 +78,11 @@ void testNaiveBayesOnPrepAttachDataUsingTrainUtil() throws IOException {
@Test
void testNaiveBayesOnPrepAttachDataUsingTrainUtilWithCutoff5() throws IOException {
TrainingParameters trainParams = new TrainingParameters();
- trainParams.put(TrainingParameters.ALGORITHM_PARAM, NaiveBayesTrainer.NAIVE_BAYES_VALUE);
- trainParams.put(TrainingParameters.CUTOFF_PARAM, 5);
+ trainParams.put(Parameters.ALGORITHM_PARAM, NaiveBayesTrainer.NAIVE_BAYES_VALUE);
+ trainParams.put(Parameters.CUTOFF_PARAM, 5);
- EventTrainer trainer = TrainerFactory.getEventTrainer(trainParams, null);
+ EventTrainer trainer = new NaiveBayesTrainer();
+ trainer.init(trainParams, null);
MaxentModel model = trainer.train(trainingStream);
Assertions.assertInstanceOf(NaiveBayesModel.class, model);
PrepAttachDataUtil.testModel(model, 0.7945035899975241);
diff --git a/opennlp-tools/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesSerializedCorrectnessTest.java b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesSerializedCorrectnessTest.java
similarity index 97%
rename from opennlp-tools/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesSerializedCorrectnessTest.java
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesSerializedCorrectnessTest.java
index 658698137..3c9e154c6 100644
--- a/opennlp-tools/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesSerializedCorrectnessTest.java
+++ b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/java/opennlp/tools/ml/naivebayes/NaiveBayesSerializedCorrectnessTest.java
@@ -39,6 +39,7 @@
import opennlp.tools.ml.model.DataIndexer;
import opennlp.tools.ml.model.Event;
import opennlp.tools.ml.model.TwoPassDataIndexer;
+import opennlp.tools.util.Parameters;
import opennlp.tools.util.TrainingParameters;
/**
@@ -46,12 +47,12 @@
*/
public class NaiveBayesSerializedCorrectnessTest extends AbstractNaiveBayesTest {
- private DataIndexer testDataIndexer;
+ private DataIndexer testDataIndexer;
@BeforeEach
void initIndexer() throws IOException {
TrainingParameters trainingParameters = new TrainingParameters();
- trainingParameters.put(TrainingParameters.CUTOFF_PARAM, 1);
+ trainingParameters.put(Parameters.CUTOFF_PARAM, 1);
trainingParameters.put(AbstractDataIndexer.SORT_PARAM, false);
testDataIndexer = new TwoPassDataIndexer();
testDataIndexer.init(trainingParameters, new HashMap<>());
diff --git a/opennlp-tools/src/test/resources/data/ppa/NOTICE b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/resources/data/ppa/NOTICE
similarity index 100%
rename from opennlp-tools/src/test/resources/data/ppa/NOTICE
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/resources/data/ppa/NOTICE
diff --git a/opennlp-tools/src/test/resources/data/ppa/devset b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/resources/data/ppa/devset
similarity index 100%
rename from opennlp-tools/src/test/resources/data/ppa/devset
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/resources/data/ppa/devset
diff --git a/opennlp-tools/src/test/resources/data/ppa/training b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/resources/data/ppa/training
similarity index 100%
rename from opennlp-tools/src/test/resources/data/ppa/training
rename to opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/resources/data/ppa/training
diff --git a/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/resources/logback-test.xml b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/resources/logback-test.xml
new file mode 100644
index 000000000..1baae2912
--- /dev/null
+++ b/opennlp-core/opennlp-ml/opennlp-ml-bayes/src/test/resources/logback-test.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+ %date{HH:mm:ss.SSS} [%thread] %-4level %class{36}.%method:%line - %msg%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/opennlp-core/opennlp-ml/opennlp-ml-commons/pom.xml b/opennlp-core/opennlp-ml/opennlp-ml-commons/pom.xml
new file mode 100644
index 000000000..dd924a7e6
--- /dev/null
+++ b/opennlp-core/opennlp-ml/opennlp-ml-commons/pom.xml
@@ -0,0 +1,43 @@
+
+
+
+
+ 4.0.0
+
+ org.apache.opennlp
+ opennlp-ml
+ 3.0.0-SNAPSHOT
+
+
+ opennlp-ml-commons
+ jar
+ Apache OpenNLP ML Commons
+
+
+
+
+ org.apache.opennlp
+ opennlp-api
+
+
+
+
\ No newline at end of file
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/AbstractEventModelSequenceTrainer.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/AbstractEventModelSequenceTrainer.java
similarity index 83%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/AbstractEventModelSequenceTrainer.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/AbstractEventModelSequenceTrainer.java
index cdbd267f7..cd5a9519b 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/AbstractEventModelSequenceTrainer.java
+++ b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/AbstractEventModelSequenceTrainer.java
@@ -22,13 +22,13 @@
import opennlp.tools.ml.model.Event;
import opennlp.tools.ml.model.MaxentModel;
import opennlp.tools.ml.model.SequenceStream;
-import opennlp.tools.util.TrainingParameters;
+import opennlp.tools.util.Parameters;
/**
* A basic {@link EventModelSequenceTrainer} implementation that processes {@link Event events}.
*/
-public abstract class AbstractEventModelSequenceTrainer extends AbstractTrainer implements
- EventModelSequenceTrainer {
+public abstract class AbstractEventModelSequenceTrainer
+ extends AbstractTrainer
implements EventModelSequenceTrainer {
public AbstractEventModelSequenceTrainer() {
}
@@ -40,7 +40,7 @@ public final MaxentModel train(SequenceStream events) throws IOException
validate();
MaxentModel model = doTrain(events);
- addToReport(TrainingParameters.TRAINER_TYPE_PARAM, EventModelSequenceTrainer.SEQUENCE_VALUE);
+ addToReport(Parameters.TRAINER_TYPE_PARAM, EventModelSequenceTrainer.SEQUENCE_VALUE);
return model;
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/AbstractEventTrainer.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/AbstractEventTrainer.java
similarity index 74%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/AbstractEventTrainer.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/AbstractEventTrainer.java
index 19b3ba6ee..97b5877a2 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/AbstractEventTrainer.java
+++ b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/AbstractEventTrainer.java
@@ -27,12 +27,13 @@
import opennlp.tools.ml.model.MaxentModel;
import opennlp.tools.util.InsufficientTrainingDataException;
import opennlp.tools.util.ObjectStream;
-import opennlp.tools.util.TrainingParameters;
+import opennlp.tools.util.Parameters;
/**
* A basic {@link EventTrainer} implementation.
*/
-public abstract class AbstractEventTrainer extends AbstractTrainer implements EventTrainer {
+public abstract class AbstractEventTrainer
+ extends AbstractTrainer
implements EventTrainer
{
public static final String DATA_INDEXER_PARAM = "DataIndexer";
public static final String DATA_INDEXER_ONE_PASS_VALUE = "OnePass";
@@ -42,7 +43,7 @@ public abstract class AbstractEventTrainer extends AbstractTrainer implements Ev
public AbstractEventTrainer() {
}
- public AbstractEventTrainer(TrainingParameters parameters) {
+ public AbstractEventTrainer(P parameters) {
super(parameters);
}
@@ -53,23 +54,23 @@ public void validate() {
public abstract boolean isSortAndMerge();
- public DataIndexer getDataIndexer(ObjectStream events) throws IOException {
+ public DataIndexer
getDataIndexer(ObjectStream events) throws IOException {
trainingParameters.put(AbstractDataIndexer.SORT_PARAM, isSortAndMerge());
// If the cutoff was set, don't overwrite the value.
- if (trainingParameters.getIntParameter(TrainingParameters.CUTOFF_PARAM, -1) == -1) {
- trainingParameters.put(TrainingParameters.CUTOFF_PARAM, TrainingParameters.CUTOFF_DEFAULT_VALUE);
+ if (trainingParameters.getIntParameter(Parameters.CUTOFF_PARAM, -1) == -1) {
+ trainingParameters.put(Parameters.CUTOFF_PARAM, Parameters.CUTOFF_DEFAULT_VALUE);
}
- DataIndexer indexer = DataIndexerFactory.getDataIndexer(trainingParameters, reportMap);
+ DataIndexer
indexer) throws IOException;
@Override
- public final MaxentModel train(DataIndexer indexer) throws IOException {
+ public final MaxentModel train(DataIndexer
indexer) throws IOException {
validate();
if (indexer.getOutcomeLabels().length <= 1) {
@@ -77,7 +78,7 @@ public final MaxentModel train(DataIndexer indexer) throws IOException {
}
MaxentModel model = doTrain(indexer);
- addToReport(TrainingParameters.TRAINER_TYPE_PARAM, EventTrainer.EVENT_VALUE);
+ addToReport(Parameters.TRAINER_TYPE_PARAM, EVENT_VALUE);
return model;
}
@@ -86,7 +87,7 @@ public final MaxentModel train(ObjectStream events) throws IOException {
validate();
ChecksumEventStream hses = new ChecksumEventStream(events);
- DataIndexer indexer = getDataIndexer(hses);
+ DataIndexer
indexer = getDataIndexer(hses);
addToReport("Training-Eventhash", String.valueOf(hses.calculateChecksum()));
return train(indexer);
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/AbstractMLModelWriter.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/AbstractMLModelWriter.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/AbstractMLModelWriter.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/AbstractMLModelWriter.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/AbstractTrainer.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/AbstractTrainer.java
similarity index 62%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/AbstractTrainer.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/AbstractTrainer.java
index 2401e35f4..59872e2e0 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/AbstractTrainer.java
+++ b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/AbstractTrainer.java
@@ -21,13 +21,12 @@
import java.util.Map;
import opennlp.tools.commons.Trainer;
-import opennlp.tools.ml.maxent.GISTrainer;
+import opennlp.tools.util.Parameters;
import opennlp.tools.util.TrainingConfiguration;
-import opennlp.tools.util.TrainingParameters;
-public abstract class AbstractTrainer implements Trainer {
+public abstract class AbstractTrainer
implements Trainer
{
- protected TrainingParameters trainingParameters;
+ protected P trainingParameters;
protected Map reportMap;
protected TrainingConfiguration trainingConfiguration;
@@ -35,23 +34,23 @@ public AbstractTrainer() {
}
/**
- * Initializes a {@link AbstractTrainer} via {@link TrainingParameters}.
+ * Initializes a {@link AbstractTrainer} via {@link Parameters}.
*
- * @param trainParams The {@link TrainingParameters} to use.
+ * @param trainParams The {@link Parameters} to use.
*/
- public AbstractTrainer(TrainingParameters trainParams) {
+ public AbstractTrainer(P trainParams) {
init(trainParams,new HashMap<>());
}
/**
- * Initializes a {@link AbstractTrainer} via {@link TrainingParameters} and
+ * Initializes a {@link AbstractTrainer} via {@link Parameters} and
* a {@link Map report map}.
*
- * @param trainParams The {@link TrainingParameters} to use.
+ * @param trainParams The {@link Parameters} to use.
* @param reportMap The {@link Map} instance used as report map.
*/
@Override
- public void init(TrainingParameters trainParams, Map reportMap) {
+ public void init(P trainParams, Map reportMap) {
this.trainingParameters = trainParams;
if (reportMap == null) reportMap = new HashMap<>();
this.reportMap = reportMap;
@@ -61,38 +60,38 @@ public void init(TrainingParameters trainParams, Map reportMap) {
* {@inheritDoc}
*/
@Override
- public void init(TrainingParameters trainParams, Map reportMap,
+ public void init(P trainParams, Map reportMap,
TrainingConfiguration config) {
init(trainParams, reportMap);
this.trainingConfiguration = config;
}
/**
- * @return Retrieves the configured {@link TrainingParameters#ALGORITHM_PARAM} value.
+ * @return Retrieves the configured {@link Parameters#ALGORITHM_PARAM} value.
*/
public String getAlgorithm() {
- return trainingParameters.getStringParameter(TrainingParameters.ALGORITHM_PARAM,
- GISTrainer.MAXENT_VALUE);
+ return trainingParameters.getStringParameter(Parameters.ALGORITHM_PARAM,
+ Parameters.ALGORITHM_DEFAULT_VALUE);
}
/**
- * @return Retrieves the configured {@link TrainingParameters#CUTOFF_PARAM} value.
+ * @return Retrieves the configured {@link Parameters#CUTOFF_PARAM} value.
*/
public int getCutoff() {
- return trainingParameters.getIntParameter(TrainingParameters.CUTOFF_PARAM,
- TrainingParameters.CUTOFF_DEFAULT_VALUE);
+ return trainingParameters.getIntParameter(Parameters.CUTOFF_PARAM,
+ Parameters.CUTOFF_DEFAULT_VALUE);
}
/**
- * @return Retrieves the configured {@link TrainingParameters#ITERATIONS_PARAM} value.
+ * @return Retrieves the configured {@link Parameters#ITERATIONS_PARAM} value.
*/
public int getIterations() {
- return trainingParameters.getIntParameter(TrainingParameters.ITERATIONS_PARAM,
- TrainingParameters.ITERATIONS_DEFAULT_VALUE);
+ return trainingParameters.getIntParameter(Parameters.ITERATIONS_PARAM,
+ Parameters.ITERATIONS_DEFAULT_VALUE);
}
/**
- * Checks the configured {@link TrainingParameters parameters}.
+ * Checks the configured {@link Parameters parameters}.
* If a subclass overrides this, it should call {@code super.validate();}.
*
* @throws IllegalArgumentException Thrown if default training parameters are invalid.
@@ -102,10 +101,10 @@ public void validate() {
// should validate if algorithm is set? What about the Parser?
try {
- trainingParameters.getIntParameter(TrainingParameters.CUTOFF_PARAM,
- TrainingParameters.CUTOFF_DEFAULT_VALUE);
- trainingParameters.getIntParameter(TrainingParameters.ITERATIONS_PARAM,
- TrainingParameters.ITERATIONS_DEFAULT_VALUE);
+ trainingParameters.getIntParameter(Parameters.CUTOFF_PARAM,
+ Parameters.CUTOFF_DEFAULT_VALUE);
+ trainingParameters.getIntParameter(Parameters.ITERATIONS_PARAM,
+ Parameters.ITERATIONS_DEFAULT_VALUE);
} catch (NumberFormatException e) {
throw new IllegalArgumentException(e);
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/BeamSearch.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/BeamSearch.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/BeamSearch.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/BeamSearch.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/AbstractDataIndexer.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/AbstractDataIndexer.java
similarity index 93%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/AbstractDataIndexer.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/AbstractDataIndexer.java
index 16fa02439..a1de2ad59 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/model/AbstractDataIndexer.java
+++ b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/AbstractDataIndexer.java
@@ -32,7 +32,7 @@
import opennlp.tools.util.InsufficientTrainingDataException;
import opennlp.tools.util.ObjectStream;
-import opennlp.tools.util.TrainingParameters;
+import opennlp.tools.util.Parameters;
/**
* Abstract {@link DataIndexer} implementation for collecting
@@ -40,21 +40,21 @@
*
* @see DataIndexer
*/
-public abstract class AbstractDataIndexer implements DataIndexer {
+public abstract class AbstractDataIndexer
implements DataIndexer
{
private static final Logger logger = LoggerFactory.getLogger(AbstractDataIndexer.class);
public static final String SORT_PARAM = "sort";
public static final boolean SORT_DEFAULT = true;
- protected TrainingParameters trainingParameters;
+ protected P trainingParameters;
protected Map reportMap;
/**
* {@inheritDoc}
*/
@Override
- public void init(TrainingParameters indexingParameters, Map reportMap) {
+ public void init(P indexingParameters, Map reportMap) {
this.reportMap = reportMap;
if (this.reportMap == null) reportMap = new HashMap<>();
trainingParameters = indexingParameters;
@@ -136,7 +136,7 @@ public int getNumEvents() {
*
* It does an in place sort, followed by an in place edit to remove duplicates.
*
- * @param eventsToCompare The {@link List} events used as input.
+ * @param eventsToCompare The {@link List< ComparableEvent >} events used as input.
* @param sort Whether to use sorting, or not.
*
* @return The number of unique events in the specified list.
@@ -197,9 +197,9 @@ protected int sortAndMerge(List eventsToCompare, boolean sort)
* Performs the data indexing.
*
* Note:
- * Make sure the {@link #init(TrainingParameters, Map)} method is called first.
+ * Make sure the {@link #init(Parameters, Map)} method is called first.
*
- * @param events A {@link ObjectStream} of events used as input.
+ * @param events A {@link ObjectStream< Event >} of events used as input.
* @param predicateIndex A {@link Map} providing the data of a predicate index.
*
* @throws IOException Thrown if IO errors occurred during indexing.
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/AbstractModel.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/AbstractModel.java
similarity index 95%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/AbstractModel.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/AbstractModel.java
index fc529a5b7..33131fb53 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/model/AbstractModel.java
+++ b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/AbstractModel.java
@@ -23,6 +23,7 @@
import java.util.Map;
import java.util.Objects;
+import opennlp.tools.ml.AlgorithmType;
import opennlp.tools.ml.ArrayMath;
/**
@@ -41,10 +42,8 @@ public abstract class AbstractModel implements MaxentModel {
/** Prior distribution for this model. */
protected Prior prior;
- public enum ModelType { Maxent,Perceptron,MaxentQn,NaiveBayes }
-
/** The type of the model. */
- protected ModelType modelType;
+ protected AlgorithmType modelType;
/**
* Initializes an {@link AbstractModel}.
@@ -97,9 +96,9 @@ public final String getBestOutcome(double[] ocs) {
}
/**
- * @return Retrieves the {@link ModelType}.
+ * @return Retrieves the {@link AlgorithmType}.
*/
- public ModelType getModelType() {
+ public AlgorithmType getModelType() {
return modelType;
}
@@ -175,8 +174,7 @@ public int getNumOutcomes() {
*
* @return An {@link Object} array with the values as described above.
*
- * @implNote : This method will usually only be needed by
- * {@link opennlp.tools.ml.maxent.io.GISModelWriter GIS model writers}.
+ * @implNote : This method will usually only be needed by GIS model writers.
*/
public final Object[] getDataStructures() {
Object[] data = new Object[3];
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/AbstractModelReader.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/AbstractModelReader.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/AbstractModelReader.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/AbstractModelReader.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/AbstractModelWriter.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/AbstractModelWriter.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/AbstractModelWriter.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/AbstractModelWriter.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/BinaryFileDataReader.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/BinaryFileDataReader.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/BinaryFileDataReader.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/BinaryFileDataReader.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/ChecksumEventStream.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/ChecksumEventStream.java
similarity index 95%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/ChecksumEventStream.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/ChecksumEventStream.java
index 52af8edcb..fee553788 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/model/ChecksumEventStream.java
+++ b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/ChecksumEventStream.java
@@ -26,14 +26,13 @@
import opennlp.tools.util.ObjectStream;
/**
- * A {@link Checksum}-based {@link AbstractObjectStream event stream} implementation.
+ * A {@link Checksum}-based {@link ObjectStream event stream} implementation.
* Computes the checksum while consuming the event stream.
* By default, this implementation will use {@link CRC32C} for checksum calculations
* as it can use of CPU-specific acceleration instructions at runtime.
*
* @see Event
* @see Checksum
- * @see AbstractObjectStream
*/
public class ChecksumEventStream extends AbstractObjectStream {
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/ComparableEvent.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/ComparableEvent.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/ComparableEvent.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/ComparableEvent.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/ComparablePredicate.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/ComparablePredicate.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/ComparablePredicate.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/ComparablePredicate.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/DataIndexerFactory.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/DataIndexerFactory.java
similarity index 85%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/DataIndexerFactory.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/DataIndexerFactory.java
index 1e491148c..26a02cad5 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/model/DataIndexerFactory.java
+++ b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/DataIndexerFactory.java
@@ -21,7 +21,7 @@
import java.util.Map;
import opennlp.tools.ml.AbstractEventTrainer;
-import opennlp.tools.util.TrainingParameters;
+import opennlp.tools.util.Parameters;
import opennlp.tools.util.ext.ExtensionLoader;
import opennlp.tools.util.ext.ExtensionNotLoadedException;
@@ -33,17 +33,17 @@
public class DataIndexerFactory {
/**
- * Instantiates a {@link DataIndexer} configured via {@link TrainingParameters}.
+ * Instantiates a {@link DataIndexer} configured via {@link Parameters}.
*
- * @param parameters The {@link TrainingParameters} used for configuration.
+ * @param parameters The {@link Parameters} used for configuration.
* @param reportMap The {@link Map} used for reporting.
* @return A ready to use {@link DataIndexer} instance.
*
* @throws ExtensionNotLoadedException Thrown if a class name was configured for the indexer, yet
* the extension could not be loaded.
- * @see ExtensionLoader
*/
- public static DataIndexer getDataIndexer(TrainingParameters parameters, Map reportMap) {
+ public static
DataIndexer
getDataIndexer(
+ P parameters, Map reportMap) {
// The default is currently a 2-Pass data index. Is this what we really want?
String indexerParam = parameters.getStringParameter(AbstractEventTrainer.DATA_INDEXER_PARAM,
AbstractEventTrainer.DATA_INDEXER_TWO_PASS_VALUE);
@@ -53,7 +53,8 @@ public static DataIndexer getDataIndexer(TrainingParameters parameters, Map();
}
- DataIndexer indexer = switch (indexerParam) {
+ @SuppressWarnings("unchecked")
+ DataIndexer
indexer = (DataIndexer
) switch (indexerParam) {
case AbstractEventTrainer.DATA_INDEXER_ONE_PASS_VALUE -> new OnePassDataIndexer();
case AbstractEventTrainer.DATA_INDEXER_TWO_PASS_VALUE -> new TwoPassDataIndexer();
case AbstractEventTrainer.DATA_INDEXER_ONE_PASS_REAL_VALUE -> new OnePassRealValueDataIndexer();
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/DynamicEvalParameters.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/DynamicEvalParameters.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/DynamicEvalParameters.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/DynamicEvalParameters.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/EvalParameters.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/EvalParameters.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/EvalParameters.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/EvalParameters.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/FileEventStream.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/FileEventStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/FileEventStream.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/FileEventStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/GenericModelReader.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/GenericModelReader.java
similarity index 68%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/GenericModelReader.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/GenericModelReader.java
index 916c28e71..0b26a17c5 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/model/GenericModelReader.java
+++ b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/GenericModelReader.java
@@ -19,11 +19,9 @@
import java.io.File;
import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
-import opennlp.tools.ml.maxent.io.GISModelReader;
-import opennlp.tools.ml.maxent.io.QNModelReader;
-import opennlp.tools.ml.naivebayes.NaiveBayesModelReader;
-import opennlp.tools.ml.perceptron.PerceptronModelReader;
+import opennlp.tools.ml.AlgorithmType;
/**
* An generic {@link AbstractModelReader} implementation.
@@ -38,7 +36,6 @@ public class GenericModelReader extends AbstractModelReader {
* Initializes a {@link GenericModelReader} via a {@link File}.
*
* @param f The {@link File} that references the model to be read.
- *
* @throws IOException Thrown if IO errors occurred.
*/
public GenericModelReader(File f) throws IOException {
@@ -56,22 +53,21 @@ public GenericModelReader(DataReader dataReader) {
@Override
public void checkModelType() throws IOException {
- String modelType = readUTF();
- switch (modelType) {
- case "Perceptron":
- delegateModelReader = new PerceptronModelReader(this.dataReader);
- break;
- case "GIS":
- delegateModelReader = new GISModelReader(this.dataReader);
- break;
- case "QN":
- delegateModelReader = new QNModelReader(this.dataReader);
- break;
- case "NaiveBayes":
- delegateModelReader = new NaiveBayesModelReader(this.dataReader);
- break;
- default:
- throw new IOException("Unknown model format: " + modelType);
+ this.delegateModelReader = fromType(AlgorithmType.fromModelType(readUTF()));
+ }
+
+ private AbstractModelReader fromType(AlgorithmType type) {
+ try {
+ final Class extends AbstractModelReader> readerClass
+ = (Class extends AbstractModelReader>) Class.forName(type.getReaderClazz());
+
+ return readerClass.getDeclaredConstructor(DataReader.class).newInstance(this.dataReader);
+
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Given reader is not available in the classpath!", e);
+ } catch (InvocationTargetException | InstantiationException | IllegalAccessException |
+ NoSuchMethodException e) {
+ throw new RuntimeException("Problem instantiating chosen reader class: " + type.getReaderClazz(), e);
}
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/GenericModelWriter.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/GenericModelWriter.java
similarity index 76%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/GenericModelWriter.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/GenericModelWriter.java
index 9e7717ef4..2290b444d 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/model/GenericModelWriter.java
+++ b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/GenericModelWriter.java
@@ -22,13 +22,10 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
+import java.lang.reflect.InvocationTargetException;
import java.util.zip.GZIPOutputStream;
-import opennlp.tools.ml.maxent.io.BinaryGISModelWriter;
-import opennlp.tools.ml.maxent.io.BinaryQNModelWriter;
-import opennlp.tools.ml.model.AbstractModel.ModelType;
-import opennlp.tools.ml.naivebayes.BinaryNaiveBayesModelWriter;
-import opennlp.tools.ml.perceptron.BinaryPerceptronModelWriter;
+import opennlp.tools.ml.AlgorithmType;
/**
* An generic {@link AbstractModelWriter} implementation.
@@ -74,15 +71,23 @@ public GenericModelWriter(AbstractModel model, DataOutputStream dos) {
}
private void init(AbstractModel model, DataOutputStream dos) {
- if (model.getModelType() == ModelType.Perceptron) {
- delegateWriter = new BinaryPerceptronModelWriter(model, dos);
- } else if (model.getModelType() == ModelType.Maxent) {
- delegateWriter = new BinaryGISModelWriter(model, dos);
- } else if (model.getModelType() == ModelType.MaxentQn) {
- delegateWriter = new BinaryQNModelWriter(model, dos);
- }
- if (model.getModelType() == ModelType.NaiveBayes) {
- delegateWriter = new BinaryNaiveBayesModelWriter(model, dos);
+ this.delegateWriter = fromType(model.getModelType(), model, dos);
+ }
+
+ private AbstractModelWriter fromType(AlgorithmType type, AbstractModel model, DataOutputStream dos) {
+ try {
+ final Class extends AbstractModelWriter> readerClass
+ = (Class extends AbstractModelWriter>) Class.forName(type.getWriterClazz());
+
+ return readerClass
+ .getDeclaredConstructor(AbstractModel.class, DataOutputStream.class)
+ .newInstance(model, dos);
+
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Given writer is not available in the classpath!", e);
+ } catch (InvocationTargetException | InstantiationException | IllegalAccessException |
+ NoSuchMethodException e) {
+ throw new RuntimeException("Problem instantiating chosen writer class: " + type.getWriterClazz(), e);
}
}
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/ModelParameterChunker.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/ModelParameterChunker.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/ModelParameterChunker.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/ModelParameterChunker.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/MutableContext.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/MutableContext.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/MutableContext.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/MutableContext.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/ObjectDataReader.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/ObjectDataReader.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/ObjectDataReader.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/ObjectDataReader.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/OnePassDataIndexer.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/OnePassDataIndexer.java
similarity index 94%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/OnePassDataIndexer.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/OnePassDataIndexer.java
index 71d29199b..a1b74fdfa 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/model/OnePassDataIndexer.java
+++ b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/OnePassDataIndexer.java
@@ -28,6 +28,7 @@
import opennlp.tools.util.ObjectStream;
import opennlp.tools.util.ObjectStreamUtils;
+import opennlp.tools.util.Parameters;
import opennlp.tools.util.TrainingParameters;
/**
@@ -38,7 +39,7 @@
* @see DataIndexer
* @see AbstractDataIndexer
*/
-public class OnePassDataIndexer extends AbstractDataIndexer {
+public class OnePassDataIndexer extends AbstractDataIndexer {
private static final Logger logger = LoggerFactory.getLogger(OnePassDataIndexer.class);
@@ -49,8 +50,8 @@ public OnePassDataIndexer() {}
*/
@Override
public void index(ObjectStream eventStream) throws IOException {
- int cutoff = trainingParameters.getIntParameter(TrainingParameters.CUTOFF_PARAM,
- TrainingParameters.CUTOFF_DEFAULT_VALUE);
+ int cutoff = trainingParameters.getIntParameter(Parameters.CUTOFF_PARAM,
+ Parameters.CUTOFF_DEFAULT_VALUE);
boolean sort = trainingParameters.getBooleanParameter(SORT_PARAM, SORT_DEFAULT);
long start = System.currentTimeMillis();
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/OnePassRealValueDataIndexer.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/OnePassRealValueDataIndexer.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/OnePassRealValueDataIndexer.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/OnePassRealValueDataIndexer.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/PlainTextFileDataReader.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/PlainTextFileDataReader.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/PlainTextFileDataReader.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/PlainTextFileDataReader.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/RealValueFileEventStream.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/RealValueFileEventStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/RealValueFileEventStream.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/RealValueFileEventStream.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/SequenceStreamEventStream.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/SequenceStreamEventStream.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/SequenceStreamEventStream.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/SequenceStreamEventStream.java
diff --git a/opennlp-tools/src/test/java/opennlp/tools/ml/model/SimpleEventStreamBuilder.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/SimpleEventStreamBuilder.java
similarity index 100%
rename from opennlp-tools/src/test/java/opennlp/tools/ml/model/SimpleEventStreamBuilder.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/SimpleEventStreamBuilder.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/TwoPassDataIndexer.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/TwoPassDataIndexer.java
similarity index 96%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/TwoPassDataIndexer.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/TwoPassDataIndexer.java
index 005d7663f..66862e882 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/model/TwoPassDataIndexer.java
+++ b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/TwoPassDataIndexer.java
@@ -37,6 +37,7 @@
import org.slf4j.LoggerFactory;
import opennlp.tools.util.ObjectStream;
+import opennlp.tools.util.Parameters;
import opennlp.tools.util.TrainingParameters;
/**
@@ -51,7 +52,7 @@
* @see DataIndexer
* @see AbstractDataIndexer
*/
-public class TwoPassDataIndexer extends AbstractDataIndexer {
+public class TwoPassDataIndexer extends AbstractDataIndexer {
private static final Logger logger = LoggerFactory.getLogger(TwoPassDataIndexer.class);
@@ -62,8 +63,8 @@ public TwoPassDataIndexer() {}
*/
@Override
public void index(ObjectStream eventStream) throws IOException {
- int cutoff = trainingParameters.getIntParameter(TrainingParameters.CUTOFF_PARAM,
- TrainingParameters.CUTOFF_DEFAULT_VALUE);
+ int cutoff = trainingParameters.getIntParameter(Parameters.CUTOFF_PARAM,
+ Parameters.CUTOFF_DEFAULT_VALUE);
boolean sort = trainingParameters.getBooleanParameter(SORT_PARAM, SORT_DEFAULT);
logger.info("Indexing events with TwoPass using cutoff of {}", cutoff);
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/model/UniformPrior.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/UniformPrior.java
similarity index 100%
rename from opennlp-tools/src/main/java/opennlp/tools/ml/model/UniformPrior.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/ml/model/UniformPrior.java
diff --git a/opennlp-tools/src/main/java/opennlp/tools/monitoring/DefaultTrainingProgressMonitor.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/monitoring/DefaultTrainingProgressMonitor.java
similarity index 99%
rename from opennlp-tools/src/main/java/opennlp/tools/monitoring/DefaultTrainingProgressMonitor.java
rename to opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/monitoring/DefaultTrainingProgressMonitor.java
index 3b1265bb5..0e9de40d4 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/monitoring/DefaultTrainingProgressMonitor.java
+++ b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/monitoring/DefaultTrainingProgressMonitor.java
@@ -17,7 +17,6 @@
package opennlp.tools.monitoring;
-
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
diff --git a/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/util/TrainingParameters.java b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/util/TrainingParameters.java
new file mode 100644
index 000000000..6af97efe4
--- /dev/null
+++ b/opennlp-core/opennlp-ml/opennlp-ml-commons/src/main/java/opennlp/tools/util/TrainingParameters.java
@@ -0,0 +1,400 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package opennlp.tools.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.TreeMap;
+
+import opennlp.tools.ml.EventTrainer;
+
+/**
+ * Declares and handles default parameters used for or during training models.
+ */
+public class TrainingParameters implements Parameters {
+
+ private final Map parameters = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
+
+ /**
+ * No-arg constructor to create a default {@link TrainingParameters} instance.
+ */
+ public TrainingParameters() {
+ }
+
+ /**
+ * Copy constructor to hand over the config of existing {@link TrainingParameters}.
+ */
+ public TrainingParameters(TrainingParameters trainingParameters) {
+ this.parameters.putAll(trainingParameters.parameters);
+ }
+
+ /**
+ * Key-value based constructor to apply a {@link Map} based configuration initialization.
+ */
+ public TrainingParameters(Map map) {
+ parameters.putAll(map);
+ }
+
+ /**
+ * {@link InputStream} based constructor that reads in {@link TrainingParameters}.
+ *
+ * @throws IOException Thrown if IO errors occurred.
+ */
+ public TrainingParameters(InputStream in) throws IOException {
+
+ Properties properties = new Properties();
+ properties.load(in);
+
+ for (Map.Entry