opennlp-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject opennlp git commit: OPENNLP-947: Organize imports according to new order
Date Thu, 19 Jan 2017 14:33:47 GMT
Repository: opennlp
Updated Branches:
  refs/heads/master 9d4f7a03f -> 1788d2820


OPENNLP-947: Organize imports according to new order

This closes #75


Project: http://git-wip-us.apache.org/repos/asf/opennlp/repo
Commit: http://git-wip-us.apache.org/repos/asf/opennlp/commit/1788d282
Tree: http://git-wip-us.apache.org/repos/asf/opennlp/tree/1788d282
Diff: http://git-wip-us.apache.org/repos/asf/opennlp/diff/1788d282

Branch: refs/heads/master
Commit: 1788d2820668df9d4cbeb73b1e28ef88a203a7ec
Parents: 9d4f7a0
Author: smarthi <smarthi@apache.org>
Authored: Thu Jan 19 01:13:31 2017 -0500
Committer: Jörn Kottmann <joern@apache.org>
Committed: Thu Jan 19 15:32:59 2017 +0100

----------------------------------------------------------------------
 checkstyle.xml                                  |  15 +-
 .../lemmatizer/LemmatizerEvaluatorTool.java     |   3 +-
 .../tools/formats/DirectorySampleStream.java    |   7 +-
 .../tools/formats/EvalitaNameSampleStream.java  |   8 +-
 .../LeipzigDocumentSampleStreamFactory.java     |   2 +-
 .../tools/formats/brat/BratDocument.java        |   4 +-
 .../frenchtreebank/ConstitDocumentHandler.java  |   8 +-
 .../OntoNotesNameSampleStreamFactory.java       |   1 +
 .../OntoNotesParseSampleStreamFactory.java      |   1 +
 .../ml/maxent/io/PlainTextGISModelWriter.java   |   1 +
 .../PlainTextPerceptronModelWriter.java         |   1 +
 .../tools/namefind/TokenNameFinderModel.java    |   1 +
 .../opennlp/tools/parser/lang/en/HeadRules.java |   2 +-
 .../parser/lang/es/AncoraSpanishHeadRules.java  |   2 +-
 .../opennlp/tools/postag/POSTaggerFactory.java  |   1 +
 .../java/opennlp/tools/postag/POSTaggerME.java  |   2 +-
 .../tools/tokenize/TokenizerCrossValidator.java |   1 +
 .../opennlp/tools/tokenize/TokenizerME.java     |   1 +
 .../opennlp/tools/util/BaseToolFactory.java     |   3 +-
 .../main/java/opennlp/tools/util/ListHeap.java  |   2 +-
 .../OutcomePriorFeatureGenerator.java           |   1 -
 .../PreviousTwoMapFeatureGenerator.java         |   2 -
 .../tools/util/featuregen/StringPattern.java    | 145 +++++++++----------
 .../util/featuregen/WindowFeatureGenerator.java |   6 -
 .../formats/EvalitaNameSampleStreamTest.java    |  28 ++--
 .../opennlp/tools/ml/PrepAttachDataUtil.java    |   6 +-
 .../ml/maxent/quasinewton/LineSearchTest.java   |   2 +-
 .../tools/util/AbstractEventStreamTest.java     |   4 +-
 28 files changed, 123 insertions(+), 137 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/checkstyle.xml
----------------------------------------------------------------------
diff --git a/checkstyle.xml b/checkstyle.xml
index 2f4db8b..8d19c86 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -111,14 +111,13 @@
     <module name="EmptyCatchBlock">
       <property name="exceptionVariableName" value="expected|ignore"/>
     </module>
