You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by jz...@apache.org on 2023/01/03 14:54:32 UTC

[opennlp] branch main updated: OPENNLP-1434 Enhance JavaDoc in opennlp.uima packages (#479)

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

jzemerick pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opennlp.git


The following commit(s) were added to refs/heads/main by this push:
     new c5bceff5 OPENNLP-1434 Enhance JavaDoc in opennlp.uima packages (#479)
c5bceff5 is described below

commit c5bceff5774242cbef2b71df2e2554ba20d7bb43
Author: Martin Wiesner <ma...@users.noreply.github.com>
AuthorDate: Tue Jan 3 15:54:25 2023 +0100

    OPENNLP-1434 Enhance JavaDoc in opennlp.uima packages (#479)
    
    - adds missing JavaDoc
    - improves existing documentation for clarity
    - removes superfluous text
    - adds test-scoped dependency to slf4j-simple logger binding to avoid NOOP error messages when UIMA tests are run
    - adds 'final' modifier where useful and applicable
    - adds 'Override' annotation where useful and applicable
    - fixes several (funny) typos, eg in `ExceptionMessages`
---
 opennlp-uima/pom.xml                               |  13 ++
 .../main/java/opennlp/uima/chunker/Chunker.java    |  12 +-
 .../uima/chunker/ChunkerModelResourceImpl.java     |   1 +
 .../uima/doccat/AbstractDocumentCategorizer.java   |   4 +-
 .../uima/doccat/DoccatModelResourceImpl.java       |   1 +
 .../opennlp/uima/doccat/DocumentCategorizer.java   |   4 +-
 .../java/opennlp/uima/doccat/LanguageDetector.java |   8 +-
 .../opennlp/uima/namefind/AbstractNameFinder.java  |  10 +-
 .../uima/namefind/DictionaryNameFinder.java        |   3 +
 .../java/opennlp/uima/namefind/NameFinder.java     |   6 +
 .../namefind/TokenNameFinderModelResourceImpl.java |   1 +
 .../java/opennlp/uima/normalizer/Normalizer.java   |   4 +-
 .../java/opennlp/uima/normalizer/NumberUtil.java   |  34 +--
 .../opennlp/uima/normalizer/StringDictionary.java  |  38 +--
 .../opennlp/uima/util/AbstractModelResource.java   |   8 +
 .../opennlp/uima/util/AnnotationComboIterator.java |  14 +-
 .../opennlp/uima/util/AnnotationComparator.java    |   8 +-
 .../opennlp/uima/util/AnnotationIteratorPair.java  |   9 +-
 .../main/java/opennlp/uima/util/AnnotatorUtil.java | 254 +++++++++++++++------
 .../opennlp/uima/util/ContainingConstraint.java    |  14 +-
 .../java/opennlp/uima/util/ExceptionMessages.java  |   2 +-
 .../main/java/opennlp/uima/util/OpennlpUtil.java   |  31 ++-
 .../src/main/java/opennlp/uima/util/UimaUtil.java  |  10 +-
 23 files changed, 346 insertions(+), 143 deletions(-)

diff --git a/opennlp-uima/pom.xml b/opennlp-uima/pom.xml
index 82cf7701..1e893790 100644
--- a/opennlp-uima/pom.xml
+++ b/opennlp-uima/pom.xml
@@ -42,6 +42,12 @@
 		</repository>
 	</repositories>
 
+	<properties>
+		<!--This property should be aligned with the version UIMA uses-->
+		<slf4j.version>1.7.36</slf4j.version>
+	</properties>
+
+
 	<dependencies>
 		<dependency>
 			<groupId>org.apache.opennlp</groupId>
@@ -73,6 +79,13 @@
 			<artifactId>junit-jupiter-engine</artifactId>
 			<scope>test</scope>
 		</dependency>
+
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-simple</artifactId>
+			<version>${slf4j.version}</version>
+			<scope>test</scope>
+		</dependency>
 	</dependencies>
 
 	<build>
diff --git a/opennlp-uima/src/main/java/opennlp/uima/chunker/Chunker.java b/opennlp-uima/src/main/java/opennlp/uima/chunker/Chunker.java
index 2edaba78..3219744c 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/chunker/Chunker.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/chunker/Chunker.java
@@ -81,15 +81,13 @@ public final class Chunker extends CasAnnotator_ImplBase {
 
   private UimaContext context;
 
-  private Logger mLogger;
-
   private Feature mChunkFeature;
 
   /**
    * Initializes a new instance.
    * <p>
    * Note: Use {@link #initialize(UimaContext) } to initialize
-   * this instance. Not use the constructor.
+   * this instance. Don't use the constructor.
    */
   public Chunker() {
     // must not be implemented !
@@ -107,7 +105,7 @@ public final class Chunker extends CasAnnotator_ImplBase {
 
     this.context = context;
 
-    mLogger = context.getLogger();
+    Logger mLogger = context.getLogger();
 
     if (mLogger.isLoggable(Level.INFO)) {
       mLogger.log(Level.INFO, "Initializing the OpenNLP Chunker annotator.");
@@ -161,8 +159,11 @@ public final class Chunker extends CasAnnotator_ImplBase {
   }
 
   /**
-   * Performs chunking on the given tcas object.
+   * Performs chunking on the given {@code tcas} object.
+   *
+   * @param tcas The {@link CAS} object to process.
    */
+  @Override
   public void process(CAS tcas) {
 
     FSIndex<AnnotationFS> tokenAnnotationIndex = tcas.getAnnotationIndex(mTokenType);
@@ -223,6 +224,7 @@ public final class Chunker extends CasAnnotator_ImplBase {
   /**
    * Releases allocated resources.
    */
+  @Override
   public void destroy() {
     // dereference model to allow garbage collection
     mChunker = null;
diff --git a/opennlp-uima/src/main/java/opennlp/uima/chunker/ChunkerModelResourceImpl.java b/opennlp-uima/src/main/java/opennlp/uima/chunker/ChunkerModelResourceImpl.java
index fb9a5b72..a40657a9 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/chunker/ChunkerModelResourceImpl.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/chunker/ChunkerModelResourceImpl.java
@@ -26,6 +26,7 @@ import opennlp.uima.util.AbstractModelResource;
 public class ChunkerModelResourceImpl extends AbstractModelResource<ChunkerModel>
     implements ChunkerModelResource {
 
+  @Override
   public ChunkerModel getModel() {
     return model;
   }
diff --git a/opennlp-uima/src/main/java/opennlp/uima/doccat/AbstractDocumentCategorizer.java b/opennlp-uima/src/main/java/opennlp/uima/doccat/AbstractDocumentCategorizer.java
index 4b49dcaf..4b372915 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/doccat/AbstractDocumentCategorizer.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/doccat/AbstractDocumentCategorizer.java
@@ -40,7 +40,7 @@ import opennlp.uima.util.UimaUtil;
 
 /**
  * Abstract document categorizer which can be implemented to define how the
- * output of the categorizer should be written into the CAS.
+ * output of the {@link DocumentCategorizer} should be written into the CAS.
  */
 abstract class AbstractDocumentCategorizer extends CasAnnotator_ImplBase {
 
@@ -77,6 +77,7 @@ abstract class AbstractDocumentCategorizer extends CasAnnotator_ImplBase {
     mCategorizer = new DocumentCategorizerME(model);
   }
 
+  @Override
   public void typeSystemInit(TypeSystem typeSystem) throws AnalysisEngineProcessException {
     mTokenType = AnnotatorUtil.getRequiredTypeParameter(context, typeSystem,
         UimaUtil.TOKEN_TYPE_PARAMETER);
@@ -84,6 +85,7 @@ abstract class AbstractDocumentCategorizer extends CasAnnotator_ImplBase {
 
   protected abstract void setBestCategory(CAS cas, String bestCategory);
 
+  @Override
   public void process(CAS cas) {
 
     FSIterator<AnnotationFS> tokenAnnotations = cas.getAnnotationIndex(mTokenType).iterator();
diff --git a/opennlp-uima/src/main/java/opennlp/uima/doccat/DoccatModelResourceImpl.java b/opennlp-uima/src/main/java/opennlp/uima/doccat/DoccatModelResourceImpl.java
index b9443c53..11d3821e 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/doccat/DoccatModelResourceImpl.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/doccat/DoccatModelResourceImpl.java
@@ -26,6 +26,7 @@ import opennlp.uima.util.AbstractModelResource;
 public class DoccatModelResourceImpl extends AbstractModelResource<DoccatModel>
     implements DoccatModelResource {
 
+  @Override
   public DoccatModel getModel() {
     return model;
   }
diff --git a/opennlp-uima/src/main/java/opennlp/uima/doccat/DocumentCategorizer.java b/opennlp-uima/src/main/java/opennlp/uima/doccat/DocumentCategorizer.java
index 0f83f853..f57be0b3 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/doccat/DocumentCategorizer.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/doccat/DocumentCategorizer.java
@@ -28,9 +28,7 @@ import org.apache.uima.cas.text.AnnotationFS;
 import opennlp.uima.util.AnnotatorUtil;
 
 /**
- * OpenNLP Document Categorizer.
- * <p>
- * Mandatory parameters:
+ * A default implementation of an OpenNLP Document Categorizer.
  */
 public class DocumentCategorizer extends AbstractDocumentCategorizer {
 
diff --git a/opennlp-uima/src/main/java/opennlp/uima/doccat/LanguageDetector.java b/opennlp-uima/src/main/java/opennlp/uima/doccat/LanguageDetector.java
index a8daa429..8d072c42 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/doccat/LanguageDetector.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/doccat/LanguageDetector.java
@@ -20,9 +20,11 @@ package opennlp.uima.doccat;
 import org.apache.uima.cas.CAS;
 
 /**
- * Analysis Engine which can detected the language of a text. The AE uses the OpenNLP document
- * categorizer and a special language detection model. The outcome of the document categorizer
- * model is written into the language field of the CAS view.
+ * Analysis Engine (AE) which can detect the language of a text.
+ * <p>
+ * The AE uses the OpenNLP {@link DocumentCategorizer} and a special language detection model.
+ * The outcome of the document categorizer model is written into the language field of
+ * the {@link CAS} view.
  */
 public class LanguageDetector extends AbstractDocumentCategorizer {
 
diff --git a/opennlp-uima/src/main/java/opennlp/uima/namefind/AbstractNameFinder.java b/opennlp-uima/src/main/java/opennlp/uima/namefind/AbstractNameFinder.java
index 67efb55e..5055cdc7 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/namefind/AbstractNameFinder.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/namefind/AbstractNameFinder.java
@@ -40,6 +40,9 @@ import opennlp.uima.util.AnnotationIteratorPair;
 import opennlp.uima.util.AnnotatorUtil;
 import opennlp.uima.util.UimaUtil;
 
+/**
+ * Base implementation of a name finder.
+ */
 abstract class AbstractNameFinder extends CasAnnotator_ImplBase {
 
   protected final String name;
@@ -65,6 +68,7 @@ abstract class AbstractNameFinder extends CasAnnotator_ImplBase {
   protected void initialize() throws ResourceInitializationException {
   }
 
+  @Override
   public final void initialize(UimaContext context) throws ResourceInitializationException {
 
     super.initialize(context);
@@ -88,8 +92,9 @@ abstract class AbstractNameFinder extends CasAnnotator_ImplBase {
   }
 
   /**
-   * Initializes the type system.
+   * Initializes the {@link TypeSystem}.
    */
+  @Override
   public void typeSystemInit(TypeSystem typeSystem)
       throws AnalysisEngineProcessException {
 
@@ -147,8 +152,9 @@ abstract class AbstractNameFinder extends CasAnnotator_ImplBase {
   protected abstract Span[] find(CAS cas, String[] tokens);
 
   /**
-   * Performs name finding on the given cas object.
+   * Performs name finding on the given {@link CAS} object.
    */
+  @Override
   public final void process(CAS cas) {
 
     if (isRemoveExistingAnnotations) {
diff --git a/opennlp-uima/src/main/java/opennlp/uima/namefind/DictionaryNameFinder.java b/opennlp-uima/src/main/java/opennlp/uima/namefind/DictionaryNameFinder.java
index 5920de35..b3196246 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/namefind/DictionaryNameFinder.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/namefind/DictionaryNameFinder.java
@@ -50,6 +50,7 @@ public class DictionaryNameFinder extends AbstractNameFinder {
    * <p>
    * Note: Do all initialization in this method, do not use the constructor.
    */
+  @Override
   public void initialize() throws ResourceInitializationException {
 
     Dictionary nameFinderDictionary;
@@ -83,6 +84,7 @@ public class DictionaryNameFinder extends AbstractNameFinder {
         nameFinderDictionary);
   }
 
+  @Override
   protected Span[] find(CAS cas, String[] tokens) {
     return mNameFinder.find(tokens);
   }
@@ -90,6 +92,7 @@ public class DictionaryNameFinder extends AbstractNameFinder {
   /**
    * Releases allocated resources.
    */
+  @Override
   public void destroy() {
     mNameFinder = null;
   }
diff --git a/opennlp-uima/src/main/java/opennlp/uima/namefind/NameFinder.java b/opennlp-uima/src/main/java/opennlp/uima/namefind/NameFinder.java
index 2a844cfc..bce0105d 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/namefind/NameFinder.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/namefind/NameFinder.java
@@ -112,6 +112,7 @@ public final class NameFinder extends AbstractNameFinder {
    * <p>
    * Note: Do all initialization in this method, do not use the constructor.
    */
+  @Override
   public void initialize()
       throws ResourceInitializationException {
 
@@ -134,6 +135,7 @@ public final class NameFinder extends AbstractNameFinder {
   /**
    * Initializes the type system.
    */
+  @Override
   public void typeSystemInit(TypeSystem typeSystem)
       throws AnalysisEngineProcessException {
 
@@ -152,6 +154,7 @@ public final class NameFinder extends AbstractNameFinder {
     }
   }
 
+  @Override
   protected Span[] find(CAS cas, String[] tokens) {
 
     Span[] names = mNameFinder.find(tokens);
@@ -165,6 +168,7 @@ public final class NameFinder extends AbstractNameFinder {
     return names;
   }
 
+  @Override
   protected void postProcessAnnotations(Span[] detectedNames,
                                         AnnotationFS[] nameAnnotations) {
 
@@ -177,6 +181,7 @@ public final class NameFinder extends AbstractNameFinder {
     }
   }
 
+  @Override
   protected void documentDone(CAS cas) {
 
     // TODO: Create confidence FS
@@ -200,6 +205,7 @@ public final class NameFinder extends AbstractNameFinder {
   /**
    * Releases allocated resources.
    */
+  @Override
   public void destroy() {
     mNameFinder = null;
   }
diff --git a/opennlp-uima/src/main/java/opennlp/uima/namefind/TokenNameFinderModelResourceImpl.java b/opennlp-uima/src/main/java/opennlp/uima/namefind/TokenNameFinderModelResourceImpl.java
index 357cf1b3..b978e569 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/namefind/TokenNameFinderModelResourceImpl.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/namefind/TokenNameFinderModelResourceImpl.java
@@ -26,6 +26,7 @@ import opennlp.uima.util.AbstractModelResource;
 public class TokenNameFinderModelResourceImpl extends AbstractModelResource<TokenNameFinderModel>
     implements TokenNameFinderModelResource {
 
+  @Override
   public TokenNameFinderModel getModel() {
     return model;
   }
diff --git a/opennlp-uima/src/main/java/opennlp/uima/normalizer/Normalizer.java b/opennlp-uima/src/main/java/opennlp/uima/normalizer/Normalizer.java
index 23c31750..c303a02e 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/normalizer/Normalizer.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/normalizer/Normalizer.java
@@ -54,8 +54,8 @@ import opennlp.uima.util.UimaUtil;
  * or period boolean tokens must be parsed eg is there any ???
  * <p>
  * <p>
- * restricted set of outcomes throw error if not matched or silently fail
- * unrestricted set of outcomes
+ * Restricted set of outcomes throw an error if not matched or silently fail
+ * unrestricted set of outcomes.
  */
 public class Normalizer extends CasAnnotator_ImplBase {
 
diff --git a/opennlp-uima/src/main/java/opennlp/uima/normalizer/NumberUtil.java b/opennlp-uima/src/main/java/opennlp/uima/normalizer/NumberUtil.java
index e3544b10..73fd1575 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/normalizer/NumberUtil.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/normalizer/NumberUtil.java
@@ -22,15 +22,14 @@ import java.text.ParseException;
 import java.util.Locale;
 
 /**
- * This class contains methods to parse numbers which occur
- * in natural language texts.
+ * Provides methods to parse numbers which occur in natural language texts.
  */
 public final class NumberUtil {
 
   /**
    * Checks if the language is supported.
    *
-   * @param languageCode language code, e.g. "en", "pt"
+   * @param languageCode A ISO conform language code, e.g. "en", "pt"
    * @return true if the language is supported
    */
   public static boolean isLanguageSupported(String languageCode) {
@@ -41,7 +40,7 @@ public final class NumberUtil {
     boolean isLocaleSupported = false;
 
     for (Locale possibleLocale : possibleLocales) {
-      // search if local is contained
+      // search if locale is contained
       if (possibleLocale.equals(locale)) {
         isLocaleSupported = true;
         break;
@@ -52,31 +51,36 @@ public final class NumberUtil {
   }
 
   /**
-   * Removes trailing and containing space.
+   * Removes a character from given string {@code s}.
+   *
+   * @param s The string to process.
+   * @param remove The {@link Character} to remove from {@code s}.
    */
-  private static String removeChar(String string, char remove) {
+  private static String removeChar(String s, char remove) {
 
     StringBuilder result = new StringBuilder();
 
     int lastPosition = 0;
-    int position = 0;
-    while ((position = string.indexOf(remove, lastPosition)) != -1) {
-      result.append(string.substring(lastPosition, position));
+    int position;
+    while ((position = s.indexOf(remove, lastPosition)) != -1) {
+      result.append(s.substring(lastPosition, position));
       lastPosition = position + 1;
     }
 
-    result.append(string.substring(lastPosition, string.length()));
+    result.append(s.substring(lastPosition, s.length()));
 
     return result.toString();
   }
 
   /**
-   * Gives its best to parse the provided number.
+   * Parses a specified {@link String number} for a certain {@code languageCode}.
    *
-   * @param number number to parse
-   * @param languageCode language code, e.g. "en", "pt"
-   * @return parsed number
-   * @throws ParseException ParseException
+   * @param number The suspected number to parse.
+   * @param languageCode A ISO conform language code, e.g. "en", "pt"
+   *                     
+   * @return The parsed {@link Number}.
+   * @throws ParseException Thrown if errors occurred during parsing.
+   * @throws IllegalArgumentException Thrown if the {@code languageCode} is not supported.
    */
   public static Number parse(String number, String languageCode)
       throws ParseException {
diff --git a/opennlp-uima/src/main/java/opennlp/uima/normalizer/StringDictionary.java b/opennlp-uima/src/main/java/opennlp/uima/normalizer/StringDictionary.java
index 993e8dac..f96e88d8 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/normalizer/StringDictionary.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/normalizer/StringDictionary.java
@@ -29,19 +29,18 @@ import opennlp.tools.dictionary.serializer.DictionaryEntryPersistor;
 import opennlp.tools.dictionary.serializer.Entry;
 import opennlp.tools.util.StringList;
 
-// lookup a string for given token list
 public class StringDictionary {
 
-  private Map<StringList, String> entries = new HashMap<>();
+  private final Map<StringList, String> entries = new HashMap<>();
 
   public StringDictionary() {
   }
 
   /**
-   * Initializes the current instance.
+   * Initializes {@link StringDictionary} via a specified {@link InputStream}.
    *
-   * @param in
-   * @throws IOException
+   * @param in A valid, open {@link InputStream} to initialize with.
+   * @throws IOException Thrown if IO errors occurred.
    */
   public StringDictionary(InputStream in) throws IOException {
     DictionaryEntryPersistor.create(in, entry -> {
@@ -51,17 +50,21 @@ public class StringDictionary {
   }
 
   /**
-   * Returns a corresponding String value from hash map.
-   * @param key key to get value with
+   * Retrieves a value from a dictionary via its {@code key}.
+   * 
+   * @param key The {@link StringList key} to get value with.
+   *            
+   * @return Retrieves a corresponding String value or {@code null} if not found.
    */
   public String get(StringList key) {
     return entries.get(key);
   }
 
   /**
-   * Adds a new entry to hash map.
-   * @param key key to put
-   * @param value value to put
+   * Adds a new entry to the dictionary.
+   *
+   * @param key The {@link StringList key} under which to put the {@code value}.
+   * @param value The value to put.
    */
   public void put(StringList key, String value) {
     entries.put(key, value);
@@ -72,20 +75,22 @@ public class StringDictionary {
   }
 
   /**
-   * Writes the ngram instance to the given {@link OutputStream}.
+   * Writes the dictionary to the given {@link OutputStream}.
    *
-   * @param out
-   * @throws IOException
-   *           if an I/O Error during writing occures
+   * @param out A valid, open {@link OutputStream} to serialize to.
+   *            
+   * @throws IOException Thrown if IO errors occurred during serialization.
    */
   public void serialize(OutputStream out) throws IOException {
-    Iterator<Entry> entryIterator = new Iterator<Entry>() {
-      private Iterator<StringList> mDictionaryIterator = StringDictionary.this.iterator();
+    Iterator<Entry> entryIterator = new Iterator<>() {
+      private final Iterator<StringList> mDictionaryIterator = StringDictionary.this.iterator();
 
+      @Override
       public boolean hasNext() {
         return mDictionaryIterator.hasNext();
       }
 
+      @Override
       public Entry next() {
 
         StringList tokens = mDictionaryIterator.next();
@@ -97,6 +102,7 @@ public class StringDictionary {
         return new Entry(tokens, attributes);
       }
 
+      @Override
       public void remove() {
         throw new UnsupportedOperationException();
       }
diff --git a/opennlp-uima/src/main/java/opennlp/uima/util/AbstractModelResource.java b/opennlp-uima/src/main/java/opennlp/uima/util/AbstractModelResource.java
index 7dff4e50..21405a7f 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/util/AbstractModelResource.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/util/AbstractModelResource.java
@@ -24,12 +24,20 @@ import org.apache.uima.resource.DataResource;
 import org.apache.uima.resource.ResourceInitializationException;
 import org.apache.uima.resource.SharedResourceObject;
 
+/**
+ * Base class provides access to a shared {@link T resource}, eg. a model or dictionary.
+ *
+ * @param <T> The generic type to handle as a shared resource.
+ *
+ * @see SharedResourceObject
+ */
 public abstract class AbstractModelResource<T> implements SharedResourceObject {
 
   protected T model;
 
   protected abstract T loadModel(InputStream in) throws IOException;
 
+  @Override
   public void load(DataResource resource) throws ResourceInitializationException {
     try {
       model = loadModel(resource.getInputStream());
diff --git a/opennlp-uima/src/main/java/opennlp/uima/util/AnnotationComboIterator.java b/opennlp-uima/src/main/java/opennlp/uima/util/AnnotationComboIterator.java
index 5aee4d96..da08a07e 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/util/AnnotationComboIterator.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/util/AnnotationComboIterator.java
@@ -73,10 +73,12 @@ public class AnnotationComboIterator implements Iterable<AnnotationIteratorPair>
       super();
     }
 
+    @Override
     public AnnotationIterator iterator() {
       return this;
     }
 
+    @Override
     public boolean hasNext() {
       if (AnnotationComboIterator.this.nextLowerChecked) {
         return AnnotationComboIterator.this.nextLowerAvailable;
@@ -102,6 +104,7 @@ public class AnnotationComboIterator implements Iterable<AnnotationIteratorPair>
       return AnnotationComboIterator.this.nextLowerAvailable;
     }
 
+    @Override
     public AnnotationFS next() {
       if (AnnotationComboIterator.this.nextLowerChecked) {
         if (!AnnotationComboIterator.this.nextLowerAvailable) {
@@ -116,6 +119,7 @@ public class AnnotationComboIterator implements Iterable<AnnotationIteratorPair>
       return rv;
     }
 
+    @Override
     public void remove() {
       throw new UnsupportedOperationException();
     }
@@ -146,11 +150,11 @@ public class AnnotationComboIterator implements Iterable<AnnotationIteratorPair>
    * Create a new combo iterator.
    *
    * @param cas
-   *          The CAS we're operating on.
+   *          The {@link CAS} we're operating on.
    * @param upper
-   *          The type of the upper iterator, e.g., sentence.
+   *          The {@link Type} of the upper iterator, e.g., sentence.
    * @param lower
-   *          The type of the lower iterator, e.g., token.
+   *          The {@link Type} of the lower iterator, e.g., token.
    */
   public AnnotationComboIterator(CAS cas, Type upper, Type lower) {
     this.upperIt = cas.getAnnotationIndex(upper).iterator();
@@ -166,10 +170,12 @@ public class AnnotationComboIterator implements Iterable<AnnotationIteratorPair>
     }
   }
 
+  @Override
   public boolean hasNext() {
     return this.upperIt.hasNext();
   }
 
+  @Override
   public AnnotationIteratorPair next() {
     if (!this.upperIt.hasNext()) {
       throw new NoSuchElementException();
@@ -181,6 +187,7 @@ public class AnnotationComboIterator implements Iterable<AnnotationIteratorPair>
     return new AnnotationIteratorPair(upperFS, new AnnotationIterator());
   }
 
+  @Override
   public Iterator<AnnotationIteratorPair> iterator() {
     return this;
   }
@@ -188,6 +195,7 @@ public class AnnotationComboIterator implements Iterable<AnnotationIteratorPair>
   /**
    * Not supported.
    */
+  @Override
   public void remove() {
     throw new UnsupportedOperationException();
   }
diff --git a/opennlp-uima/src/main/java/opennlp/uima/util/AnnotationComparator.java b/opennlp-uima/src/main/java/opennlp/uima/util/AnnotationComparator.java
index 57bdb0dd..59a2290d 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/util/AnnotationComparator.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/util/AnnotationComparator.java
@@ -22,16 +22,16 @@ import java.util.Comparator;
 import org.apache.uima.cas.text.AnnotationFS;
 
 /**
- * Checks two annotations for equality.
+ * Checks two {@link AnnotationFS annotations} for equality.
  */
 public class AnnotationComparator implements Comparator<AnnotationFS>
 {
 
   /**
-   * Compares the begin indexes of the annotations.
+   * Compares the start indexes of the annotations.
    *
-   * @param a - first annotation
-   * @param b - second annotation
+   * @param a - first {@link AnnotationFS annotation}.
+   * @param b - second {@link AnnotationFS annotation}.
    *
    * @return 0 if equals,  &lt; 0 if before and &gt; 0 if after
    */
diff --git a/opennlp-uima/src/main/java/opennlp/uima/util/AnnotationIteratorPair.java b/opennlp-uima/src/main/java/opennlp/uima/util/AnnotationIteratorPair.java
index 3cb6692b..3857221f 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/util/AnnotationIteratorPair.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/util/AnnotationIteratorPair.java
@@ -20,7 +20,8 @@ package opennlp.uima.util;
 import org.apache.uima.cas.text.AnnotationFS;
 
 /**
- * A pair of a UIMA annotation and an annotation iterator.
+ * A pair of a {@link AnnotationFS UIMA annotation} and an
+ * {@link Iterable<AnnotationFS> annotation iterator}.
  */
 public final class AnnotationIteratorPair {
   private final AnnotationFS annot;
@@ -32,10 +33,16 @@ public final class AnnotationIteratorPair {
     this.it = it;
   }
 
+  /**
+   * @return Retrieves the {@link AnnotationFS}.
+   */
   public AnnotationFS getAnnotation() {
     return this.annot;
   }
 
+  /**
+   * @return Retrieves the {@link Iterable<AnnotationFS> sub-iterator}.
+   */
   public Iterable<AnnotationFS> getSubIterator() {
     return this.it;
   }
diff --git a/opennlp-uima/src/main/java/opennlp/uima/util/AnnotatorUtil.java b/opennlp-uima/src/main/java/opennlp/uima/util/AnnotatorUtil.java
index 730d6bee..17227270 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/util/AnnotatorUtil.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/util/AnnotatorUtil.java
@@ -44,10 +44,11 @@ public final class AnnotatorUtil {
   /**
    * Retrieves a type of the given name from the given type system.
    *
-   * @param typeSystem
-   * @param name
-   * @return the type
-   * @throws AnalysisEngineProcessException
+   * @param typeSystem The {@link TypeSystem} to use.
+   * @param name The name of the type to retrieve.
+   *
+   * @return The {@link Type} for the {@code name}.
+   * @throws OpenNlpAnnotatorProcessException Thrown if no {@link Type} could be found.
    */
   public static Type getType(TypeSystem typeSystem, String name)
       throws AnalysisEngineProcessException {
@@ -63,12 +64,13 @@ public final class AnnotatorUtil {
   }
 
   /**
-   * Checks if the given feature has the expected type otherwise
+   * Checks if a {@link Feature} has the expected type, otherwise
    * an exception is thrown.
    *
-   * @param feature
-   * @param expectedType
-   * @throws AnalysisEngineProcessException - if type does not match
+   * @param feature The {@link Feature} to check for.
+   * @param expectedType The type that is expected.
+   *                     
+   * @throws OpenNlpAnnotatorProcessException Thrown if no {@link Type} did match.
    */
   private static void checkFeatureType(Feature feature, String expectedType)
       throws AnalysisEngineProcessException {
@@ -80,6 +82,17 @@ public final class AnnotatorUtil {
     }
   }
 
+
+  /**
+   * Retrieves a {@link Feature} for a specified type and {@code featureName},
+   * otherwise an exception is thrown.
+   *
+   * @param type The {@link Type} to use.
+   * @param featureName The name of the feature to retrieve.
+   *
+   * @return The {@link Feature} if found.
+   * @throws OpenNlpAnnotatorProcessException Thrown if no {@link Feature} did match.
+   */
   public static Feature getRequiredFeature(Type type, String featureName)
       throws AnalysisEngineProcessException {
 
@@ -94,13 +107,14 @@ public final class AnnotatorUtil {
   }
 
   /**
-   * Retrieves a required feature from the given type.
+   * Retrieves a {@link Feature} of the given type.
    *
-   * @param type        the type
-   * @param featureName the name of the feature
-   * @param rangeType   the expected range type
-   * @return the requested parameter
-   * @throws AnalysisEngineProcessException
+   * @param type        The {@link Type} to use.
+   * @param featureName The name of the feature to retrieve.
+   * @param rangeType   The expected range type.
+   *                    
+   * @return The {@link Feature} if found.
+   * @throws OpenNlpAnnotatorProcessException Thrown if no {@link Feature} did match.
    */
   public static Feature getRequiredFeature(Type type, String featureName,
                                            String rangeType)
@@ -113,6 +127,16 @@ public final class AnnotatorUtil {
     return feature;
   }
 
+  /**
+   * Retrieves a {@link Feature feature parameter} of specified type.
+   *
+   * @param context The {@link UimaContext} to use.
+   * @param type The {@link Type} of the {@link Feature} to get.
+   * @param featureNameParameter The name of the feature parameter.
+   *
+   * @return The {@link Feature} if found.
+   * @throws OpenNlpAnnotatorProcessException Thrown if no {@link Feature} did match.
+   */
   public static Feature getRequiredFeatureParameter(UimaContext context, Type type,
                                                     String featureNameParameter)
       throws AnalysisEngineProcessException {
@@ -128,6 +152,17 @@ public final class AnnotatorUtil {
     return getRequiredFeature(type, featureName);
   }
 
+  /**
+   * Retrieves a {@link Feature feature parameter} of specified type.
+   *
+   * @param context The {@link UimaContext} to use.
+   * @param type The {@link Type} of the {@link Feature} to get.
+   * @param featureNameParameter The name of the feature parameter.
+   * @param rangeTypeName The name of expected range type.
+   *
+   * @return The {@link Feature} if found.
+   * @throws OpenNlpAnnotatorProcessException Thrown if no {@link Feature} did match.
+   */
   public static Feature getRequiredFeatureParameter(UimaContext context,
                                                     Type type, String featureNameParameter,
                                                     String rangeTypeName)
@@ -143,6 +178,16 @@ public final class AnnotatorUtil {
     return getRequiredFeature(type, featureName, rangeTypeName);
   }
 
+  /**
+   * Retrieves a type of the given name from the given type system.
+   *
+   * @param context The {@link UimaContext} to use.
+   * @param typeSystem The {@link TypeSystem} to use.
+   * @param parameter The name of the type to retrieve.
+   *
+   * @return The {@link Type} for the {@code name}.
+   * @throws OpenNlpAnnotatorProcessException Thrown if no {@link Type} could be found.
+   */
   public static Type getRequiredTypeParameter(UimaContext context,
                                               TypeSystem typeSystem, String parameter)
       throws AnalysisEngineProcessException {
@@ -161,13 +206,13 @@ public final class AnnotatorUtil {
   /**
    * Retrieves a required parameter from the given context.
    *
-   * @param context
-   * @param parameter
-   * @return the requested parameter
-   * @throws ResourceInitializationException
+   * @param context The {@link UimaContext} to use.
+   * @param parameter The name of the type to retrieve.
+   *
+   * @return The {@link String} value retrieved for a specified {@code parameter}
+   *         from the {@code context}.
    */
-  public static String getRequiredStringParameter(UimaContext context,
-                                                  String parameter)
+  public static String getRequiredStringParameter(UimaContext context, String parameter)
       throws ResourceInitializationException {
 
     String value = getOptionalStringParameter(context, parameter);
@@ -180,13 +225,14 @@ public final class AnnotatorUtil {
   /**
    * Retrieves a required parameter from the given context.
    *
-   * @param context
-   * @param parameter
-   * @return the requested parameter
-   * @throws ResourceInitializationException
+   * @param context The {@link UimaContext} to use.
+   * @param parameter The name of the type to retrieve.
+   *
+   * @return The {@link Integer} value retrieved for a specified {@code parameter}
+   *         from the {@code context}.
+   * @throws ResourceInitializationException Thrown if no value} could be found.
    */
-  public static Integer getRequiredIntegerParameter(UimaContext context,
-                                                    String parameter)
+  public static Integer getRequiredIntegerParameter(UimaContext context, String parameter)
       throws ResourceInitializationException {
 
     Integer value = getOptionalIntegerParameter(context, parameter);
@@ -199,13 +245,14 @@ public final class AnnotatorUtil {
   /**
    * Retrieves a required parameter from the given context.
    *
-   * @param context
-   * @param parameter
-   * @return the requested parameter
-   * @throws ResourceInitializationException
+   * @param context The {@link UimaContext} to use.
+   * @param parameter The name of the type to retrieve.
+   *
+   * @return The {@link Float} value retrieved for a specified {@code parameter}
+   *         from the {@code context}.
+   * @throws ResourceInitializationException Thrown if no value} could be found.
    */
-  public static Float getRequiredFloatParameter(UimaContext context,
-                                                String parameter)
+  public static Float getRequiredFloatParameter(UimaContext context, String parameter)
       throws ResourceInitializationException {
 
     Float value = getOptionalFloatParameter(context, parameter);
@@ -218,13 +265,14 @@ public final class AnnotatorUtil {
   /**
    * Retrieves a required parameter from the given context.
    *
-   * @param context
-   * @param parameter
-   * @return the requested parameter
-   * @throws ResourceInitializationException
+   * @param context The {@link UimaContext} to use.
+   * @param parameter The name of the type to retrieve.
+   *
+   * @return The {@link Boolean} value retrieved for a specified {@code parameter}
+   *         from the {@code context}.
+   * @throws ResourceInitializationException Thrown if no value} could be found.
    */
-  public static Boolean getRequiredBooleanParameter(UimaContext context,
-                                                    String parameter)
+  public static Boolean getRequiredBooleanParameter(UimaContext context, String parameter)
       throws ResourceInitializationException {
 
     Boolean value = getOptionalBooleanParameter(context, parameter);
@@ -245,6 +293,17 @@ public final class AnnotatorUtil {
   }
 
 
+  /**
+   * Retrieves an optional {@link Feature feature parameter} of specified type.
+   *
+   * @param context The {@link UimaContext} to use.
+   * @param nameType The {@link Type} of the {@link Feature} to get.
+   * @param featureNameParameter The name of the feature parameter.
+   * @param rangeTypeName The name of expected range type.
+   *
+   * @return The {@link Feature} if found.
+   * @throws OpenNlpAnnotatorProcessException Thrown if no {@link Feature} did match.
+   */
   public static Feature getOptionalFeatureParameter(UimaContext context,
                                                     Type nameType, String featureNameParameter,
                                                     String rangeTypeName)
@@ -264,6 +323,16 @@ public final class AnnotatorUtil {
     }
   }
 
+  /**
+   * Retrieves an optional {@link Feature feature parameter} of specified type.
+   *
+   * @param type The {@link Type} of the {@link Feature} to get.
+   * @param featureName The name of the feature parameter.
+   * @param rangeType The expected range type.
+   *
+   * @return The {@link Feature} if found.
+   * @throws OpenNlpAnnotatorProcessException Thrown if no {@link Feature} did match.
+   */
   public static Feature getOptionalFeature(Type type, String featureName, String rangeType)
       throws AnalysisEngineProcessException {
 
@@ -274,6 +343,16 @@ public final class AnnotatorUtil {
     return feature;
   }
 
+  /**
+   * Retrieves an optional {@link Feature feature parameter} of specified type.
+   *
+   * @param context The {@link UimaContext} to use.
+   * @param typeSystem The {@link TypeSystem} to use.
+   * @param parameter The name of the type to retrieve.
+   *
+   * @return The {@link Type} for the {@code name}.
+   * @throws OpenNlpAnnotatorProcessException Thrown if no {@link Type} could be found.
+   */
   public static Type getOptionalTypeParameter(UimaContext context,
                                               TypeSystem typeSystem, String parameter)
       throws AnalysisEngineProcessException {
@@ -293,12 +372,13 @@ public final class AnnotatorUtil {
   }
 
   /**
-   * Retrieves an optional parameter from the given context.
+   * Retrieves an optional parameter from the given {@link UimaContext}.
    *
-   * @param context
-   * @param parameter
-   * @return the parameter or null if not set
-   * @throws ResourceInitializationException
+   * @param context The {@link UimaContext} to use.
+   * @param parameter The name of the parameter to retrieve.
+   *
+   * @return The {@link String parameter} or {@code null} if not set.
+   * @throws ResourceInitializationException Thrown if the parameter type was not of the expected type.
    */
   public static String getOptionalStringParameter(UimaContext context,
                                                   String parameter)
@@ -317,6 +397,15 @@ public final class AnnotatorUtil {
     }
   }
 
+  /**
+   * Retrieves an optional parameter array from the given {@link UimaContext}.
+   *
+   * @param context The {@link UimaContext} to use.
+   * @param parameter The name of the parameter to retrieve.
+   *
+   * @return The {@link String parameter array} or an empty array if not set.
+   * @throws ResourceInitializationException Thrown if the parameter type was not of the expected type.
+   */
   public static String[] getOptionalStringArrayParameter(UimaContext context,
                                                          String parameter)
       throws ResourceInitializationException {
@@ -334,12 +423,13 @@ public final class AnnotatorUtil {
   }
 
   /**
-   * Retrieves an optional parameter from the given context.
+   * Retrieves an optional parameter from the given {@link UimaContext}.
    *
-   * @param context
-   * @param parameter
-   * @return the parameter or null if not set
-   * @throws ResourceInitializationException
+   * @param context The {@link UimaContext} to use.
+   * @param parameter The name of the parameter to retrieve.
+   *
+   * @return The {@link Integer parameter} or {@code null} if not set.
+   * @throws ResourceInitializationException Thrown if the parameter type was not of the expected type.
    */
   public static Integer getOptionalIntegerParameter(UimaContext context,
                                                     String parameter)
@@ -360,12 +450,13 @@ public final class AnnotatorUtil {
   }
 
   /**
-   * Retrieves an optional parameter from the given context.
+   * Retrieves an optional parameter from the given {@link UimaContext}.
+   *
+   * @param context The {@link UimaContext} to use.
+   * @param parameter The name of the parameter to retrieve.
    *
-   * @param context
-   * @param parameter
-   * @return the parameter or null if not set
-   * @throws ResourceInitializationException
+   * @return The {@link Float parameter} or {@code null} if not set.
+   * @throws ResourceInitializationException Thrown if the parameter type was not of the expected type.
    */
   public static Float getOptionalFloatParameter(UimaContext context,
                                                 String parameter)
@@ -386,12 +477,13 @@ public final class AnnotatorUtil {
   }
 
   /**
-   * Retrieves an optional parameter from the given context.
+   * Retrieves an optional parameter from the given {@link UimaContext}.
    *
-   * @param context
-   * @param parameter
-   * @return the parameter or null if not set
-   * @throws ResourceInitializationException
+   * @param context The {@link UimaContext} to use.
+   * @param parameter The name of the parameter to retrieve.
+   *
+   * @return The {@link Boolean parameter} or {@code null} if not set.
+   * @throws ResourceInitializationException Thrown if the parameter type was not of the expected type.
    */
   public static Boolean getOptionalBooleanParameter(UimaContext context,
                                                     String parameter)
@@ -410,6 +502,15 @@ public final class AnnotatorUtil {
     }
   }
 
+  /**
+   * Retrieves an optional parameter from the given {@link UimaContext}.
+   *
+   * @param context The {@link UimaContext} to use.
+   * @param parameter The name of the parameter to retrieve.
+   *
+   * @return The {@link Object parameter} or {@code null} if not set.
+   * @throws ResourceInitializationException Thrown if the parameter type was not of the expected type.
+   */
   private static Object getOptionalParameter(UimaContext context,
                                              String parameter)
       throws ResourceInitializationException {
@@ -427,17 +528,17 @@ public final class AnnotatorUtil {
   }
 
   /**
-   * Retrieves a resource as stream from the given context.
+   * Opens an {@link InputStream} for a resource via the given {@link UimaContext}.
    *
-   * @param context
-   * @param name
-   * @return the stream
-   * @throws ResourceInitializationException
+   * @param context The {@link UimaContext} to use.
+   * @param name The name that identifies the resource.
+   * @return A valid, open {@link InputStream}.
+   * @throws ResourceInitializationException Thrown if the resource could not be found.
    */
   public static InputStream getResourceAsStream(UimaContext context, String name)
       throws ResourceInitializationException {
 
-    InputStream inResource = getOptionalResourceAsStream(context, name);
+    final InputStream inResource = getOptionalResourceAsStream(context, name);
 
     if (inResource == null) {
       throw new ResourceInitializationException(
@@ -448,11 +549,19 @@ public final class AnnotatorUtil {
     return inResource;
   }
 
+  /**
+   * Opens an {@link InputStream} for an optional resource via the given {@link UimaContext}.
+   *
+   * @param context The {@link UimaContext} to use.
+   * @param name The name that identifies the resource.
+   * @return A valid, open {@link InputStream}.
+   * @throws ResourceInitializationException Thrown if the resource could not be found.
+   */
   public static InputStream getOptionalResourceAsStream(UimaContext context,
                                                         String name)
       throws ResourceInitializationException {
 
-    InputStream inResource;
+    final InputStream inResource;
 
     try {
       inResource = context.getResourceAsStream(name);
@@ -463,6 +572,15 @@ public final class AnnotatorUtil {
     return inResource;
   }
 
+  /**
+   * Creates a {@link Dictionary} via the given {@link UimaContext}.
+   *
+   * @param context The {@link UimaContext} to use.
+   * @param dictionaryParameter The name that identifies the dictionary.
+   *                            
+   * @return A valid {@link Dictionary} or {@code null} if IO errors occurred.
+   * @throws ResourceInitializationException Thrown if the resource could not be found.
+   */
   public static Dictionary createOptionalDictionary(UimaContext context,
                                                     String dictionaryParameter)
       throws ResourceInitializationException {
@@ -476,10 +594,8 @@ public final class AnnotatorUtil {
 
       Logger logger = context.getLogger();
 
-      try {
-
-        InputStream dictIn = AnnotatorUtil.getOptionalResourceAsStream(context,
-            dictionaryName);
+      try (InputStream dictIn = AnnotatorUtil.getOptionalResourceAsStream(context,
+              dictionaryName)) {
 
         if (dictIn == null) {
           String message = "The dictionary file " + dictionaryName
diff --git a/opennlp-uima/src/main/java/opennlp/uima/util/ContainingConstraint.java b/opennlp-uima/src/main/java/opennlp/uima/util/ContainingConstraint.java
index 24c50b80..c7361231 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/util/ContainingConstraint.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/util/ContainingConstraint.java
@@ -25,32 +25,32 @@ import org.apache.uima.cas.FeatureStructure;
 import org.apache.uima.cas.text.AnnotationFS;
 
 /**
- * Checks if an AnnotationFS is contained by the given AnnotationFS.
+ * Checks if an {@link AnnotationFS} is contained by the given AnnotationFS.
  */
 public final class ContainingConstraint implements FSMatchConstraint {
   private static final long serialVersionUID = 1;
 
-  private Collection<AnnotationFS> mContainingAnnotations = new LinkedList<>();
+  private final Collection<AnnotationFS> mContainingAnnotations = new LinkedList<>();
 
   /**
-   * Initializes a new instance.
+   * Initializes a {@link ContainingConstraint}.
    */
   public ContainingConstraint() {
-    // does currently nothing
   }
 
   /**
-   * Initializes a new instance.
+   * Initializes a {@link ContainingConstraint}.
    *
-   * @param containingAnnotation
+   * @param containingAnnotation The {@link AnnotationFS} to initialize with.
    */
   public ContainingConstraint(AnnotationFS containingAnnotation) {
     mContainingAnnotations.add(containingAnnotation);
   }
 
   /**
-   * Checks if the given FeatureStructure match the constraint.
+   * Checks if the given {@link FeatureStructure} matches the constraint.
    */
+  @Override
   public boolean match(FeatureStructure featureStructure) {
     if (!(featureStructure instanceof AnnotationFS)) {
       return false;
diff --git a/opennlp-uima/src/main/java/opennlp/uima/util/ExceptionMessages.java b/opennlp-uima/src/main/java/opennlp/uima/util/ExceptionMessages.java
index bbf2243d..53f0a636 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/util/ExceptionMessages.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/util/ExceptionMessages.java
@@ -19,7 +19,7 @@ package opennlp.uima.util;
 
 /**
  * This class contains constants for the exception messages in the exception
- * massage catalog.
+ * message catalog.
  */
 public class ExceptionMessages {
 
diff --git a/opennlp-uima/src/main/java/opennlp/uima/util/OpennlpUtil.java b/opennlp-uima/src/main/java/opennlp/uima/util/OpennlpUtil.java
index ecec498f..2a0e7409 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/util/OpennlpUtil.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/util/OpennlpUtil.java
@@ -29,24 +29,25 @@ import java.io.OutputStream;
 import org.apache.uima.resource.ResourceInitializationException;
 
 import opennlp.tools.ml.TrainerFactory;
-import opennlp.tools.ml.maxent.GISModel;
 import opennlp.tools.util.TrainingParameters;
 import opennlp.tools.util.model.BaseModel;
 
 /**
- * This class contains utils methods for the maxent library.
+ * This class contains util methods for the maxent library.
  */
 final public class OpennlpUtil {
+  
   private OpennlpUtil() {
     // this is util class must not be instantiated
   }
 
   /**
-   * Serializes a {@link GISModel} and writes it to the given
-   * {@link OutputStream}.
+   * Serializes a {@link BaseModel GIS model} and writes it to the given
+   * {@link File}.
    *
-   * @param model model to serialize
-   * @throws IOException IOException
+   * @param model The {@link BaseModel} to serialize.
+   * @param modelFile The {@link File} to serialize into.
+   * @throws IOException Thrown if IO errors occurred.
    */
   public static void serialize(BaseModel model, File modelFile)
       throws IOException {
@@ -56,6 +57,13 @@ final public class OpennlpUtil {
     }
   }
 
+  /**
+   * Loads data from a given {@link File}.
+   *
+   * @param inFile The {@link File} to read bytes from.
+   * @return The bytes that have been read.
+   * @throws IOException Thrown if IO errors occurred.
+   */
   public static byte[] loadBytes(File inFile) throws IOException {
     ByteArrayOutputStream bytes = new ByteArrayOutputStream();
 
@@ -71,6 +79,17 @@ final public class OpennlpUtil {
     return bytes.toByteArray();
   }
 
+  /**
+   * Loads data from a given {@link File}.
+   *
+   * @param inFileValue The name of the {@link File} to read bytes from.
+   * @param isSequenceTrainingAllowed Whether the {@link TrainerFactory.TrainerType#SEQUENCE_TRAINER}
+   *                                  method is allowed or not.
+   * @return The {@link TrainingParameters} that have been read.
+   *
+   * @throws ResourceInitializationException Thrown if IO errors occurred or the {@code inFileValue}
+   *                                         does not reference a valid trainging parameters file.
+   */
   public static TrainingParameters loadTrainingParams(String inFileValue,
       boolean isSequenceTrainingAllowed) throws ResourceInitializationException {
 
diff --git a/opennlp-uima/src/main/java/opennlp/uima/util/UimaUtil.java b/opennlp-uima/src/main/java/opennlp/uima/util/UimaUtil.java
index f066c8c5..c428037f 100644
--- a/opennlp-uima/src/main/java/opennlp/uima/util/UimaUtil.java
+++ b/opennlp-uima/src/main/java/opennlp/uima/util/UimaUtil.java
@@ -86,9 +86,9 @@ public final class UimaUtil {
    * Removes all annotations of type removeAnnotationType which are contained
    * by annotations of type containerAnnotationType.
    *
-   * @param cas
-   * @param containerAnnotation
-   * @param removeAnnotationType
+   * @param cas The {@link CAS} to use.
+   * @param containerAnnotation The {@link AnnotationFS} of the container.
+   * @param removeAnnotationType The {@link Type type} to remove annotations for.
    */
   public static void removeAnnotations(CAS cas,
       AnnotationFS containerAnnotation, Type removeAnnotationType) {
@@ -108,8 +108,8 @@ public final class UimaUtil {
       removeAnnotations.add(containingTokens.next());
     }
 
-    for (Iterator<AnnotationFS> it = removeAnnotations.iterator(); it.hasNext();) {
-      cas.removeFsFromIndexes(it.next());
+    for (AnnotationFS removeAnnotation : removeAnnotations) {
+      cas.removeFsFromIndexes(removeAnnotation);
     }
   }
 }