-    <!--<module name="CustomImportOrder">-->
-      <!--<property name="sortImportsInGroupAlphabetically" value="true"/>-->
-      <!--<property name="separateLineBetweenGroups" value="true"/>-->
-      <!--<property name="specialImportsRegExp" value="opennlp\."/>-->
-      <!--<property name="thirdPartyPackageRegExp" value="^opennlp\."/>-->
-      <!--<property name="customImportOrderRules"-->
-                <!--value="STANDARD_JAVA_PACKAGE###THIRD_PARTY_PACKAGE###SPECIAL_IMPORTS###SAME_PACKAGE(1)###STATIC"/>-->
-    <!--</module>-->
+    <module name="CustomImportOrder">
+      <property name="sortImportsInGroupAlphabetically" value="true"/>
+      <property name="separateLineBetweenGroups" value="true"/>
+      <property name="specialImportsRegExp" value="opennlp\."/>
+      <property name="customImportOrderRules"
+                value="STANDARD_JAVA_PACKAGE###THIRD_PARTY_PACKAGE###SPECIAL_IMPORTS###STATIC"/>
+    </module>
     <module name="EqualsHashCode"/>
   </module>
 </module>

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerEvaluatorTool.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerEvaluatorTool.java
b/opennlp-tools/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerEvaluatorTool.java
index a848fca..83924ec 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerEvaluatorTool.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/cmdline/lemmatizer/LemmatizerEvaluatorTool.java
@@ -29,14 +29,13 @@ import opennlp.tools.cmdline.ArgumentParser.ParameterDescription;
 import opennlp.tools.cmdline.CmdLineUtil;
 import opennlp.tools.cmdline.TerminateToolException;
 import opennlp.tools.cmdline.params.EvaluatorParams;
-import opennlp.tools.cmdline.lemmatizer.LemmatizerEvaluatorTool.EvalToolParams;
 import opennlp.tools.lemmatizer.LemmaSample;
 import opennlp.tools.lemmatizer.LemmatizerEvaluationMonitor;
 import opennlp.tools.lemmatizer.LemmatizerEvaluator;
 import opennlp.tools.lemmatizer.LemmatizerModel;
 
 public final class LemmatizerEvaluatorTool
-    extends AbstractEvaluatorTool<LemmaSample, EvalToolParams> {
+    extends AbstractEvaluatorTool<LemmaSample, LemmatizerEvaluatorTool.EvalToolParams>
{
 
   public LemmatizerEvaluatorTool() {
     super(LemmaSample.class, EvalToolParams.class);

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/formats/DirectorySampleStream.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/DirectorySampleStream.java
b/opennlp-tools/src/main/java/opennlp/tools/formats/DirectorySampleStream.java
index 47f4b67..931cb55 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/DirectorySampleStream.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/formats/DirectorySampleStream.java
@@ -39,16 +39,15 @@ public class DirectorySampleStream implements ObjectStream<File>
{
 
   private final FileFilter fileFilter;
 
-  private Stack<File> directories = new Stack<File>();
+  private Stack<File> directories = new Stack<>();
 
-  private Stack<File> textFiles = new Stack<File>();
+  private Stack<File> textFiles = new Stack<>();
 
   public DirectorySampleStream(File dirs[], FileFilter fileFilter, boolean recursive) {
-
     this.fileFilter = fileFilter;
     isRecursiveScan = recursive;
 
-    List<File> inputDirectoryList = new ArrayList<File>(dirs.length);
+    List<File> inputDirectoryList = new ArrayList<>(dirs.length);
 
     for (File dir : dirs) {
       if (!dir.isDirectory()) {

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/formats/EvalitaNameSampleStream.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/EvalitaNameSampleStream.java
b/opennlp-tools/src/main/java/opennlp/tools/formats/EvalitaNameSampleStream.java
index de2c543..dfdaf52 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/EvalitaNameSampleStream.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/formats/EvalitaNameSampleStream.java
@@ -91,7 +91,7 @@ public class EvalitaNameSampleStream implements ObjectStream<NameSample>
{
     this.types = types;
   }
 
-  static final Span extract(int begin, int end, String beginTag) throws InvalidFormatException
{
+  private static Span extract(int begin, int end, String beginTag) throws InvalidFormatException
{
 
     String type = beginTag.substring(2);
 
@@ -117,8 +117,8 @@ public class EvalitaNameSampleStream implements ObjectStream<NameSample>
{
 
   public NameSample read() throws IOException {
 
-    List<String> sentence = new ArrayList<String>();
-    List<String> tags = new ArrayList<String>();
+    List<String> sentence = new ArrayList<>();
+    List<String> tags = new ArrayList<>();
 
     boolean isClearAdaptiveData = false;
 
@@ -156,7 +156,7 @@ public class EvalitaNameSampleStream implements ObjectStream<NameSample>
{
     if (sentence.size() > 0) {
 
       // convert name tags into spans
-      List<Span> names = new ArrayList<Span>();
+      List<Span> names = new ArrayList<>();
 
       int beginIndex = -1;
       int endIndex = -1;

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/formats/LeipzigDocumentSampleStreamFactory.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/LeipzigDocumentSampleStreamFactory.java
b/opennlp-tools/src/main/java/opennlp/tools/formats/LeipzigDocumentSampleStreamFactory.java
index cc48d35..f0aea5e 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/LeipzigDocumentSampleStreamFactory.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/formats/LeipzigDocumentSampleStreamFactory.java
@@ -22,10 +22,10 @@ import java.io.FilenameFilter;
 import java.io.IOException;
 
 import opennlp.tools.cmdline.ArgumentParser;
+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.ArgumentParser.ParameterDescription;
 import opennlp.tools.cmdline.params.EncodingParameter;
 import opennlp.tools.doccat.DocumentSample;
 import opennlp.tools.util.ObjectStream;

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratDocument.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratDocument.java b/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratDocument.java
index d75d581..16c9deb 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratDocument.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratDocument.java
@@ -21,7 +21,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -74,7 +74,7 @@ public class BratDocument {
   public static BratDocument parseDocument(AnnotationConfiguration config, String id,
       InputStream txtIn, InputStream annIn) throws IOException {
 
-    Reader txtReader = new InputStreamReader(txtIn, Charset.forName("UTF-8"));
+    Reader txtReader = new InputStreamReader(txtIn, StandardCharsets.UTF_8);
 
     StringBuilder text = new StringBuilder();
 

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/formats/frenchtreebank/ConstitDocumentHandler.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/frenchtreebank/ConstitDocumentHandler.java
b/opennlp-tools/src/main/java/opennlp/tools/formats/frenchtreebank/ConstitDocumentHandler.java
index ed4f0be..a62a976 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/frenchtreebank/ConstitDocumentHandler.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/formats/frenchtreebank/ConstitDocumentHandler.java
@@ -21,15 +21,15 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Stack;
 
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
 import opennlp.tools.parser.AbstractBottomUpParser;
 import opennlp.tools.parser.Constituent;
 import opennlp.tools.parser.Parse;
 import opennlp.tools.util.Span;
 
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
 class ConstitDocumentHandler extends DefaultHandler {
 
   private static final String SENT_ELEMENT_NAME = "SENT";

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesNameSampleStreamFactory.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesNameSampleStreamFactory.java
b/opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesNameSampleStreamFactory.java
index 167e6db..2d42218 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesNameSampleStreamFactory.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesNameSampleStreamFactory.java
@@ -19,6 +19,7 @@ package opennlp.tools.formats.ontonotes;
 
 import java.io.File;
 import java.nio.charset.Charset;
+
 import opennlp.tools.cmdline.ArgumentParser;
 import opennlp.tools.cmdline.StreamFactoryRegistry;
 import opennlp.tools.formats.AbstractSampleStreamFactory;

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesParseSampleStreamFactory.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesParseSampleStreamFactory.java
b/opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesParseSampleStreamFactory.java
index 140d8df..fbc9357 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesParseSampleStreamFactory.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/formats/ontonotes/OntoNotesParseSampleStreamFactory.java
@@ -19,6 +19,7 @@ package opennlp.tools.formats.ontonotes;
 
 import java.io.File;
 import java.nio.charset.Charset;
+
 import opennlp.tools.cmdline.ArgumentParser;
 import opennlp.tools.cmdline.StreamFactoryRegistry;
 import opennlp.tools.formats.AbstractSampleStreamFactory;

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/PlainTextGISModelWriter.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/PlainTextGISModelWriter.java
b/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/PlainTextGISModelWriter.java
index 14dade2..355858b 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/PlainTextGISModelWriter.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/PlainTextGISModelWriter.java
@@ -26,6 +26,7 @@ import java.io.FileWriter;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.util.zip.GZIPOutputStream;
+
 import opennlp.tools.ml.model.AbstractModel;
 
 /**

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/ml/perceptron/PlainTextPerceptronModelWriter.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/ml/perceptron/PlainTextPerceptronModelWriter.java
b/opennlp-tools/src/main/java/opennlp/tools/ml/perceptron/PlainTextPerceptronModelWriter.java
index ab9e583..55f8e33 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/ml/perceptron/PlainTextPerceptronModelWriter.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/ml/perceptron/PlainTextPerceptronModelWriter.java
@@ -26,6 +26,7 @@ import java.io.FileWriter;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.util.zip.GZIPOutputStream;
+
 import opennlp.tools.ml.model.AbstractModel;
 
 /**

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinderModel.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinderModel.java
b/opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinderModel.java
index c78f28c..3eace84 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinderModel.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinderModel.java
@@ -25,6 +25,7 @@ import java.io.OutputStream;
 import java.net.URL;
 import java.util.Map;
 import java.util.Properties;
+
 import opennlp.tools.ml.BeamSearch;
 import opennlp.tools.ml.model.MaxentModel;
 import opennlp.tools.ml.model.SequenceClassificationModel;

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/parser/lang/en/HeadRules.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/parser/lang/en/HeadRules.java b/opennlp-tools/src/main/java/opennlp/tools/parser/lang/en/HeadRules.java
index 8893f02..d0e134f 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/parser/lang/en/HeadRules.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/parser/lang/en/HeadRules.java
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-
 package opennlp.tools.parser.lang.en;
 
 import java.io.BufferedReader;
@@ -35,6 +34,7 @@ import java.util.Objects;
 import java.util.Set;
 import java.util.Stack;
 import java.util.StringTokenizer;
+
 import opennlp.tools.parser.Constituent;
 import opennlp.tools.parser.GapLabeler;
 import opennlp.tools.parser.Parse;

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/parser/lang/es/AncoraSpanishHeadRules.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/parser/lang/es/AncoraSpanishHeadRules.java
b/opennlp-tools/src/main/java/opennlp/tools/parser/lang/es/AncoraSpanishHeadRules.java
index 7bffd58..5e0f7cc 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/parser/lang/es/AncoraSpanishHeadRules.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/parser/lang/es/AncoraSpanishHeadRules.java
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-
 package opennlp.tools.parser.lang.es;
 
 import java.io.BufferedReader;
@@ -34,6 +33,7 @@ import java.util.Objects;
 import java.util.Set;
 import java.util.Stack;
 import java.util.StringTokenizer;
+
 import opennlp.tools.parser.Constituent;
 import opennlp.tools.parser.GapLabeler;
 import opennlp.tools.parser.HeadRules;

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerFactory.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerFactory.java b/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerFactory.java
index 765f4a0..eb5466e 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerFactory.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerFactory.java
@@ -26,6 +26,7 @@ import java.util.Collections;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
+
 import opennlp.tools.dictionary.Dictionary;
 import opennlp.tools.ml.model.AbstractModel;
 import opennlp.tools.util.BaseToolFactory;

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java b/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java
index 8f4d94f..a0ffefc 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-
 package opennlp.tools.postag;
 
 import java.io.IOException;
@@ -25,6 +24,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.concurrent.atomic.AtomicInteger;
+
 import opennlp.tools.dictionary.Dictionary;
 import opennlp.tools.ml.BeamSearch;
 import opennlp.tools.ml.EventModelSequenceTrainer;

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenizerCrossValidator.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenizerCrossValidator.java
b/opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenizerCrossValidator.java
index 7344ab2..96d8d35 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenizerCrossValidator.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenizerCrossValidator.java
@@ -18,6 +18,7 @@
 package opennlp.tools.tokenize;
 
 import java.io.IOException;
+
 import opennlp.tools.util.ObjectStream;
 import opennlp.tools.util.TrainingParameters;
 import opennlp.tools.util.eval.CrossValidationPartitioner;

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenizerME.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenizerME.java b/opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenizerME.java
index adf9adb..a96e7cf 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenizerME.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenizerME.java
@@ -25,6 +25,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.regex.Pattern;
+
 import opennlp.tools.dictionary.Dictionary;
 import opennlp.tools.ml.EventTrainer;
 import opennlp.tools.ml.TrainerFactory;

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/util/BaseToolFactory.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/BaseToolFactory.java b/opennlp-tools/src/main/java/opennlp/tools/util/BaseToolFactory.java
index 448bc85..6aa6210 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/util/BaseToolFactory.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/util/BaseToolFactory.java
@@ -105,8 +105,7 @@ public abstract class BaseToolFactory {
 
     try {
       // load the ToolFactory using the default constructor
-      theFactory = ExtensionLoader.instantiateExtension(
-          BaseToolFactory.class, subclassName);
+      theFactory = ExtensionLoader.instantiateExtension(BaseToolFactory.class, subclassName);
 
       if (theFactory != null) {
         theFactory.init(artifactProvider);

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/util/ListHeap.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/ListHeap.java b/opennlp-tools/src/main/java/opennlp/tools/util/ListHeap.java
index 053612d..303b729 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/util/ListHeap.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/util/ListHeap.java
@@ -47,7 +47,7 @@ public class ListHeap<E extends Comparable<E>> implements Heap<E>
{
   public ListHeap(int sz, Comparator<E> c) {
     size = sz;
     comp = c;
-    list = new ArrayList<E>(sz);
+    list = new ArrayList<>(sz);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/OutcomePriorFeatureGenerator.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/OutcomePriorFeatureGenerator.java
b/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/OutcomePriorFeatureGenerator.java
index 7ea7ff4..59d6f10 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/OutcomePriorFeatureGenerator.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/OutcomePriorFeatureGenerator.java
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-
 package opennlp.tools.util.featuregen;
 
 import java.util.List;

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/PreviousTwoMapFeatureGenerator.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/PreviousTwoMapFeatureGenerator.java
b/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/PreviousTwoMapFeatureGenerator.java
index 114074b..275455d 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/PreviousTwoMapFeatureGenerator.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/PreviousTwoMapFeatureGenerator.java
@@ -33,7 +33,6 @@ public class PreviousTwoMapFeatureGenerator implements AdaptiveFeatureGenerator
    * Generates previous decision features for the token based on contents of the previous
map.
    */
   public void createFeatures(List<String> features, String[] tokens, int index, String[]
preds) {
-
     if (index > 0) {
       features.add("ppd=" + previousMap.get(tokens[index]) + "," +
           previousMap.get(tokens[index - 1]));
@@ -41,7 +40,6 @@ public class PreviousTwoMapFeatureGenerator implements AdaptiveFeatureGenerator
   }
 
   public void updateAdaptiveData(String[] tokens, String[] outcomes) {
-
     for (int i = 0; i < tokens.length; i++) {
       previousMap.put(tokens[i], outcomes[i]);
     }

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/StringPattern.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/StringPattern.java
b/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/StringPattern.java
index 571e26f..eae7bc4 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/StringPattern.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/StringPattern.java
@@ -44,72 +44,6 @@ public class StringPattern {
     this.digits = digits;
   }
 
-  /**
-   * @return true if all characters are letters.
-   */
-  public boolean isAllLetter() {
-    return (pattern & ALL_LETTERS) > 0;
-  }
-
-  /**
-   * @return true if first letter is capital.
-   */
-  public boolean isInitialCapitalLetter() {
-    return (pattern & INITAL_CAPITAL_LETTER) > 0;
-  }
-
-  /**
-   * @return true if all letters are capital.
-   */
-  public boolean isAllCapitalLetter() {
-    return (pattern & ALL_CAPITAL_LETTER) > 0;
-  }
-
-  /**
-   * @return true if all letters are lower case.
-   */
-  public boolean isAllLowerCaseLetter() {
-    return (pattern & ALL_LOWERCASE_LETTER) > 0;
-  }
-
-  /**
-   * @return true if all chars are digits.
-   */
-  public boolean isAllDigit() {
-    return (pattern & ALL_DIGIT) > 0;
-  }
-
-  /**
-   * Retrieves the number of digits.
-   */
-  public int digits() {
-    return digits;
-  }
-
-  public boolean containsPeriod() {
-    return (pattern & CONTAINS_PERIOD) > 0;
-  }
-
-  public boolean containsComma() {
-    return (pattern & CONTAINS_COMMA) > 0;
-  }
-
-  public boolean containsSlash() {
-    return (pattern & CONTAINS_SLASH) > 0;
-  }
-
-  public boolean containsDigit() {
-    return (pattern & CONTAINS_DIGIT) > 0;
-  }
-
-  public boolean containsHyphen() {
-    return (pattern & CONTAINS_HYPHEN) > 0;
-  }
-
-  public boolean containsLetters() {
-    return (pattern & CONTAINS_LETTERS) > 0;
-  }
-
   public static StringPattern recognize(String token) {
 
     int pattern = ALL_CAPITAL_LETTER | ALL_LOWERCASE_LETTER | ALL_DIGIT | ALL_LETTERS;
@@ -118,12 +52,10 @@ public class StringPattern {
 
     for (int i = 0; i < token.length(); i++) {
       final char ch = token.charAt(i);
-
       final int letterType = Character.getType(ch);
-
       boolean isLetter = letterType == Character.UPPERCASE_LETTER ||
           letterType == Character.LOWERCASE_LETTER ||
-          letterType == Character.TITLECASE_LETTER  ||
+          letterType == Character.TITLECASE_LETTER ||
           letterType == Character.MODIFIER_LETTER ||
           letterType == Character.OTHER_LETTER;
 
@@ -139,12 +71,10 @@ public class StringPattern {
           pattern |= CONTAINS_UPPERCASE;
 
           pattern &= ~ALL_LOWERCASE_LETTER;
-        }
-        else {
+        } else {
           pattern &= ~ALL_CAPITAL_LETTER;
         }
-      }
-      else {
+      } else {
         // contains chars other than letter, this means
         // it can not be one of these:
         pattern &= ~ALL_LETTERS;
@@ -154,8 +84,7 @@ public class StringPattern {
         if (letterType == Character.DECIMAL_DIGIT_NUMBER) {
           pattern |= CONTAINS_DIGIT;
           digits++;
-        }
-        else {
+        } else {
           pattern &= ~ALL_DIGIT;
         }
 
@@ -184,4 +113,70 @@ public class StringPattern {
 
     return new StringPattern(pattern, digits);
   }
+
+  /**
+   * @return true if all characters are letters.
+   */
+  public boolean isAllLetter() {
+    return (pattern & ALL_LETTERS) > 0;
+  }
+
+  /**
+   * @return true if first letter is capital.
+   */
+  public boolean isInitialCapitalLetter() {
+    return (pattern & INITAL_CAPITAL_LETTER) > 0;
+  }
+
+  /**
+   * @return true if all letters are capital.
+   */
+  public boolean isAllCapitalLetter() {
+    return (pattern & ALL_CAPITAL_LETTER) > 0;
+  }
+
+  /**
+   * @return true if all letters are lower case.
+   */
+  public boolean isAllLowerCaseLetter() {
+    return (pattern & ALL_LOWERCASE_LETTER) > 0;
+  }
+
+  /**
+   * @return true if all chars are digits.
+   */
+  public boolean isAllDigit() {
+    return (pattern & ALL_DIGIT) > 0;
+  }
+
+  /**
+   * Retrieves the number of digits.
+   */
+  public int digits() {
+    return digits;
+  }
+
+  public boolean containsPeriod() {
+    return (pattern & CONTAINS_PERIOD) > 0;
+  }
+
+  public boolean containsComma() {
+    return (pattern & CONTAINS_COMMA) > 0;
+  }
+
+  public boolean containsSlash() {
+    return (pattern & CONTAINS_SLASH) > 0;
+  }
+
+  public boolean containsDigit() {
+    return (pattern & CONTAINS_DIGIT) > 0;
+  }
+
+  public boolean containsHyphen() {
+    return (pattern & CONTAINS_HYPHEN) > 0;
+  }
+
+  public boolean containsLetters() {
+    return (pattern & CONTAINS_LETTERS) > 0;
+  }
 }

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/WindowFeatureGenerator.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/WindowFeatureGenerator.java
b/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/WindowFeatureGenerator.java
index 2fc4788..442a097 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/WindowFeatureGenerator.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/WindowFeatureGenerator.java
@@ -90,11 +90,8 @@ public class WindowFeatureGenerator implements AdaptiveFeatureGenerator
{
     // previous features
     for (int i = 1; i < prevWindowSize + 1; i++) {
       if (index - i >= 0) {
-
         List<String> prevFeatures = new ArrayList<>();
-
         generator.createFeatures(prevFeatures, tokens, index - i, preds);
-
         for (String prevFeature : prevFeatures) {
           features.add(PREV_PREFIX + i + prevFeature);
         }
@@ -104,11 +101,8 @@ public class WindowFeatureGenerator implements AdaptiveFeatureGenerator
{
     // next features
     for (int i = 1; i < nextWindowSize + 1; i++) {
       if (i + index < tokens.length) {
-
         List<String> nextFeatures = new ArrayList<>();
-
         generator.createFeatures(nextFeatures, tokens, index + i, preds);
-
         for (String nextFeature : nextFeatures) {
           features.add(NEXT_PREFIX + i + nextFeature);
         }

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/test/java/opennlp/tools/formats/EvalitaNameSampleStreamTest.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/test/java/opennlp/tools/formats/EvalitaNameSampleStreamTest.java
b/opennlp-tools/src/test/java/opennlp/tools/formats/EvalitaNameSampleStreamTest.java
index 762ab05..bbb720b 100644
--- a/opennlp-tools/src/test/java/opennlp/tools/formats/EvalitaNameSampleStreamTest.java
+++ b/opennlp-tools/src/test/java/opennlp/tools/formats/EvalitaNameSampleStreamTest.java
@@ -19,6 +19,7 @@ package opennlp.tools.formats;
 
 import java.io.IOException;
 
+import org.junit.Assert;
 import org.junit.Test;
 
 import opennlp.tools.formats.EvalitaNameSampleStream.LANGUAGE;
@@ -27,10 +28,6 @@ import opennlp.tools.util.InputStreamFactory;
 import opennlp.tools.util.ObjectStream;
 import opennlp.tools.util.Span;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
 /**
  * Note:
  * Sample training data must be UTF-8 encoded and uncompressed!
@@ -51,30 +48,27 @@ public class EvalitaNameSampleStreamTest {
 
     NameSample personName = sampleStream.read();
 
-    assertNotNull(personName);
+    Assert.assertNotNull(personName);
 
-    assertEquals(11, personName.getSentence().length);
-    assertEquals(1, personName.getNames().length);
-    assertEquals(true, personName.isClearAdaptiveDataSet());
+    Assert.assertEquals(11, personName.getSentence().length);
+    Assert.assertEquals(1, personName.getNames().length);
+    Assert.assertEquals(true, personName.isClearAdaptiveDataSet());
 
     Span nameSpan = personName.getNames()[0];
-    assertEquals(8, nameSpan.getStart());
-    assertEquals(10, nameSpan.getEnd());
-    assertEquals(true, personName.isClearAdaptiveDataSet());
+    Assert.assertEquals(8, nameSpan.getStart());
+    Assert.assertEquals(10, nameSpan.getEnd());
+    Assert.assertEquals(true, personName.isClearAdaptiveDataSet());
 
-    assertEquals(0, sampleStream.read().getNames().length);
+    Assert.assertEquals(0, sampleStream.read().getNames().length);
 
-    assertNull(sampleStream.read());
+    Assert.assertNull(sampleStream.read());
   }
 
   @Test
   public void testReset() throws IOException {
     ObjectStream<NameSample> sampleStream = openData(LANGUAGE.IT, "evalita-ner-it.sample");
-
     NameSample sample = sampleStream.read();
-
     sampleStream.reset();
-
-    assertEquals(sample, sampleStream.read());
+    Assert.assertEquals(sample, sampleStream.read());
   }
 }

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/test/java/opennlp/tools/ml/PrepAttachDataUtil.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/test/java/opennlp/tools/ml/PrepAttachDataUtil.java b/opennlp-tools/src/test/java/opennlp/tools/ml/PrepAttachDataUtil.java
index 5fb9097..7cb7968 100644
--- a/opennlp-tools/src/test/java/opennlp/tools/ml/PrepAttachDataUtil.java
+++ b/opennlp-tools/src/test/java/opennlp/tools/ml/PrepAttachDataUtil.java
@@ -70,9 +70,11 @@ public class PrepAttachDataUtil {
       double[] ocs = model.eval(ev.getContext());
 
       int best = 0;
-      for (int i = 1; i < ocs.length; i++)
-        if (ocs[i] > ocs[best])
+      for (int i = 1; i < ocs.length; i++) {
+        if (ocs[i] > ocs[best]) {
           best = i;
+        }
+      }
 
       String predictedLabel = model.getOutcome(best);
 

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/test/java/opennlp/tools/ml/maxent/quasinewton/LineSearchTest.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/test/java/opennlp/tools/ml/maxent/quasinewton/LineSearchTest.java
b/opennlp-tools/src/test/java/opennlp/tools/ml/maxent/quasinewton/LineSearchTest.java
index 4ed6879..f797ae7 100644
--- a/opennlp-tools/src/test/java/opennlp/tools/ml/maxent/quasinewton/LineSearchTest.java
+++ b/opennlp-tools/src/test/java/opennlp/tools/ml/maxent/quasinewton/LineSearchTest.java
@@ -25,7 +25,7 @@ import org.junit.Test;
 import opennlp.tools.ml.maxent.quasinewton.LineSearch.LineSearchResult;
 
 public class LineSearchTest {
-  public static final double TOLERANCE = 0.01;
+  private static final double TOLERANCE = 0.01;
 
   @Test
   public void testLineSearchDeterminesSaneStepLength1() {

http://git-wip-us.apache.org/repos/asf/opennlp/blob/1788d282/opennlp-tools/src/test/java/opennlp/tools/util/AbstractEventStreamTest.java
----------------------------------------------------------------------
diff --git a/opennlp-tools/src/test/java/opennlp/tools/util/AbstractEventStreamTest.java b/opennlp-tools/src/test/java/opennlp/tools/util/AbstractEventStreamTest.java
index c94896a..770d97a 100644
--- a/opennlp-tools/src/test/java/opennlp/tools/util/AbstractEventStreamTest.java
+++ b/opennlp-tools/src/test/java/opennlp/tools/util/AbstractEventStreamTest.java
@@ -23,11 +23,11 @@ import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
-import opennlp.tools.ml.model.Event;
-
 import org.junit.Assert;
 import org.junit.Test;
 
+import opennlp.tools.ml.model.Event;
+
 /**
  * Tests for the {@link AbstractEventStream} class.
  */


Mime
View raw message