You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by hu...@apache.org on 2025/01/27 11:01:29 UTC

(opennlp-addons) branch main created (now 0bd12e8)

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

humbedooh pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/opennlp-addons.git


      at 0bd12e8  corrects minor typos in geoentitylinker classes fixes grammer issues throughout all modules corrects some C-style array declarations makes fields final where applicable simplifies if-else statements removes redundant 'throws' clauses simplifies some JUnit assertions

This branch includes the following new commits:

     new 1099e5b  OPENNLP-1700: Modernize code of geolinker addon - fixes use of raw types - fixes use of readers/writers without try-with-resources - adds constants where applicable - fixes indentations where necessary - adds JavaDoc where useful - removes superfluous JavaDoc
     new 7b9875b  OPENNLP-1698: Switch to extjwnl in jwnl-addon - migrates jwnl-addon to net.sf.extjwnl (2.0.5) - simplifies constructor of JWNLLemmatizer - adds new unit test: JWNLLemmatizerTest with line coverage > 90%
     new 0895034  corrects minor typo in README.md
     new 0bd12e8  corrects minor typos in geoentitylinker classes fixes grammer issues throughout all modules corrects some C-style array declarations makes fields final where applicable simplifies if-else statements removes redundant 'throws' clauses simplifies some JUnit assertions

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(opennlp-addons) 02/04: OPENNLP-1698: Switch to extjwnl in jwnl-addon - migrates jwnl-addon to net.sf.extjwnl (2.0.5) - simplifies constructor of JWNLLemmatizer - adds new unit test: JWNLLemmatizerTest with line coverage > 90%

Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7b9875b1cf6fd36b517414f34296de3ef88f057f
Author: Martin Wiesner <ma...@hs-heilbronn.de>
AuthorDate: Wed Jan 22 11:34:08 2025 +0100

    OPENNLP-1698: Switch to extjwnl in jwnl-addon
    - migrates jwnl-addon to net.sf.extjwnl (2.0.5)
    - simplifies constructor of JWNLLemmatizer
    - adds new unit test: JWNLLemmatizerTest with line coverage > 90%
---
 jwnl-addon/pom.xml                                 |  27 +++++-
 .../opennlp/jwnl/lemmatizer/JWNLLemmatizer.java    | 106 ++++++---------------
 .../jwnl/lemmatizer/JWNLLemmatizerTest.java        |  77 +++++++++++++++
 jwnl-addon/src/test/resources/log4j2.xml           |  37 +++++++
 pom.xml                                            |   1 -
 5 files changed, 168 insertions(+), 80 deletions(-)

diff --git a/jwnl-addon/pom.xml b/jwnl-addon/pom.xml
index 3a39da5..2511645 100644
--- a/jwnl-addon/pom.xml
+++ b/jwnl-addon/pom.xml
@@ -33,6 +33,11 @@
   <packaging>jar</packaging>
   <name>Apache OpenNLP JWNL Addon</name>
 
+  <properties>
+    <extjwnl.version>2.0.5</extjwnl.version>
+    <wn-data.version>1.2</wn-data.version>
+  </properties>
+
   <dependencies>
     <dependency>
       <groupId>org.apache.opennlp</groupId>
@@ -40,10 +45,17 @@
     </dependency>
 
     <dependency>
-      <groupId>net.sf.jwordnet</groupId>
-      <artifactId>jwnl</artifactId>
-      <version>1.3.3</version>
-      <scope>compile</scope>
+      <groupId>net.sf.extjwnl</groupId>
+      <artifactId>extjwnl</artifactId>
+      <version>${extjwnl.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>net.sf.extjwnl</groupId>
+      <artifactId>extjwnl-data-wn31</artifactId>
+      <version>${wn-data.version}</version>
+      <optional>true</optional>
+      <scope>runtime</scope>
     </dependency>
     
     <dependency>
@@ -60,6 +72,13 @@
       <groupId>org.junit.jupiter</groupId>
       <artifactId>junit-jupiter-params</artifactId>
     </dependency>
+
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j2-impl</artifactId>
+      <version>${log4j2.version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/jwnl-addon/src/main/java/opennlp/jwnl/lemmatizer/JWNLLemmatizer.java b/jwnl-addon/src/main/java/opennlp/jwnl/lemmatizer/JWNLLemmatizer.java
index ba55a0f..b85b2b8 100644
--- a/jwnl-addon/src/main/java/opennlp/jwnl/lemmatizer/JWNLLemmatizer.java
+++ b/jwnl-addon/src/main/java/opennlp/jwnl/lemmatizer/JWNLLemmatizer.java
@@ -17,92 +17,51 @@
 
 package opennlp.jwnl.lemmatizer;
 
-import java.io.IOException;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
-import net.didion.jwnl.JWNLException;
-import net.didion.jwnl.data.Adjective;
-import net.didion.jwnl.data.FileDictionaryElementFactory;
-import net.didion.jwnl.data.IndexWord;
-import net.didion.jwnl.data.POS;
-import net.didion.jwnl.data.PointerType;
-import net.didion.jwnl.data.VerbFrame;
-import net.didion.jwnl.dictionary.FileBackedDictionary;
-import net.didion.jwnl.dictionary.MorphologicalProcessor;
-import net.didion.jwnl.dictionary.file_manager.FileManager;
-import net.didion.jwnl.dictionary.file_manager.FileManagerImpl;
-import net.didion.jwnl.dictionary.morph.DefaultMorphologicalProcessor;
-import net.didion.jwnl.dictionary.morph.DetachSuffixesOperation;
-import net.didion.jwnl.dictionary.morph.LookupExceptionsOperation;
-import net.didion.jwnl.dictionary.morph.LookupIndexWordOperation;
-import net.didion.jwnl.dictionary.morph.Operation;
-import net.didion.jwnl.dictionary.morph.TokenizerOperation;
-import net.didion.jwnl.princeton.data.PrincetonWN17FileDictionaryElementFactory;
-import net.didion.jwnl.princeton.file.PrincetonRandomAccessDictionaryFile;
+import net.sf.extjwnl.JWNLException;
+import net.sf.extjwnl.data.IndexWord;
+import net.sf.extjwnl.data.POS;
+import net.sf.extjwnl.dictionary.Dictionary;
+import net.sf.extjwnl.dictionary.MorphologicalProcessor;
+
 import opennlp.tools.lemmatizer.Lemmatizer;
 
+/**
+ * A {@link Lemmatizer} implementation based on extJWNL
+ * and underlying WordNet resources.
+ *
+ * @see Dictionary
+ * @see MorphologicalProcessor
+ * @see POS
+ */
 public class JWNLLemmatizer implements Lemmatizer {
 
-  private net.didion.jwnl.dictionary.Dictionary dict;
-  private MorphologicalProcessor morphy;
+  private final MorphologicalProcessor morphy;
 
   /**
-   * Creates JWNL dictionary and morphological processor objects in
-   * JWNLemmatizer constructor. It also loads the JWNL configuration into the
-   * constructor. 
-   * <p>
-   * Constructor code based on Apache OpenNLP JWNLDictionary class. 
+   * Initializes a {@link JWNLLemmatizer} instance.
+   * Loads {@link Dictionary JWNL dictionary} and {@link MorphologicalProcessor} objects.
+   * It also loads the JWNL configuration.
    * 
-   * @param wnDirectory
-   * @throws IOException
+   * @throws JWNLException Thrown if errors occurred ramping up the WordNet resources.
    */
-  public JWNLLemmatizer(String wnDirectory) throws IOException {
+  public JWNLLemmatizer() throws JWNLException {
     super();
-    PointerType.initialize();
-    Adjective.initialize();
-    VerbFrame.initialize();
-    Map<POS, String[][]> suffixMap = new HashMap<>();
-    suffixMap.put(POS.NOUN, new String[][] { { "s", "" }, { "ses", "s" },
-        { "xes", "x" }, { "zes", "z" }, { "ches", "ch" }, { "shes", "sh" },
-        { "men", "man" }, { "ies", "y" } });
-    suffixMap.put(POS.VERB, new String[][] { { "s", "" }, { "ies", "y" },
-        { "es", "e" }, { "es", "" }, { "ed", "e" }, { "ed", "" },
-        { "ing", "e" }, { "ing", "" } });
-    suffixMap.put(POS.ADJECTIVE, new String[][] { { "er", "" }, { "est", "" },
-        { "er", "e" }, { "est", "e" } });
-    DetachSuffixesOperation tokDso = new DetachSuffixesOperation(suffixMap);
-    tokDso.addDelegate(DetachSuffixesOperation.OPERATIONS, new Operation[] {
-        new LookupIndexWordOperation(), new LookupExceptionsOperation() });
-    TokenizerOperation tokOp = new TokenizerOperation(new String[] { " ", "-" });
-    tokOp.addDelegate(TokenizerOperation.TOKEN_OPERATIONS,
-        new Operation[] { new LookupIndexWordOperation(),
-            new LookupExceptionsOperation(), tokDso });
-    DetachSuffixesOperation morphDso = new DetachSuffixesOperation(suffixMap);
-    morphDso.addDelegate(DetachSuffixesOperation.OPERATIONS, new Operation[] {
-        new LookupIndexWordOperation(), new LookupExceptionsOperation() });
-    Operation[] operations = { new LookupExceptionsOperation(), morphDso, tokOp };
-    morphy = new DefaultMorphologicalProcessor(operations);
-    FileManager manager = new FileManagerImpl(wnDirectory,
-        PrincetonRandomAccessDictionaryFile.class);
-    FileDictionaryElementFactory factory = new PrincetonWN17FileDictionaryElementFactory();
-    FileBackedDictionary.install(manager, morphy, factory, true);
-    dict = net.didion.jwnl.dictionary.Dictionary.getInstance();
+    Dictionary dict = Dictionary.getDefaultResourceInstance();
     morphy = dict.getMorphologicalProcessor();
   }
 
   /**
-   * It takes a word and a POS tag and obtains a word's lemma from WordNet.
+   * Takes a word and a POS tag and obtains a word's lemma from WordNet.
    * 
-   * @param word
-   * @param postag
-   * @return lemma
+   * @param word The word to find the corresponding lemma for.
+   * @param postag The POS tag associated with the {@code word}.
+   * @return lemma The lemma as provided by WordNet, or {@code null} if not found.
    */
   public String lemmatize(String word, String postag) {
     String constantTag = "NNP";
-    IndexWord baseForm;
     String lemma;
     try {
       POS pos;
@@ -117,18 +76,15 @@ public class JWNLLemmatizer implements Lemmatizer {
       } else {
         pos = POS.ADVERB;
       }
-      baseForm = morphy.lookupBaseForm(pos, word);
+      IndexWord baseForm = morphy.lookupBaseForm(pos, word);
       if (baseForm != null) {
-        lemma = baseForm.getLemma().toString();
+        lemma = baseForm.getLemma();
+      } else if (postag.startsWith(constantTag)) {
+        lemma = word;
+      } else {
+        lemma= word.toLowerCase();
       }
-      else if (baseForm == null && postag.startsWith(constantTag)) {
-          lemma = word;
-        }
-        else {
-          lemma= word.toLowerCase();
-        }
     } catch (JWNLException e) {
-      e.printStackTrace();
       return null;
     }
     return lemma;
diff --git a/jwnl-addon/src/test/java/opennlp/jwnl/lemmatizer/JWNLLemmatizerTest.java b/jwnl-addon/src/test/java/opennlp/jwnl/lemmatizer/JWNLLemmatizerTest.java
new file mode 100644
index 0000000..e417830
--- /dev/null
+++ b/jwnl-addon/src/test/java/opennlp/jwnl/lemmatizer/JWNLLemmatizerTest.java
@@ -0,0 +1,77 @@
+/*
+ * 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.jwnl.lemmatizer;
+
+import java.util.List;
+import java.util.stream.Stream;
+
+import net.sf.extjwnl.JWNLException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+public class JWNLLemmatizerTest {
+
+  // SUT
+  private JWNLLemmatizer lemmatizer;
+
+  @BeforeEach
+  public void setUp() throws JWNLException {
+    lemmatizer = new JWNLLemmatizer();
+  }
+
+  @ParameterizedTest
+  @MethodSource("provideData")
+  public void testLemmatize(String word, String posTag, String expectedLemma) {
+    String lemma = lemmatizer.lemmatize(word, posTag);
+    assertNotNull(lemma);
+    assertEquals(expectedLemma, lemma);
+  }
+
+  @ParameterizedTest
+  @MethodSource("provideData")
+  public void testLemmatizeArray(String word, String posTag, String expectedLemma) {
+    String[] lemma = lemmatizer.lemmatize(new String[]{word}, new String[]{posTag});
+    assertNotNull(lemma);
+    assertEquals(1, lemma.length);
+    assertEquals(expectedLemma, lemma[0]);
+  }
+
+  @Test
+  public void testLemmatizeList() {
+    assertThrows(UnsupportedOperationException.class, () -> {
+      lemmatizer.lemmatize(List.of("mouse"), List.of("NN"));
+    });
+  }
+
+  private static Stream<Arguments> provideData() {
+    return Stream.of(
+        Arguments.of("the", "DT", "the"),
+        Arguments.of("cats", "NN", "cat"),
+        Arguments.of("saw", "VB", "see"),
+        Arguments.of("best", "JJS", "good"),
+        Arguments.of("upside", "RB", "upside")
+    );
+  }
+}
diff --git a/jwnl-addon/src/test/resources/log4j2.xml b/jwnl-addon/src/test/resources/log4j2.xml
new file mode 100644
index 0000000..8b6b24c
--- /dev/null
+++ b/jwnl-addon/src/test/resources/log4j2.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   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.
+-->
+<Configuration>
+    <Appenders>
+        <Console name="STDOUT" target="SYSTEM_OUT">
+            <!--
+                The pattern can be adjusted as needed, see https://logging.apache.org/log4j/2.x/manual/layouts.html
+            -->
+            <PatternLayout pattern="%m%n"/>
+        </Console>
+    </Appenders>
+
+    <Loggers>
+        <Logger name="opennlp.jwnl.lemmatizer" level="warn"/>
+        <Logger name="opennlp.tools" level="warn"/>
+        <Root level="INFO">
+            <AppenderRef ref="STDOUT"/>
+        </Root>
+    </Loggers>
+</Configuration>
diff --git a/pom.xml b/pom.xml
index 77eb51f..5c46bf7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -342,7 +342,6 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.13.0</version>
                 <configuration>
                     <release>${java.version}</release>
                     <compilerArgument>-Xlint</compilerArgument>


(opennlp-addons) 04/04: corrects minor typos in geoentitylinker classes fixes grammer issues throughout all modules corrects some C-style array declarations makes fields final where applicable simplifies if-else statements removes redundant 'throws' clauses simplifies some JUnit assertions

Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 0bd12e8c57a94c2f4d9ebac26eddbd83c9922302
Author: Martin Wiesner <ma...@hs-heilbronn.de>
AuthorDate: Sat Jan 25 21:52:21 2025 +0100

    corrects minor typos in geoentitylinker classes
    fixes grammer issues throughout all modules
    corrects some C-style array declarations
    makes fields final where applicable
    simplifies if-else statements
    removes redundant 'throws' clauses
    simplifies some JUnit assertions
---
 .../AdminBoundaryContextGenerator.java             |  9 +++++----
 .../addons/geoentitylinker/GazetteerEntry.java     |  7 ++-----
 .../geoentitylinker/indexing/GazetteerIndexer.java |  2 +-
 .../indexing/GeonamesFileDownloader.java           |  4 ++--
 .../indexing/GeonamesProcessor.java                |  4 +---
 .../geoentitylinker/indexing/RegionProcessor.java  |  6 +++---
 .../geoentitylinker/indexing/USGSProcessor.java    |  4 ++--
 .../scoring/CountryProximityScorer.java            |  2 +-
 .../scoring/FuzzyStringMatchScorer.java            |  3 +--
 .../geoentitylinker/scoring/ModelBasedScorer.java  |  4 ++--
 .../geoentitylinker/scoring/PointClustering.java   |  4 ++--
 .../scoring/ProvinceProximityScorer.java           | 22 +++++++++-------------
 .../AuxiliaryInfoNameContextGenerator.java         |  8 ++++----
 .../AuxiliaryInfoTokenNameFinderFactory.java       |  2 +-
 .../opennlp/tools/namefind/AuxiliaryInfoUtil.java  |  2 +-
 ...AuxiliaryInfoAwareDelegateFeatureGenerator.java |  2 +-
 .../lang/jpn/BrownTokenClassFeatureGenerator.java  |  2 +-
 .../featuregen/lang/jpn/FeatureGeneratorUtil.java  |  2 +-
 .../lang/jpn/TokenClassFeatureGenerator.java       |  2 +-
 .../lang/jpn/TokenPatternFeatureGenerator.java     |  4 ++--
 .../tools/namefind/AuxiliaryInfoUtilTest.java      | 12 ++++++------
 ...liaryInfoAwareDelegateFeatureGeneratorTest.java |  6 +++---
 .../lang/jpn/BigramNameFeatureGeneratorTest.java   | 10 +++++-----
 .../lang/jpn/TokenClassFeatureGeneratorTest.java   |  8 ++++----
 .../lang/jpn/TokenPatternFeatureGeneratorTest.java |  2 +-
 .../lang/jpn/TrigramNameFeatureGeneratorTest.java  | 12 ++++++------
 .../jwnl/lemmatizer/JWNLLemmatizerTest.java        |  5 ++---
 .../src/main/java/LiblinearModelSerializer.java    |  2 ++
 .../src/main/java/LiblinearTrainer.java            |  2 +-
 .../addons/modelbuilder/KnownEntityProvider.java   |  2 +-
 .../modelbuilder/ModelGenerationValidator.java     |  5 +----
 .../impls/FileKnownEntityProvider.java             | 14 ++++++--------
 .../modelbuilder/impls/FileModelValidatorImpl.java |  8 ++------
 .../modelbuilder/impls/GenericModelGenerator.java  |  6 +++---
 morfologik-addon/src/main/assembly/bin.xml         |  6 +++---
 morfologik-addon/src/main/assembly/src.xml         |  2 +-
 ...ilder.java => MorfologikDictionaryBuilder.java} |  6 ++----
 .../main/java/opennlp/morfologik/cmdline/CLI.java  |  2 +-
 .../builder/MorfologikDictionaryBuilderTool.java   |  6 +++---
 .../builder/XMLDictionaryToTableParams.java        |  2 +-
 .../cmdline/builder/XMLDictionaryToTableTool.java  |  2 +-
 .../lemmatizer/MorfologikLemmatizer.java           |  2 +-
 .../tagdict/MorfologikTagDictionary.java           |  6 +++---
 ...lderTest.java => POSDictionaryBuilderTest.java} | 10 +++++-----
 .../lemmatizer/MorfologikLemmatizerTest.java       |  4 ++--
 .../tagdict/MorfologikTagDictionaryTest.java       | 16 ++++++++--------
 .../morfologik/tagdict/POSTaggerFactoryTest.java   |  9 +++++----
 47 files changed, 122 insertions(+), 140 deletions(-)

diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/AdminBoundaryContextGenerator.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/AdminBoundaryContextGenerator.java
index 71e00a5..bcf6076 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/AdminBoundaryContextGenerator.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/AdminBoundaryContextGenerator.java
@@ -350,19 +350,20 @@ public class AdminBoundaryContextGenerator {
             provs = new HashMap<>();
           }
           //if (!provs.containsKey(adm.getProvCode())) {
-          provs.put(adm.countryCode() + "." + adm.getProvCode(), adm.provinceName());
+          String combined = adm.countryCode() + "." + adm.getProvCode();
+          provs.put(combined, adm.provinceName());
           provMap.put(adm.countryCode(), provs);
           // }
 
           if (!adm.countyCode().equalsIgnoreCase("no_data_found") && !adm.countyName().equalsIgnoreCase("no_data_found")) {
-            Map<String, String> counties = countyMap.get(adm.countryCode() + "." + adm.getProvCode());
+            Map<String, String> counties = countyMap.get(combined);
             if (counties == null) {
               counties = new HashMap<>();
             }
             // if (!counties.containsKey(adm.getCountyCode())) {
-            String countyid = adm.countryCode() + "." + adm.getProvCode() + "." + adm.countyCode();
+            String countyid = combined + "." + adm.countyCode();
             counties.put(countyid, adm.countyName());
-            countyMap.put(adm.countryCode() + "." + adm.getProvCode(), counties);
+            countyMap.put(combined, counties);
             // }
           }
         }
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/GazetteerEntry.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/GazetteerEntry.java
index 86fc0ea..6497894 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/GazetteerEntry.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/GazetteerEntry.java
@@ -127,7 +127,7 @@ public class GazetteerEntry extends BaseLink {
   @Override
   public String toString() {
 
-    return super.toString() + "\n\t\tGazateerEntry\n" + "\t\tlatitude=" +
+    return super.toString() + "\n\t\tGazetteerEntry\n" + "\t\tlatitude=" +
             latitude + ", \n\t\tlongitude=" + longitude + ", \n\t\tsource=" +
             source + ", \n\t\tindexID=" + indexID + ",\n\t\tindexData=" + indexData + "\n";
   }
@@ -152,9 +152,6 @@ public class GazetteerEntry extends BaseLink {
     if (!Objects.equals(this.source, other.source)) {
       return false;
     }
-    if (!Objects.equals(this.indexID, other.indexID)) {
-      return false;
-    }
-    return true;
+    return Objects.equals(this.indexID, other.indexID);
   }
 }
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GazetteerIndexer.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GazetteerIndexer.java
index d178a44..a640c5d 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GazetteerIndexer.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GazetteerIndexer.java
@@ -93,7 +93,7 @@ public class GazetteerIndexer {
    * <a href="https://geonames.usgs.gov/domestic/download_data.htm">here</a> click on the
    * national_file####.zip link to get all the most recent features
    *
-   * @param usgsGovUnitsFile go to
+   * @param usgsGovUnitsFile go
    * <a href="https://geonames.usgs.gov/domestic/download_data.htm">here</a> in the section titled
    * "Topical Gazetteers -- File Format" click on the dropdown list and select
    * "Government Units". The downloaded file is what you need for this param.
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GeonamesFileDownloader.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GeonamesFileDownloader.java
index df010ed..b255553 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GeonamesFileDownloader.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GeonamesFileDownloader.java
@@ -28,7 +28,7 @@ import java.util.zip.ZipFile;
 public class GeonamesFileDownloader {
 
   final static int size = 1024;
-  private static final String ALL_COUNTRIES = "http://download.geonames.org/export/dump/ZM.zip";
+  private static final String ALL_COUNTRIES = "https://download.geonames.org/export/dump/ZM.zip";
   private static final String COUNTRY_INFO = "";
   private static final String ADM1_LOOKUP = "";
 
@@ -81,7 +81,7 @@ public class GeonamesFileDownloader {
         byteWritten += byteRead;
       }
       System.out.println("Downloaded Successfully.");
-      System.out.println("File name:\"" + localFileName + "\"\nNo ofbytes :" + byteWritten);
+      System.out.println("File name:\"" + localFileName + "\"\nNo of bytes :" + byteWritten);
     } catch (Exception e) {
       e.printStackTrace();
     }
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GeonamesProcessor.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GeonamesProcessor.java
index 0553e3c..b1e8bee 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GeonamesProcessor.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GeonamesProcessor.java
@@ -127,7 +127,7 @@ public class GeonamesProcessor {
         }
         String[] values = line.split(TAB);
 
-        String ccode = values[0].toLowerCase();//this is the 2 digit ISO code
+        String ccode = values[0].toLowerCase(); //this is the 2-digit ISO code
         String cname = values[4].toLowerCase();
         if (!ccode.isEmpty()) {
           ccs.put(ccode, cname);
@@ -245,8 +245,6 @@ public class GeonamesProcessor {
         doc.add(new TextField("hierarchy", concatIndexEntry, Field.Store.YES));
         doc.add(new TextField("placename", placeName, Field.Store.YES));
         // doc.add(new TextField("countryname", countryname, Field.Store.YES));
-        //System.out.println(placeName);
-
         doc.add(new TextField("latitude", lat, Field.Store.YES));
         doc.add(new TextField("longitude", lon, Field.Store.YES));
         doc.add(new StringField("loctype", dsg, Field.Store.YES));
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/RegionProcessor.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/RegionProcessor.java
index 5335c2b..d97427f 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/RegionProcessor.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/RegionProcessor.java
@@ -55,14 +55,14 @@ public class RegionProcessor {
     }
   }
 
-  public static void readFile(File gazateerInputData, File outputCountryContextfile,
-                              IndexWriter w) throws IOException {
+  public static void readFile(File gazetteerInput, File outputCountryContextfile, IndexWriter w)
+          throws IOException {
     List<String> ccfileentries = new ArrayList<>();
     List<String> fields = new ArrayList<>();
     int counter = 0;
     System.out.println("reading gazetteer data from Regions file...........");
     String line;
-    try (BufferedReader reader = new BufferedReader(new FileReader(gazateerInputData))) {
+    try (BufferedReader reader = new BufferedReader(new FileReader(gazetteerInput))) {
       while ((line = reader.readLine()) != null) {
         String[] values = line.split("\t");
         if (counter == 0) {
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/USGSProcessor.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/USGSProcessor.java
index ac1e91f..09105f8 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/USGSProcessor.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/USGSProcessor.java
@@ -56,11 +56,11 @@ public class USGSProcessor {
     writeCountryContextFile(outputCountryContextfile, provData);
   }
 
-  public static void readFile(File gazateerInputData, IndexWriter w, GazetteerIndexer.GazType type,
+  public static void readFile(File gazetteerInput, IndexWriter w, GazetteerIndexer.GazType type,
                               Map<String, AdminBoundary> lookupMap) throws IOException {
 
     Map<String, StateCentroid> states = new HashMap<>();
-    try (BufferedReader reader = new BufferedReader(new FileReader(gazateerInputData))) {
+    try (BufferedReader reader = new BufferedReader(new FileReader(gazetteerInput))) {
 
       List<String> fields = new ArrayList<>();
       int counter = 0;
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/CountryProximityScorer.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/CountryProximityScorer.java
index 726c809..08d6055 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/CountryProximityScorer.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/CountryProximityScorer.java
@@ -204,7 +204,7 @@ public class CountryProximityScorer  implements LinkedEntityScorer<BaseLink, Adm
       for (Integer i : distanceMap.get(key)) {
         Double norm = normalize(i, min, max);
         //reverse the normed distance so low numbers (closer) are better
-        //this could be improved with a "decaying " function using an imcreaseing negative exponent
+        //this could be improved with a "decaying " function using an increasing negative exponent
         Double reverse = Math.abs(norm - 1);
         normalizedDistances.add(reverse);
       }
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/FuzzyStringMatchScorer.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/FuzzyStringMatchScorer.java
index a9a7e3e..873b6ea 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/FuzzyStringMatchScorer.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/FuzzyStringMatchScorer.java
@@ -28,8 +28,7 @@ import opennlp.tools.entitylinker.LinkedSpan;
 import opennlp.tools.util.Span;
 
 /**
- *
- * Generates scores based on string comparisons levenstein and dice
+ * Generates scores based on string comparisons Levenshtein and Dice.
  */
 public class FuzzyStringMatchScorer implements LinkedEntityScorer<GazetteerEntry, AdminBoundaryContext> {
 
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/ModelBasedScorer.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/ModelBasedScorer.java
index d227b8d..4b305e4 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/ModelBasedScorer.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/ModelBasedScorer.java
@@ -120,10 +120,10 @@ public class ModelBasedScorer implements LinkedEntityScorer<BaseLink, AdminBound
 
   public String getTextChunk(int mentionIdx, String docText, int radius) {
     int docSize = docText.length();
-    int left = 0, right = 0;
+    int left, right;
     left = (mentionIdx - radius < 0) ? 0 : mentionIdx - radius;
     right = (mentionIdx + radius > docSize) ? docSize : mentionIdx + radius;
-    String chunk = "";
+    String chunk;
     if (right <= left) {
       chunk = "";
     } else {
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/PointClustering.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/PointClustering.java
index a49c1aa..5f218d9 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/PointClustering.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/PointClustering.java
@@ -31,7 +31,7 @@ import opennlp.addons.geoentitylinker.GazetteerEntry;
 public class PointClustering {
 
   /**
-   * Clusters a set of points from the gazateers. The idea is that locations
+   * Clusters a set of points from the gazetteers. The idea is that locations
    * that matched a name that are closer to each other, the more likely the
    * toponym is to be accurate
    *
@@ -63,7 +63,7 @@ public class PointClustering {
     for (String key : clusters.keySet()) {
       int size = clusters.get(key).size();
       if (size > max) {
-        max = (double) size;
+        max = size;
       }
     }
     for (String key : clusters.keySet()) {
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/ProvinceProximityScorer.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/ProvinceProximityScorer.java
index 6badb60..13ce217 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/ProvinceProximityScorer.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/ProvinceProximityScorer.java
@@ -62,7 +62,7 @@ public class ProvinceProximityScorer implements LinkedEntityScorer<BaseLink, Adm
 
   /**
    * Assigns a score to each BaseLink in each linkedSpan's set of N best
-   * matches. Currently the scoring indicates the probability that the toponym
+   * matches. Currently, the scoring indicates the probability that the toponym
    * is correct based on the country context in the document
    *
    * @param linkedData the linked spans, holds the Namefinder results, and the
@@ -118,7 +118,7 @@ public class ProvinceProximityScorer implements LinkedEntityScorer<BaseLink, Adm
                                                        LinkedSpan<BaseLink> span, Integer maxAllowedDistance) {
     Double score = 0.0;
     /*
-     * get the index of the actual span, begining of sentence //should generate
+     * get the index of the actual span, beginning of sentence //should generate
      * tokens from sentence and create a char offset... //could have large
      * sentences due to poor sentence detection or wonky doc text
      */
@@ -131,22 +131,18 @@ public class ProvinceProximityScorer implements LinkedEntityScorer<BaseLink, Adm
     Map<String, Set<Integer>> distancesFromCodeMap = new HashMap<>();
     //map = Map<countrycode, Set <of distances this span is from all the mentions of the code>>
     for (String cCode : countryHits.keySet()) {
-      //iterate over all the regex start values and calculate an offset
+      // iterate over all the regex start values and calculate an offset
       for (Integer cHit : countryHits.get(cCode)) {
-        Integer absDist = Math.abs(sentIndexInDoc - cHit);
+        int absDist = Math.abs(sentIndexInDoc - cHit);
         //only include near mentions based on a heuristic
         //TODO make this a property
         //  if (absDist < maxAllowedDistance) {
         if (distancesFromCodeMap.containsKey(cCode)) {
           distancesFromCodeMap.get(cCode).add(absDist);
         } else {
-          HashSet<Integer> newset = new HashSet<>();
-          newset.add(absDist);
-          distancesFromCodeMap.put(cCode, newset);
+          distancesFromCodeMap.put(cCode, new HashSet<>(absDist));
         }
       }
-
-      //}
     }
     //we now know how far this named entity is from every country mention in the document
 
@@ -172,7 +168,7 @@ public class ProvinceProximityScorer implements LinkedEntityScorer<BaseLink, Adm
         if (nameCodesMap.containsKey(link.getItemName().toLowerCase()) || regexMatch(link.getItemName(), link.getItemParentID())) {
           //if so, is it the correct country code for that name?
           if (nameCodesMap.get(entry.getItemName().toLowerCase()).contains(entry.getProvinceCode())) {
-            //boost the score becuase it is likely that this is the location in the text, so add 50% to the score or set to 1
+            //boost the score because it is likely that this is the location in the text, so add 50% to the score or set to 1
             //TODO: make this smarter
             score = (score + .75) > 1.0 ? 1d : (score + .75);
 
@@ -219,15 +215,15 @@ public class ProvinceProximityScorer implements LinkedEntityScorer<BaseLink, Adm
     for (String key : distanceMap.keySet()) {
       all.addAll(distanceMap.get(key));
     }
-    //get min max for normalization, this could be more efficient
-
+    
+    // get min max for normalization, this could be more efficient
     int min = all.first();
     int max = all.last();
     if (min == max) {
       min = 0;
     }
-    for (String key : distanceMap.keySet()) {
 
+    for (String key : distanceMap.keySet()) {
       TreeSet<Double> normalizedDistances = new TreeSet<>();
       for (Integer i : distanceMap.get(key)) {
         Double norm = normalize(i, min, max);
diff --git a/japanese-addon/src/main/java/opennlp/tools/namefind/AuxiliaryInfoNameContextGenerator.java b/japanese-addon/src/main/java/opennlp/tools/namefind/AuxiliaryInfoNameContextGenerator.java
index bda691b..333379f 100644
--- a/japanese-addon/src/main/java/opennlp/tools/namefind/AuxiliaryInfoNameContextGenerator.java
+++ b/japanese-addon/src/main/java/opennlp/tools/namefind/AuxiliaryInfoNameContextGenerator.java
@@ -24,7 +24,7 @@ import opennlp.tools.util.featuregen.AdaptiveFeatureGenerator;
 import opennlp.tools.util.featuregen.FeatureGeneratorUtil;
 
 /**
- * If a token contains an auxiliary information, e.g. POS tag, this class can be used
+ * If a token contains auxiliary information, e.g. POS tag, this class can be used
  * to extract word part in {@link #getContext(int, String[], String[], Object[])} method.
  *
  * <strong>EXPERIMENTAL</strong>.
@@ -40,11 +40,11 @@ public class AuxiliaryInfoNameContextGenerator extends DefaultNameContextGenerat
    * Return the context for finding names at the specified index.
    * @param index The index of the token in the specified toks array for which the
    *              context should be constructed.
-   * @param tokens The tokens of the sentence.  The <code>toString</code> methods
+   * @param tokens The tokens of the sentence. The <code>toString</code> methods
    *               of these objects should return the token text.
    * @param preds The previous decisions made in the tagging of this sequence.
-   *              Only indices less than i will be examined.
-   * @param additionalContext Addition features which may be based on a context outside of the sentence.
+   *              Only indices less than {@code i} will be examined.
+   * @param additionalContext Addition features which may be based on a context outside the sentence.
    *
    * @return the context for finding names at the specified index.
    */
diff --git a/japanese-addon/src/main/java/opennlp/tools/namefind/AuxiliaryInfoTokenNameFinderFactory.java b/japanese-addon/src/main/java/opennlp/tools/namefind/AuxiliaryInfoTokenNameFinderFactory.java
index ea091e6..9977433 100644
--- a/japanese-addon/src/main/java/opennlp/tools/namefind/AuxiliaryInfoTokenNameFinderFactory.java
+++ b/japanese-addon/src/main/java/opennlp/tools/namefind/AuxiliaryInfoTokenNameFinderFactory.java
@@ -28,7 +28,7 @@ import opennlp.tools.util.featuregen.TokenFeatureGenerator;
 import opennlp.tools.util.featuregen.WindowFeatureGenerator;
 
 /**
- * If a token contains an auxiliary information, e.g. POS tag, in the training data,
+ * If a token contains auxiliary information, e.g. POS tag, in the training data,
  * you can use this class via -factory command line option.
  *
  * <strong>EXPERIMENTAL</strong>.
diff --git a/japanese-addon/src/main/java/opennlp/tools/namefind/AuxiliaryInfoUtil.java b/japanese-addon/src/main/java/opennlp/tools/namefind/AuxiliaryInfoUtil.java
index 7bb336c..a9eb7f8 100644
--- a/japanese-addon/src/main/java/opennlp/tools/namefind/AuxiliaryInfoUtil.java
+++ b/japanese-addon/src/main/java/opennlp/tools/namefind/AuxiliaryInfoUtil.java
@@ -18,7 +18,7 @@
 package opennlp.tools.namefind;
 
 /**
- * If a token contains an auxiliary information, e.g. POS tag, this class can be used
+ * If a token contains auxiliary information, e.g. POS tag, this class can be used
  * to extract word part or auxiliary information part.<br>
  *
  * ex) token := word '/' POStag
diff --git a/japanese-addon/src/main/java/opennlp/tools/util/featuregen/AuxiliaryInfoAwareDelegateFeatureGenerator.java b/japanese-addon/src/main/java/opennlp/tools/util/featuregen/AuxiliaryInfoAwareDelegateFeatureGenerator.java
index ee82c0c..aa9178d 100644
--- a/japanese-addon/src/main/java/opennlp/tools/util/featuregen/AuxiliaryInfoAwareDelegateFeatureGenerator.java
+++ b/japanese-addon/src/main/java/opennlp/tools/util/featuregen/AuxiliaryInfoAwareDelegateFeatureGenerator.java
@@ -23,7 +23,7 @@ import java.util.List;
 import opennlp.tools.namefind.AuxiliaryInfoUtil;
 
 /**
- * If a token contains an auxiliary information, e.g. POS tag, in the training data,
+ * If a token contains auxiliary information, e.g. POS tag, in the training data,
  * you can use this feature generator in order to let the feature generator choose
  * word part or auxiliary information part.<br>
  *
diff --git a/japanese-addon/src/main/java/opennlp/tools/util/featuregen/lang/jpn/BrownTokenClassFeatureGenerator.java b/japanese-addon/src/main/java/opennlp/tools/util/featuregen/lang/jpn/BrownTokenClassFeatureGenerator.java
index 2d12171..edae61f 100644
--- a/japanese-addon/src/main/java/opennlp/tools/util/featuregen/lang/jpn/BrownTokenClassFeatureGenerator.java
+++ b/japanese-addon/src/main/java/opennlp/tools/util/featuregen/lang/jpn/BrownTokenClassFeatureGenerator.java
@@ -28,7 +28,7 @@ import opennlp.tools.util.featuregen.BrownTokenClasses;
  */
 public class BrownTokenClassFeatureGenerator implements AdaptiveFeatureGenerator {
 
-  private BrownCluster brownLexicon;
+  private final BrownCluster brownLexicon;
 
   public BrownTokenClassFeatureGenerator(BrownCluster dict) {
     this.brownLexicon = dict;
diff --git a/japanese-addon/src/main/java/opennlp/tools/util/featuregen/lang/jpn/FeatureGeneratorUtil.java b/japanese-addon/src/main/java/opennlp/tools/util/featuregen/lang/jpn/FeatureGeneratorUtil.java
index a6c603a..03b5659 100644
--- a/japanese-addon/src/main/java/opennlp/tools/util/featuregen/lang/jpn/FeatureGeneratorUtil.java
+++ b/japanese-addon/src/main/java/opennlp/tools/util/featuregen/lang/jpn/FeatureGeneratorUtil.java
@@ -42,7 +42,7 @@ public class FeatureGeneratorUtil {
 
     Objects.requireNonNull(token, "token must be not null!");
 
-    if (token.length() == 0) return "other";
+    if (token.isEmpty()) return "other";
 
     // scan token only once
     char c = token.charAt(0);
diff --git a/japanese-addon/src/main/java/opennlp/tools/util/featuregen/lang/jpn/TokenClassFeatureGenerator.java b/japanese-addon/src/main/java/opennlp/tools/util/featuregen/lang/jpn/TokenClassFeatureGenerator.java
index 14cff33..be4cadf 100644
--- a/japanese-addon/src/main/java/opennlp/tools/util/featuregen/lang/jpn/TokenClassFeatureGenerator.java
+++ b/japanese-addon/src/main/java/opennlp/tools/util/featuregen/lang/jpn/TokenClassFeatureGenerator.java
@@ -31,7 +31,7 @@ public class TokenClassFeatureGenerator implements AdaptiveFeatureGenerator {
   private static final String TOKEN_CLASS_PREFIX = "wc";
   private static final String TOKEN_AND_CLASS_PREFIX = "w&c";
 
-  private boolean generateWordAndClassFeature;
+  private final boolean generateWordAndClassFeature;
 
   public TokenClassFeatureGenerator() {
     this(false);
diff --git a/japanese-addon/src/main/java/opennlp/tools/util/featuregen/lang/jpn/TokenPatternFeatureGenerator.java b/japanese-addon/src/main/java/opennlp/tools/util/featuregen/lang/jpn/TokenPatternFeatureGenerator.java
index 7771ed7..cf1fe7a 100644
--- a/japanese-addon/src/main/java/opennlp/tools/util/featuregen/lang/jpn/TokenPatternFeatureGenerator.java
+++ b/japanese-addon/src/main/java/opennlp/tools/util/featuregen/lang/jpn/TokenPatternFeatureGenerator.java
@@ -32,8 +32,8 @@ import opennlp.tools.util.featuregen.AdaptiveFeatureGenerator;
  */
 public class TokenPatternFeatureGenerator implements AdaptiveFeatureGenerator {
 
-  private Pattern noLetters = Pattern.compile("[^a-zA-Z]");
-  private Tokenizer tokenizer;
+  private final Pattern noLetters = Pattern.compile("[^a-zA-Z]");
+  private final Tokenizer tokenizer;
 
   /**
    * Initializes a new instance.
diff --git a/japanese-addon/src/test/java/opennlp/tools/namefind/AuxiliaryInfoUtilTest.java b/japanese-addon/src/test/java/opennlp/tools/namefind/AuxiliaryInfoUtilTest.java
index 4c0bcc1..db9bad2 100644
--- a/japanese-addon/src/test/java/opennlp/tools/namefind/AuxiliaryInfoUtilTest.java
+++ b/japanese-addon/src/test/java/opennlp/tools/namefind/AuxiliaryInfoUtilTest.java
@@ -25,20 +25,20 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 public class AuxiliaryInfoUtilTest {
 
   @Test
-  public void testGetSeparatorIndex() throws Exception {
+  public void testGetSeparatorIndex() {
     assertEquals(0, AuxiliaryInfoUtil.getSeparatorIndex("/POStag"));
     assertEquals(1, AuxiliaryInfoUtil.getSeparatorIndex("1/POStag"));
     assertEquals(10, AuxiliaryInfoUtil.getSeparatorIndex("word/stuff/POStag"));
   }
 
   @Test
-  public void testGetSeparatorIndexNoPos() throws Exception {
+  public void testGetSeparatorIndexNoPos() {
     Assertions.assertThrows(RuntimeException.class, () ->
             AuxiliaryInfoUtil.getSeparatorIndex("NOPOStags"));
   }
 
   @Test
-  public void testGetWordPart() throws Exception {
+  public void testGetWordPart() {
     assertEquals(" ", AuxiliaryInfoUtil.getWordPart("/POStag"));
     assertEquals("1", AuxiliaryInfoUtil.getWordPart("1/POStag"));
     assertEquals("word", AuxiliaryInfoUtil.getWordPart("word/POStag"));
@@ -46,7 +46,7 @@ public class AuxiliaryInfoUtilTest {
   }
 
   @Test
-  public void testGetWordParts() throws Exception {
+  public void testGetWordParts() {
     String[] results = AuxiliaryInfoUtil.getWordParts(new String[]{"1/A", "234/B", "3456/C", "/D"});
     assertEquals(4, results.length);
     assertEquals("1", results[0]);
@@ -56,7 +56,7 @@ public class AuxiliaryInfoUtilTest {
   }
 
   @Test
-  public void testGetAuxPart() throws Exception {
+  public void testGetAuxPart() {
     assertEquals("POStag", AuxiliaryInfoUtil.getAuxPart("/POStag"));
     assertEquals("POStag", AuxiliaryInfoUtil.getAuxPart("1/POStag"));
     assertEquals("POStag", AuxiliaryInfoUtil.getAuxPart("word/POStag"));
@@ -64,7 +64,7 @@ public class AuxiliaryInfoUtilTest {
   }
 
   @Test
-  public void testGetAuxParts() throws Exception {
+  public void testGetAuxParts() {
     String[] results = AuxiliaryInfoUtil.getAuxParts(new String[] {"1/ABC", "234/B", "3456/CD", "/DEFGH"});
     assertEquals(4, results.length);
     assertEquals("ABC", results[0]);
diff --git a/japanese-addon/src/test/java/opennlp/tools/util/featuregen/AuxiliaryInfoAwareDelegateFeatureGeneratorTest.java b/japanese-addon/src/test/java/opennlp/tools/util/featuregen/AuxiliaryInfoAwareDelegateFeatureGeneratorTest.java
index 8c8f44d..40f34e6 100644
--- a/japanese-addon/src/test/java/opennlp/tools/util/featuregen/AuxiliaryInfoAwareDelegateFeatureGeneratorTest.java
+++ b/japanese-addon/src/test/java/opennlp/tools/util/featuregen/AuxiliaryInfoAwareDelegateFeatureGeneratorTest.java
@@ -32,12 +32,12 @@ public class AuxiliaryInfoAwareDelegateFeatureGeneratorTest {
   private List<String> features;
 
   @BeforeEach
-  public void setUp() throws Exception {
+  public void setUp() {
     features = new ArrayList<>();
   }
 
   @Test
-  public void testWord() throws Exception {
+  public void testWord() {
     AdaptiveFeatureGenerator featureGenerator = new AuxiliaryInfoAwareDelegateFeatureGenerator(
         new IdentityFeatureGenerator(), false);
 
@@ -47,7 +47,7 @@ public class AuxiliaryInfoAwareDelegateFeatureGeneratorTest {
   }
 
   @Test
-  public void testAuxInfo() throws Exception {
+  public void testAuxInfo() {
     AdaptiveFeatureGenerator featureGenerator = new AuxiliaryInfoAwareDelegateFeatureGenerator(
         new IdentityFeatureGenerator(), true);
 
diff --git a/japanese-addon/src/test/java/opennlp/tools/util/featuregen/lang/jpn/BigramNameFeatureGeneratorTest.java b/japanese-addon/src/test/java/opennlp/tools/util/featuregen/lang/jpn/BigramNameFeatureGeneratorTest.java
index 46d952e..12407a5 100644
--- a/japanese-addon/src/test/java/opennlp/tools/util/featuregen/lang/jpn/BigramNameFeatureGeneratorTest.java
+++ b/japanese-addon/src/test/java/opennlp/tools/util/featuregen/lang/jpn/BigramNameFeatureGeneratorTest.java
@@ -30,10 +30,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 public class BigramNameFeatureGeneratorTest {
 
   private List<String> features;
-  static String[] testSentence = new String[] {"This", "is", "an", "example", "sentence"};
+  private static final String[] TEST_SENTENCE = new String[] {"This", "is", "an", "example", "sentence"};
 
   @BeforeEach
-  public void setUp() throws Exception {
+  public void setUp() {
     features = new ArrayList<>();
   }
 
@@ -44,7 +44,7 @@ public class BigramNameFeatureGeneratorTest {
 
     AdaptiveFeatureGenerator generator = new BigramNameFeatureGenerator();
 
-    generator.createFeatures(features, testSentence, testTokenIndex, null);
+    generator.createFeatures(features, TEST_SENTENCE, testTokenIndex, null);
 
     assertEquals(2, features.size());
     assertEquals("w,nw=This,is", features.get(0));
@@ -58,7 +58,7 @@ public class BigramNameFeatureGeneratorTest {
 
     AdaptiveFeatureGenerator generator = new BigramNameFeatureGenerator();
 
-    generator.createFeatures(features, testSentence, testTokenIndex, null);
+    generator.createFeatures(features, TEST_SENTENCE, testTokenIndex, null);
 
     assertEquals(4, features.size());
     assertEquals("pw,w=is,an", features.get(0));
@@ -74,7 +74,7 @@ public class BigramNameFeatureGeneratorTest {
 
     AdaptiveFeatureGenerator generator = new BigramNameFeatureGenerator();
 
-    generator.createFeatures(features, testSentence, testTokenIndex, null);
+    generator.createFeatures(features, TEST_SENTENCE, testTokenIndex, null);
 
     assertEquals(2, features.size());
     assertEquals("pw,w=example,sentence", features.get(0));
diff --git a/japanese-addon/src/test/java/opennlp/tools/util/featuregen/lang/jpn/TokenClassFeatureGeneratorTest.java b/japanese-addon/src/test/java/opennlp/tools/util/featuregen/lang/jpn/TokenClassFeatureGeneratorTest.java
index dc6962d..96cd746 100644
--- a/japanese-addon/src/test/java/opennlp/tools/util/featuregen/lang/jpn/TokenClassFeatureGeneratorTest.java
+++ b/japanese-addon/src/test/java/opennlp/tools/util/featuregen/lang/jpn/TokenClassFeatureGeneratorTest.java
@@ -30,10 +30,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 public class TokenClassFeatureGeneratorTest {
 
   private List<String> features;
-  static String[] testSentence = new String[] {"This", "is", "an", "Example", "sentence"};
+  private static final String[] TEST_SENTENCE = new String[] {"This", "is", "an", "Example", "sentence"};
 
   @BeforeEach
-  public void setUp() throws Exception {
+  public void setUp() {
     features = new ArrayList<>();
   }
 
@@ -44,7 +44,7 @@ public class TokenClassFeatureGeneratorTest {
 
     AdaptiveFeatureGenerator generator = new TokenClassFeatureGenerator(true);
 
-    generator.createFeatures(features, testSentence, testTokenIndex, null);
+    generator.createFeatures(features, TEST_SENTENCE, testTokenIndex, null);
 
    assertEquals(2, features.size());
    assertEquals("wc=alpha", features.get(0));
@@ -58,7 +58,7 @@ public class TokenClassFeatureGeneratorTest {
 
     AdaptiveFeatureGenerator generator = new TokenClassFeatureGenerator(false);
 
-    generator.createFeatures(features, testSentence, testTokenIndex, null);
+    generator.createFeatures(features, TEST_SENTENCE, testTokenIndex, null);
 
    assertEquals(1, features.size());
    assertEquals("wc=alpha", features.get(0));
diff --git a/japanese-addon/src/test/java/opennlp/tools/util/featuregen/lang/jpn/TokenPatternFeatureGeneratorTest.java b/japanese-addon/src/test/java/opennlp/tools/util/featuregen/lang/jpn/TokenPatternFeatureGeneratorTest.java
index 24509ef..3b84faf 100644
--- a/japanese-addon/src/test/java/opennlp/tools/util/featuregen/lang/jpn/TokenPatternFeatureGeneratorTest.java
+++ b/japanese-addon/src/test/java/opennlp/tools/util/featuregen/lang/jpn/TokenPatternFeatureGeneratorTest.java
@@ -32,7 +32,7 @@ public class TokenPatternFeatureGeneratorTest {
   private List<String> features;
 
   @BeforeEach
-  public void setUp() throws Exception {
+  public void setUp() {
     features = new ArrayList<>();
   }
 
diff --git a/japanese-addon/src/test/java/opennlp/tools/util/featuregen/lang/jpn/TrigramNameFeatureGeneratorTest.java b/japanese-addon/src/test/java/opennlp/tools/util/featuregen/lang/jpn/TrigramNameFeatureGeneratorTest.java
index 789c508..02bafb1 100644
--- a/japanese-addon/src/test/java/opennlp/tools/util/featuregen/lang/jpn/TrigramNameFeatureGeneratorTest.java
+++ b/japanese-addon/src/test/java/opennlp/tools/util/featuregen/lang/jpn/TrigramNameFeatureGeneratorTest.java
@@ -30,10 +30,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 public class TrigramNameFeatureGeneratorTest {
 
   private List<String> features;
-  static String[] testSentence = new String[] {"This", "is", "an", "example", "sentence"};
+  private static final String[] TEST_SENTENCE = new String[] {"This", "is", "an", "example", "sentence"};
 
   @BeforeEach
-  public void setUp() throws Exception {
+  public void setUp() {
     features = new ArrayList<>();
   }
 
@@ -44,7 +44,7 @@ public class TrigramNameFeatureGeneratorTest {
 
     AdaptiveFeatureGenerator generator = new TrigramNameFeatureGenerator();
 
-    generator.createFeatures(features, testSentence, testTokenIndex, null);
+    generator.createFeatures(features, TEST_SENTENCE, testTokenIndex, null);
 
     assertEquals(2, features.size());
     assertEquals("w,nw,nnw=This,is,an", features.get(0));
@@ -58,7 +58,7 @@ public class TrigramNameFeatureGeneratorTest {
 
     AdaptiveFeatureGenerator generator = new TrigramNameFeatureGenerator();
 
-    generator.createFeatures(features, testSentence, testTokenIndex, null);
+    generator.createFeatures(features, TEST_SENTENCE, testTokenIndex, null);
 
     assertEquals(2, features.size());
     assertEquals("w,nw,nnw=is,an,example", features.get(0));
@@ -72,7 +72,7 @@ public class TrigramNameFeatureGeneratorTest {
 
     AdaptiveFeatureGenerator generator = new TrigramNameFeatureGenerator();
 
-    generator.createFeatures(features, testSentence, testTokenIndex, null);
+    generator.createFeatures(features, TEST_SENTENCE, testTokenIndex, null);
 
     assertEquals(4, features.size());
     assertEquals("ppw,pw,w=This,is,an", features.get(0));
@@ -88,7 +88,7 @@ public class TrigramNameFeatureGeneratorTest {
 
     AdaptiveFeatureGenerator generator = new TrigramNameFeatureGenerator();
 
-    generator.createFeatures(features, testSentence, testTokenIndex, null);
+    generator.createFeatures(features, TEST_SENTENCE, testTokenIndex, null);
 
     assertEquals(2, features.size());
     assertEquals("ppw,pw,w=an,example,sentence", features.get(0));
diff --git a/jwnl-addon/src/test/java/opennlp/jwnl/lemmatizer/JWNLLemmatizerTest.java b/jwnl-addon/src/test/java/opennlp/jwnl/lemmatizer/JWNLLemmatizerTest.java
index e417830..88d8b1b 100644
--- a/jwnl-addon/src/test/java/opennlp/jwnl/lemmatizer/JWNLLemmatizerTest.java
+++ b/jwnl-addon/src/test/java/opennlp/jwnl/lemmatizer/JWNLLemmatizerTest.java
@@ -60,9 +60,8 @@ public class JWNLLemmatizerTest {
 
   @Test
   public void testLemmatizeList() {
-    assertThrows(UnsupportedOperationException.class, () -> {
-      lemmatizer.lemmatize(List.of("mouse"), List.of("NN"));
-    });
+    assertThrows(UnsupportedOperationException.class, () ->
+            lemmatizer.lemmatize(List.of("mouse"), List.of("NN")));
   }
 
   private static Stream<Arguments> provideData() {
diff --git a/liblinear-addon/src/main/java/LiblinearModelSerializer.java b/liblinear-addon/src/main/java/LiblinearModelSerializer.java
index 19da2bb..370e225 100644
--- a/liblinear-addon/src/main/java/LiblinearModelSerializer.java
+++ b/liblinear-addon/src/main/java/LiblinearModelSerializer.java
@@ -27,11 +27,13 @@ import opennlp.tools.util.model.ArtifactSerializer;
 public class LiblinearModelSerializer implements
     ArtifactSerializer<LiblinearModel> {
 
+  @Override
   public LiblinearModel create(InputStream in) throws IOException,
       InvalidFormatException {
     return new LiblinearModel(in);
   }
 
+  @Override
   public void serialize(LiblinearModel model, OutputStream out)
       throws IOException {
     model.serialize(out);
diff --git a/liblinear-addon/src/main/java/LiblinearTrainer.java b/liblinear-addon/src/main/java/LiblinearTrainer.java
index abfac72..a494a09 100644
--- a/liblinear-addon/src/main/java/LiblinearTrainer.java
+++ b/liblinear-addon/src/main/java/LiblinearTrainer.java
@@ -103,7 +103,7 @@ public class LiblinearTrainer extends AbstractEventTrainer {
     List<Feature[]> vx = new ArrayList<>();
 
     // outcomes
-    int outcomes[] = indexer.getOutcomeList();
+    int[] outcomes = indexer.getOutcomeList();
 
     int max_index = 0;
     
diff --git a/modelbuilder-addon/src/main/java/opennlp/addons/modelbuilder/KnownEntityProvider.java b/modelbuilder-addon/src/main/java/opennlp/addons/modelbuilder/KnownEntityProvider.java
index 9354c50..60104a1 100644
--- a/modelbuilder-addon/src/main/java/opennlp/addons/modelbuilder/KnownEntityProvider.java
+++ b/modelbuilder-addon/src/main/java/opennlp/addons/modelbuilder/KnownEntityProvider.java
@@ -28,7 +28,7 @@ Supplies a list of known entities (a list of names or locations)
 public interface KnownEntityProvider extends ModelParameter<BaseModelBuilderParams> {
 
   /**
-   * returns a list of known non ambiguous entities.
+   * returns a list of known non-ambiguous entities.
    * @return a set of entities
    */
   Set<String> getKnownEntities();
diff --git a/modelbuilder-addon/src/main/java/opennlp/addons/modelbuilder/ModelGenerationValidator.java b/modelbuilder-addon/src/main/java/opennlp/addons/modelbuilder/ModelGenerationValidator.java
index a66f36f..16c11e0 100644
--- a/modelbuilder-addon/src/main/java/opennlp/addons/modelbuilder/ModelGenerationValidator.java
+++ b/modelbuilder-addon/src/main/java/opennlp/addons/modelbuilder/ModelGenerationValidator.java
@@ -20,16 +20,13 @@ import opennlp.addons.modelbuilder.impls.BaseModelBuilderParams;
 import java.util.Collection;
 
 /**
- *
-Validates results from the iterative namefinding
+ * Validates results from the iterative name finding.
  */
 public interface ModelGenerationValidator extends ModelParameter<BaseModelBuilderParams> {
 
   Boolean validSentence(String sentence);
 
   Boolean validNamedEntity(String namedEntity);
-  
-
 
   Collection<String> getBlackList();
 }
diff --git a/modelbuilder-addon/src/main/java/opennlp/addons/modelbuilder/impls/FileKnownEntityProvider.java b/modelbuilder-addon/src/main/java/opennlp/addons/modelbuilder/impls/FileKnownEntityProvider.java
index 7aa7d0c..1cb94b4 100644
--- a/modelbuilder-addon/src/main/java/opennlp/addons/modelbuilder/impls/FileKnownEntityProvider.java
+++ b/modelbuilder-addon/src/main/java/opennlp/addons/modelbuilder/impls/FileKnownEntityProvider.java
@@ -17,24 +17,22 @@ package opennlp.addons.modelbuilder.impls;
 
 import java.io.BufferedReader;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.HashSet;
 import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+
 import opennlp.addons.modelbuilder.KnownEntityProvider;
 
-/**
- *
- */
 public class FileKnownEntityProvider implements KnownEntityProvider {
  
-  Set<String> knownEntities = new HashSet<>();
-  BaseModelBuilderParams params;
+  private final Set<String> knownEntities = new HashSet<>();
+  private BaseModelBuilderParams params;
+  
   @Override
   public Set<String> getKnownEntities() {
     if (knownEntities.isEmpty()) {
@@ -44,7 +42,7 @@ public class FileKnownEntityProvider implements KnownEntityProvider {
         String line;
 
         fis = new FileInputStream(params.getKnownEntitiesFile());
-        br = new BufferedReader(new InputStreamReader(fis, Charset.forName("UTF-8")));
+        br = new BufferedReader(new InputStreamReader(fis, StandardCharsets.UTF_8));
         while ((line = br.readLine()) != null) {
           knownEntities.add(line);
         }
diff --git a/modelbuilder-addon/src/main/java/opennlp/addons/modelbuilder/impls/FileModelValidatorImpl.java b/modelbuilder-addon/src/main/java/opennlp/addons/modelbuilder/impls/FileModelValidatorImpl.java
index a953c76..8b31d56 100644
--- a/modelbuilder-addon/src/main/java/opennlp/addons/modelbuilder/impls/FileModelValidatorImpl.java
+++ b/modelbuilder-addon/src/main/java/opennlp/addons/modelbuilder/impls/FileModelValidatorImpl.java
@@ -34,7 +34,7 @@ import opennlp.addons.modelbuilder.ModelGenerationValidator;
 public class FileModelValidatorImpl implements ModelGenerationValidator {
 
   private final Set<String> badentities = new HashSet<>();
-  BaseModelBuilderParams params;
+  private BaseModelBuilderParams params;
 
   @Override
   public void setParameters(BaseModelBuilderParams params) {
@@ -58,11 +58,7 @@ public class FileModelValidatorImpl implements ModelGenerationValidator {
 //    if (p.matcher(namedEntity).find()) {
 //      return false;
 //    }
-    boolean b = true;
-    if (badentities.contains(namedEntity.toLowerCase())) {
-      b = false;
-    }
-    return b;
+    return !badentities.contains(namedEntity.toLowerCase());
   }
 
   @Override
diff --git a/modelbuilder-addon/src/main/java/opennlp/addons/modelbuilder/impls/GenericModelGenerator.java b/modelbuilder-addon/src/main/java/opennlp/addons/modelbuilder/impls/GenericModelGenerator.java
index 126157f..358cef1 100644
--- a/modelbuilder-addon/src/main/java/opennlp/addons/modelbuilder/impls/GenericModelGenerator.java
+++ b/modelbuilder-addon/src/main/java/opennlp/addons/modelbuilder/impls/GenericModelGenerator.java
@@ -43,8 +43,8 @@ public class GenericModelGenerator implements SemiSupervisedModelGenerator {
           ModelGenerationValidator validator, Modelable modelable, int iterations) {
     for (int iteration = 0; iteration < iterations; iteration++) {
       System.out.println("ITERATION: " + iteration);
-      System.out.println("\tPerfoming Known Entity Annotation");
-      System.out.println("\t\tknowns: " + knownEntityProvider.getKnownEntities().size());
+      System.out.println("\tPerforming Known Entity Annotation");
+      System.out.println("\t\tknown size: " + knownEntityProvider.getKnownEntities().size());
       System.out.println("\t\treading data....: ");
       for (String sentence : sentenceProvider.getSentences()) {
         for (String knownEntity : knownEntityProvider.getKnownEntities()) {
@@ -95,7 +95,7 @@ public class GenericModelGenerator implements SemiSupervisedModelGenerator {
         }
       }
       System.out.println("\t\tannotated sentences: " + modelable.getAnnotatedSentences().size());
-      System.out.println("\t\tknowns: " + knownEntityProvider.getKnownEntities().size());
+      System.out.println("\t\tknown size: " + knownEntityProvider.getKnownEntities().size());
     }
     modelable.writeAnnotatedSentences();
     modelable.buildModel(knownEntityProvider.getKnownEntitiesType());
diff --git a/morfologik-addon/src/main/assembly/bin.xml b/morfologik-addon/src/main/assembly/bin.xml
index ab4f6da..856685a 100644
--- a/morfologik-addon/src/main/assembly/bin.xml
+++ b/morfologik-addon/src/main/assembly/bin.xml
@@ -45,14 +45,14 @@
 	<fileSets>
 	    <fileSet>
 	    	<directory>src/main/readme</directory>
-	    	<outputDirectory></outputDirectory>
+	    	<outputDirectory/>
 	    	<fileMode>644</fileMode>
 	    	<directoryMode>755</directoryMode>      
 	    </fileSet>
 		
 	    <fileSet>
 	      <directory>.</directory>
-	      <outputDirectory></outputDirectory>
+	      <outputDirectory/>
 	      <filtered>true</filtered>
 	      <fileMode>644</fileMode>
 	      <directoryMode>755</directoryMode> 
@@ -64,7 +64,7 @@
 	    
 	    <fileSet>
 	      <directory>target</directory>
-	      <outputDirectory></outputDirectory>
+	      <outputDirectory/>
 	      <fileMode>644</fileMode>
 	      <directoryMode>755</directoryMode> 
 	      <includes>
diff --git a/morfologik-addon/src/main/assembly/src.xml b/morfologik-addon/src/main/assembly/src.xml
index cdcc9d3..f67f953 100644
--- a/morfologik-addon/src/main/assembly/src.xml
+++ b/morfologik-addon/src/main/assembly/src.xml
@@ -27,7 +27,7 @@
   <fileSets>
     <fileSet>
       <directory>../</directory>
-      <outputDirectory></outputDirectory>
+      <outputDirectory/>
       <excludes>
         <exclude>**/target/**</exclude>
         <exclude>**/.*/**</exclude>
diff --git a/morfologik-addon/src/main/java/opennlp/morfologik/builder/MorfologikDictionayBuilder.java b/morfologik-addon/src/main/java/opennlp/morfologik/builder/MorfologikDictionaryBuilder.java
similarity index 95%
rename from morfologik-addon/src/main/java/opennlp/morfologik/builder/MorfologikDictionayBuilder.java
rename to morfologik-addon/src/main/java/opennlp/morfologik/builder/MorfologikDictionaryBuilder.java
index dbbca4d..f827d03 100644
--- a/morfologik-addon/src/main/java/opennlp/morfologik/builder/MorfologikDictionayBuilder.java
+++ b/morfologik-addon/src/main/java/opennlp/morfologik/builder/MorfologikDictionaryBuilder.java
@@ -17,8 +17,6 @@
 
 package opennlp.morfologik.builder;
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
 import java.nio.charset.Charset;
 import java.nio.file.Path;
 import java.util.Properties;
@@ -32,7 +30,7 @@ import morfologik.tools.DictCompile;
  * file. The first column is the word, the second its lemma and the third a POS
  * tag. If there is no lemma information leave the second column empty.
  */
-public class MorfologikDictionayBuilder {
+public class MorfologikDictionaryBuilder {
 
   /**
    * Helper to compile a morphological dictionary automaton.
@@ -90,7 +88,7 @@ public class MorfologikDictionayBuilder {
   }
 
   Properties createProperties(Charset encoding, String separator,
-      EncoderType encoderType) throws FileNotFoundException, IOException {
+      EncoderType encoderType) {
 
     Properties properties = new Properties();
     properties.setProperty("fsa.dict.separator", separator);
diff --git a/morfologik-addon/src/main/java/opennlp/morfologik/cmdline/CLI.java b/morfologik-addon/src/main/java/opennlp/morfologik/cmdline/CLI.java
index 5205739..5373ecd 100644
--- a/morfologik-addon/src/main/java/opennlp/morfologik/cmdline/CLI.java
+++ b/morfologik-addon/src/main/java/opennlp/morfologik/cmdline/CLI.java
@@ -103,7 +103,7 @@ public final class CLI {
 	      System.exit(0);
 	    }
 
-	    String toolArguments[] = new String[args.length -1];
+	    String[] toolArguments = new String[args.length -1];
 	    System.arraycopy(args, 1, toolArguments, 0, toolArguments.length);
 
 	    String toolName = args[0];
diff --git a/morfologik-addon/src/main/java/opennlp/morfologik/cmdline/builder/MorfologikDictionaryBuilderTool.java b/morfologik-addon/src/main/java/opennlp/morfologik/cmdline/builder/MorfologikDictionaryBuilderTool.java
index eb9b51c..923255f 100644
--- a/morfologik-addon/src/main/java/opennlp/morfologik/cmdline/builder/MorfologikDictionaryBuilderTool.java
+++ b/morfologik-addon/src/main/java/opennlp/morfologik/cmdline/builder/MorfologikDictionaryBuilderTool.java
@@ -21,7 +21,7 @@ import java.io.File;
 import java.nio.file.Path;
 
 import morfologik.stemming.DictionaryMetadata;
-import opennlp.morfologik.builder.MorfologikDictionayBuilder;
+import opennlp.morfologik.builder.MorfologikDictionaryBuilder;
 import opennlp.tools.cmdline.BasicCmdLineTool;
 import opennlp.tools.cmdline.CmdLineUtil;
 import opennlp.tools.cmdline.TerminateToolException;
@@ -48,14 +48,14 @@ public class MorfologikDictionaryBuilderTool extends BasicCmdLineTool {
     Path metadataPath = DictionaryMetadata.getExpectedMetadataLocation(dictInFile.toPath());
     CmdLineUtil.checkInputFile("dictionary metadata (.info) input file", metadataPath.toFile());
 
-    MorfologikDictionayBuilder builder = new MorfologikDictionayBuilder();
+    MorfologikDictionaryBuilder builder = new MorfologikDictionaryBuilder();
     try {
       builder.build(dictInFile.toPath(), params.getOverwrite(),
           params.getValidate(), params.getAcceptBOM(), params.getAcceptCR(),
           params.getIgnoreEmpty());
     } catch (Exception e) {
       throw new TerminateToolException(-1,
-          "Error while creating Morfologik POS Dictionay: " + e.getMessage(), e);
+          "Error while creating Morfologik POS Dictionary: " + e.getMessage(), e);
     }
 
   }
diff --git a/morfologik-addon/src/main/java/opennlp/morfologik/cmdline/builder/XMLDictionaryToTableParams.java b/morfologik-addon/src/main/java/opennlp/morfologik/cmdline/builder/XMLDictionaryToTableParams.java
index 4ee8cd4..eb001dc 100644
--- a/morfologik-addon/src/main/java/opennlp/morfologik/cmdline/builder/XMLDictionaryToTableParams.java
+++ b/morfologik-addon/src/main/java/opennlp/morfologik/cmdline/builder/XMLDictionaryToTableParams.java
@@ -34,7 +34,7 @@ interface XMLDictionaryToTableParams extends EncodingParameter {
   @ParameterDescription(valueName = "out", description = "Output for Morfologik (.info will be also created).")
   File getOutputFile();
 
-  @ParameterDescription(valueName = "char", description = "Columm separator (must be a single character)")
+  @ParameterDescription(valueName = "char", description = "Column separator (must be a single character)")
   @OptionalParameter(defaultValue=",")
   String getSeparator();
   
diff --git a/morfologik-addon/src/main/java/opennlp/morfologik/cmdline/builder/XMLDictionaryToTableTool.java b/morfologik-addon/src/main/java/opennlp/morfologik/cmdline/builder/XMLDictionaryToTableTool.java
index edc41c7..c53a4b8 100644
--- a/morfologik-addon/src/main/java/opennlp/morfologik/cmdline/builder/XMLDictionaryToTableTool.java
+++ b/morfologik-addon/src/main/java/opennlp/morfologik/cmdline/builder/XMLDictionaryToTableTool.java
@@ -64,7 +64,7 @@ public class XMLDictionaryToTableTool extends BasicCmdLineTool {
       tagDictionary = POSDictionary.create(new FileInputStream(dictInFile));
     } catch (IOException e) {
       throw new TerminateToolException(-1,
-          "Error while loading XML POS Dictionay: " + e.getMessage(), e);
+          "Error while loading XML POS Dictionary: " + e.getMessage(), e);
     }
     Iterator<String> iterator = tagDictionary.iterator();
 
diff --git a/morfologik-addon/src/main/java/opennlp/morfologik/lemmatizer/MorfologikLemmatizer.java b/morfologik-addon/src/main/java/opennlp/morfologik/lemmatizer/MorfologikLemmatizer.java
index 650f7a6..421a82f 100644
--- a/morfologik-addon/src/main/java/opennlp/morfologik/lemmatizer/MorfologikLemmatizer.java
+++ b/morfologik-addon/src/main/java/opennlp/morfologik/lemmatizer/MorfologikLemmatizer.java
@@ -34,7 +34,7 @@ import opennlp.tools.lemmatizer.Lemmatizer;
 
 public class MorfologikLemmatizer implements Lemmatizer {
 
-  private IStemmer dictLookup;
+  private final IStemmer dictLookup;
   public final Set<String> constantTags = new HashSet<>(Arrays.asList("NNP", "NP00000"));
 
   public MorfologikLemmatizer(Path dictionaryPath) throws IllegalArgumentException, IOException {
diff --git a/morfologik-addon/src/main/java/opennlp/morfologik/tagdict/MorfologikTagDictionary.java b/morfologik-addon/src/main/java/opennlp/morfologik/tagdict/MorfologikTagDictionary.java
index 5b6bf13..c5219c1 100644
--- a/morfologik-addon/src/main/java/opennlp/morfologik/tagdict/MorfologikTagDictionary.java
+++ b/morfologik-addon/src/main/java/opennlp/morfologik/tagdict/MorfologikTagDictionary.java
@@ -55,7 +55,7 @@ public class MorfologikTagDictionary implements TagDictionary {
    * @param dict
    *          a Morfologik FSA dictionary
    * @param caseSensitive
-   *          if true it performs case sensitive lookup
+   *          if true it performs case-sensitive lookup
    * @throws IllegalArgumentException
    *           if FSA's root node cannot be acquired (dictionary is empty).
    * @throws IOException
@@ -73,12 +73,12 @@ public class MorfologikTagDictionary implements TagDictionary {
     }
 
     List<WordData> data = dictLookup.lookup(word);
-    if (data != null && data.size() > 0) {
+    if (data != null && !data.isEmpty()) {
       List<String> tags = new ArrayList<>(data.size());
       for (WordData datum : data) {
         tags.add(datum.getTag().toString());
       }
-      if (tags.size() > 0)
+      if (!tags.isEmpty())
         return tags.toArray(new String[0]);
       return null;
     }
diff --git a/morfologik-addon/src/test/java/opennlp/morfologik/builder/POSDictionayBuilderTest.java b/morfologik-addon/src/test/java/opennlp/morfologik/builder/POSDictionaryBuilderTest.java
similarity index 85%
rename from morfologik-addon/src/test/java/opennlp/morfologik/builder/POSDictionayBuilderTest.java
rename to morfologik-addon/src/test/java/opennlp/morfologik/builder/POSDictionaryBuilderTest.java
index ae2bb46..834447c 100644
--- a/morfologik-addon/src/test/java/opennlp/morfologik/builder/POSDictionayBuilderTest.java
+++ b/morfologik-addon/src/test/java/opennlp/morfologik/builder/POSDictionaryBuilderTest.java
@@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 
-public class POSDictionayBuilderTest {
+public class POSDictionaryBuilderTest {
 
   @Test
   public void testBuildDictionary() throws Exception {
@@ -42,15 +42,15 @@ public class POSDictionayBuilderTest {
   
   public static Path createMorfologikDictionary() throws Exception {
     Path tabFilePath = File.createTempFile(
-        POSDictionayBuilderTest.class.getName(), ".txt").toPath();
+        POSDictionaryBuilderTest.class.getName(), ".txt").toPath();
     Path infoFilePath = DictionaryMetadata.getExpectedMetadataLocation(tabFilePath);
     
-    Files.copy(POSDictionayBuilderTest.class.getResourceAsStream(
+    Files.copy(POSDictionaryBuilderTest.class.getResourceAsStream(
         "/dictionaryWithLemma.txt"), tabFilePath, StandardCopyOption.REPLACE_EXISTING);
-    Files.copy(POSDictionayBuilderTest.class.getResourceAsStream(
+    Files.copy(POSDictionaryBuilderTest.class.getResourceAsStream(
         "/dictionaryWithLemma.info"), infoFilePath, StandardCopyOption.REPLACE_EXISTING);
     
-    MorfologikDictionayBuilder builder = new MorfologikDictionayBuilder();
+    MorfologikDictionaryBuilder builder = new MorfologikDictionaryBuilder();
     
     return builder.build(tabFilePath);
   }
diff --git a/morfologik-addon/src/test/java/opennlp/morfologik/lemmatizer/MorfologikLemmatizerTest.java b/morfologik-addon/src/test/java/opennlp/morfologik/lemmatizer/MorfologikLemmatizerTest.java
index f1212cc..10f61ca 100644
--- a/morfologik-addon/src/test/java/opennlp/morfologik/lemmatizer/MorfologikLemmatizerTest.java
+++ b/morfologik-addon/src/test/java/opennlp/morfologik/lemmatizer/MorfologikLemmatizerTest.java
@@ -19,7 +19,7 @@ package opennlp.morfologik.lemmatizer;
 
 import java.nio.file.Path;
 
-import opennlp.morfologik.builder.POSDictionayBuilderTest;
+import opennlp.morfologik.builder.POSDictionaryBuilderTest;
 
 import org.junit.jupiter.api.Test;
 
@@ -38,7 +38,7 @@ public class MorfologikLemmatizerTest {
   }
 
   private MorfologikLemmatizer createDictionary(boolean caseSensitive) throws Exception {
-    Path output = POSDictionayBuilderTest.createMorfologikDictionary();
+    Path output = POSDictionaryBuilderTest.createMorfologikDictionary();
     return new MorfologikLemmatizer(output);
   }
 
diff --git a/morfologik-addon/src/test/java/opennlp/morfologik/tagdict/MorfologikTagDictionaryTest.java b/morfologik-addon/src/test/java/opennlp/morfologik/tagdict/MorfologikTagDictionaryTest.java
index d6bc2fe..7e63e27 100644
--- a/morfologik-addon/src/test/java/opennlp/morfologik/tagdict/MorfologikTagDictionaryTest.java
+++ b/morfologik-addon/src/test/java/opennlp/morfologik/tagdict/MorfologikTagDictionaryTest.java
@@ -21,7 +21,7 @@ import java.util.Arrays;
 import java.util.List;
 
 import morfologik.stemming.Dictionary;
-import opennlp.morfologik.builder.POSDictionayBuilderTest;
+import opennlp.morfologik.builder.POSDictionaryBuilderTest;
 import opennlp.tools.postag.TagDictionary;
 
 import org.junit.jupiter.api.Test;
@@ -49,9 +49,9 @@ public class MorfologikTagDictionaryTest {
     assertTrue(tags.contains("NOUN"));
     assertTrue(tags.contains("V"));
 
-    // this is the behavior of case insensitive dictionary
-    // if we search it using case insensitive, Casa as a proper noun
-    // should be lower case in the dictionary
+    // this is the behavior of case-insensitive dictionary
+    // if we search it using case-insensitive, Casa as a proper noun
+    // should be lower-cased in the dictionary
     tags = Arrays.asList(dict.getTags("Casa"));
     assertEquals(2, tags.size());
     assertTrue(tags.contains("NOUN"));
@@ -68,9 +68,9 @@ public class MorfologikTagDictionaryTest {
     assertTrue(tags.contains("NOUN"));
     assertTrue(tags.contains("V"));
 
-    // this is the behavior of case insensitive dictionary
-    // if we search it using case insensitive, Casa as a proper noun
-    // should be lower case in the dictionary
+    // this is the behavior of case-insensitive dictionary
+    // if we search it using case-insensitive, Casa as a proper noun
+    // should be lower-cased in the dictionary
     tags = Arrays.asList(dict.getTags("Casa"));
     assertEquals(1, tags.size());
     assertTrue(tags.contains("PROP"));
@@ -84,7 +84,7 @@ public class MorfologikTagDictionaryTest {
 
   private MorfologikTagDictionary createDictionary(boolean caseSensitive, List<String> constant) throws Exception {
 
-    Dictionary dic = Dictionary.read(POSDictionayBuilderTest.createMorfologikDictionary());
+    Dictionary dic = Dictionary.read(POSDictionaryBuilderTest.createMorfologikDictionary());
     return new MorfologikTagDictionary(dic, caseSensitive);
   }
 
diff --git a/morfologik-addon/src/test/java/opennlp/morfologik/tagdict/POSTaggerFactoryTest.java b/morfologik-addon/src/test/java/opennlp/morfologik/tagdict/POSTaggerFactoryTest.java
index 602ffc6..871977d 100644
--- a/morfologik-addon/src/test/java/opennlp/morfologik/tagdict/POSTaggerFactoryTest.java
+++ b/morfologik-addon/src/test/java/opennlp/morfologik/tagdict/POSTaggerFactoryTest.java
@@ -24,7 +24,7 @@ import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Path;
 
-import opennlp.morfologik.builder.POSDictionayBuilderTest;
+import opennlp.morfologik.builder.POSDictionaryBuilderTest;
 import opennlp.tools.postag.POSModel;
 import opennlp.tools.postag.POSSample;
 import opennlp.tools.postag.POSTaggerFactory;
@@ -39,6 +39,7 @@ import opennlp.tools.util.model.ModelType;
 
 import org.junit.jupiter.api.Test;
 
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
@@ -50,7 +51,7 @@ public class POSTaggerFactoryTest {
   @Test
   public void testPOSTaggerWithCustomFactory() throws Exception {
 
-    Path dictionary = POSDictionayBuilderTest.createMorfologikDictionary();
+    Path dictionary = POSDictionaryBuilderTest.createMorfologikDictionary();
     POSTaggerFactory inFactory = new MorfologikPOSTaggerFactory();
     TagDictionary inDict = inFactory.createTagDictionary(dictionary.toFile());
     inFactory.setTagDictionary(inDict);
@@ -58,7 +59,7 @@ public class POSTaggerFactoryTest {
     POSModel posModel = trainPOSModel(ModelType.MAXENT, inFactory);
 
     POSTaggerFactory factory = posModel.getFactory();
-    assertTrue(factory.getTagDictionary() instanceof MorfologikTagDictionary);
+    assertInstanceOf(MorfologikTagDictionary.class, factory.getTagDictionary());
 
     try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
 
@@ -66,7 +67,7 @@ public class POSTaggerFactoryTest {
       POSModel fromSerialized = new POSModel(new ByteArrayInputStream(out.toByteArray()));
 
       factory = fromSerialized.getFactory();
-      assertTrue(factory.getTagDictionary() instanceof MorfologikTagDictionary);
+      assertInstanceOf(MorfologikTagDictionary.class, factory.getTagDictionary());
 
       assertEquals(2, factory.getTagDictionary().getTags("casa").length);
     }


(opennlp-addons) 01/04: OPENNLP-1700: Modernize code of geolinker addon - fixes use of raw types - fixes use of readers/writers without try-with-resources - adds constants where applicable - fixes indentations where necessary - adds JavaDoc where useful - removes superfluous JavaDoc

Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 1099e5b40318e6d4305460deafc7681edadcd95e
Author: Martin Wiesner <ma...@hs-heilbronn.de>
AuthorDate: Thu Jan 23 10:28:29 2025 +0100

    OPENNLP-1700: Modernize code of geolinker addon
    - fixes use of raw types
    - fixes use of readers/writers without try-with-resources
    - adds constants where applicable
    - fixes indentations where necessary
    - adds JavaDoc where useful
    - removes superfluous JavaDoc
---
 .../addons/geoentitylinker/AdminBoundary.java      | 105 +--------
 .../geoentitylinker/AdminBoundaryContext.java      |  27 +--
 .../AdminBoundaryContextGenerator.java             |  95 ++++----
 .../geoentitylinker/CountryContextEntry.java       | 101 +--------
 .../addons/geoentitylinker/GazetteerEntry.java     |  77 +++----
 .../geoentitylinker/GazetteerSearchCache.java      |  26 +--
 .../addons/geoentitylinker/GazetteerSearcher.java  |  20 +-
 .../addons/geoentitylinker/GeoEntityLinker.java    |  71 +++---
 .../geoentitylinker/indexing/GazetteerIndexer.java |  85 ++++---
 .../indexing/GeonamesFileDownloader.java           |  14 --
 .../indexing/GeonamesProcessor.java                | 251 ++++++++++-----------
 .../geoentitylinker/indexing/RegionProcessor.java  |  97 ++++----
 .../geoentitylinker/indexing/USGSProcessor.java    |  49 ++--
 .../scoring/CountryProximityScorer.java            |  13 +-
 .../scoring/FuzzyStringMatchScorer.java            |  23 +-
 .../scoring/GeoHashBinningScorer.java              |  19 +-
 .../scoring/LinkedEntityScorer.java                |  29 ++-
 .../geoentitylinker/scoring/ModelBasedScorer.java  |  21 +-
 .../geoentitylinker/scoring/PlacetypeScorer.java   |  13 +-
 .../geoentitylinker/scoring/PointClustering.java   |  13 +-
 .../scoring/ProvinceProximityScorer.java           |  27 ++-
 21 files changed, 474 insertions(+), 702 deletions(-)

diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/AdminBoundary.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/AdminBoundary.java
index 15859c1..1eb02ee 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/AdminBoundary.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/AdminBoundary.java
@@ -15,124 +15,39 @@
  */
 package opennlp.addons.geoentitylinker;
 
-import java.util.Objects;
-
 /**
  * Stores an admin boundary down to the US county level. Only US places from the
  * USGS Gazetteer will have county level info
  */
-public class AdminBoundary {
+public record AdminBoundary(String countryCode, String countryName, String provinceCode, String provinceName,
+                            String countyCode, String countyName, String countryRegex, String provinceRegex,
+                            String countyRegex) {
 
   private static final String NO_DATA_FOUND_VALUE = "NO_DATA_FOUND";
-  private final String countryCode;
-  private final String provinceCode;
-  private final String provinceName;
-  private final String countryName;
-  private final String countyName;
-  private final String countyCode;
-  private final String countryRegex;
-  private final String provinceRegex;
-  private final String countyRegex;
-
 
   public AdminBoundary(String countryCode, String countryName, String provinceCode, String provinceName, String countyCode, String countyName,
-      String countryRegex, String provinceRegex, String countyRegex) {
+                       String countryRegex, String provinceRegex, String countyRegex) {
     this.countryCode = countryCode;
     this.provinceCode = provinceCode;
     this.provinceName = provinceName;
     this.countryName = countryName;
-    this.countyName = countyName.equals("") ? NO_DATA_FOUND_VALUE : countyName;
-    this.countyCode = countyCode.equals("") ? NO_DATA_FOUND_VALUE : countyCode;
+    this.countyName = countyName.isEmpty() ? NO_DATA_FOUND_VALUE : countyName;
+    this.countyCode = countyCode.isEmpty() ? NO_DATA_FOUND_VALUE : countyCode;
     this.countryRegex = countryRegex;
     this.provinceRegex = provinceRegex;
     this.countyRegex = countyRegex;
   }
 
-  public String getCountryCode() {
-    return countryCode;
-  }
-
   public String getProvCode() {
     return provinceCode;
   }
 
-  public String getProvinceName() {
-    return provinceName;
-  }
-
-  public String getCountryName() {
-    return countryName;
-  }
-
-  public String getCountyName() {
-    return countyName;
-  }
-
-  public String getCountyCode() {
-    return countyCode;
-  }
-
   @Override
   public String toString() {
-    return "AdminBoundary{" + "countryCode=" + countryCode + ", provinceCode=" + provinceCode + ", provinceName=" + provinceName + ", countryName=" + countryName + ", countyName=" + countyName + ", countyCode=" + countyCode + '}';
-  }
-
-  @Override
-  public int hashCode() {
-    int hash = 7;
-    hash = 11 * hash + Objects.hashCode(this.countryCode);
-    hash = 11 * hash + Objects.hashCode(this.provinceCode);
-    hash = 11 * hash + Objects.hashCode(this.provinceName);
-    hash = 11 * hash + Objects.hashCode(this.countryName);
-    hash = 11 * hash + Objects.hashCode(this.countyName);
-    hash = 11 * hash + Objects.hashCode(this.countyCode);
-    return hash;
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    if (obj == null) {
-      return false;
-    }
-    if (getClass() != obj.getClass()) {
-      return false;
-    }
-    final AdminBoundary other = (AdminBoundary) obj;
-    if (!Objects.equals(this.countryCode, other.countryCode)) {
-      return false;
-    }
-    if (!Objects.equals(this.provinceCode, other.provinceCode)) {
-      return false;
-    }
-    if (!Objects.equals(this.provinceName, other.provinceName)) {
-      return false;
-    }
-    if (!Objects.equals(this.countryName, other.countryName)) {
-      return false;
-    }
-    if (!Objects.equals(this.countyName, other.countyName)) {
-      return false;
-    }
-    if (!Objects.equals(this.countyCode, other.countyCode)) {
-      return false;
-    }
-    return true;
-  }
-
-  public String getProvinceCode() {
-    return provinceCode;
-  }
-
-  public String getCountryRegex() {
-    return countryRegex;
-  }
-
-  public String getProvinceRegex() {
-    return provinceRegex;
-  }
-
-  public String getCountyRegex() {
-    return countyRegex;
+    return "AdminBoundary{" + "countryCode=" + countryCode + "," +
+            "provinceCode=" + provinceCode + ", provinceName=" + provinceName + ", " +
+            "countryName=" + countryName + ", countyName=" + countyName + ", " +
+            "countyCode=" + countyCode + '}';
   }
 
 }
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/AdminBoundaryContext.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/AdminBoundaryContext.java
index 85553c3..a78478e 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/AdminBoundaryContext.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/AdminBoundaryContext.java
@@ -22,6 +22,7 @@ import java.util.Set;
 
 public class AdminBoundaryContext {
 
+  private static final String REGEX = ".*rg[0-9].*";
   private final Map<String, Set<Integer>> countryMentions;
   private final Map<String, Set<Integer>> provMentions;
   private final Map<String, Set<Integer>> countyMentions;
@@ -103,6 +104,18 @@ public class AdminBoundaryContext {
     return countyRefMap;
   }
 
+  public Map<String, String> getCountryRegexMap() {
+    return countryRegexMap;
+  }
+
+  public Map<String, String> getCountyRegexMap() {
+    return countyRegexMap;
+  }
+
+  public Map<String, String> getProvinceRegexMap() {
+    return provinceRegexMap;
+  }
+
   public Set<String> getWhereClauses() {
     return whereClauses;
   }
@@ -111,7 +124,7 @@ public class AdminBoundaryContext {
     Set<String> clauses = new HashSet<>();
     for (String countryCode : this.getCountryHits()) {
       String gazType = countryCode.equalsIgnoreCase("us") ? " AND gazsource:usgs" : " AND gazsource:geonames";
-      if (countryCode.toLowerCase().matches(".*rg[0-9].*")) {
+      if (countryCode.toLowerCase().matches(REGEX)) {
         gazType = " AND gazsource:region";
       }
       Map<String, String> provsForCountry = this.getProvRefMap().get(countryCode);
@@ -138,16 +151,4 @@ public class AdminBoundaryContext {
     return clauses;
   }
 
-  public Map<String, String> getCountryRegexMap() {
-    return countryRegexMap;
-  }
-
-  public Map<String, String> getCountyRegexMap() {
-    return countyRegexMap;
-  }
-
-  public Map<String, String> getProvinceRegexMap() {
-    return provinceRegexMap;
-  }
-
 }
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/AdminBoundaryContextGenerator.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/AdminBoundaryContextGenerator.java
index 166cfca..71e00a5 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/AdminBoundaryContextGenerator.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/AdminBoundaryContextGenerator.java
@@ -27,17 +27,17 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.logging.Level;
-
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-import opennlp.tools.entitylinker.EntityLinkerProperties;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import opennlp.tools.entitylinker.EntityLinkerProperties;
+
 /**
  * Finds instances of country mentions in a String, typically a document text.
  * Used to boost or degrade scoring of linked geo entities
- *
  */
 public class AdminBoundaryContextGenerator {
 
@@ -46,23 +46,13 @@ public class AdminBoundaryContextGenerator {
   private Map<String, Set<String>> nameCodesMap = new HashMap<>();
   private final Map<String, Set<Integer>> countryMentions = new HashMap<>();
 
-  Map<String, String> countryRegexMap = new HashMap<>();
-  Map<String, String> provinceRegexMap = new HashMap<>();
-  Map<String, String> countyRegexMap = new HashMap<>();
+  private final Map<String, String> countryRegexMap = new HashMap<>();
+  private final Map<String, String> provinceRegexMap = new HashMap<>();
+  private Map<String, String> countyRegexMap = new HashMap<>();
 
   private final Set<CountryContextEntry> countryHits = new HashSet<>();
-  private final EntityLinkerProperties properties;
   private final List<AdminBoundary> adminBoundaryData= new ArrayList<>();
   private final Set<AdminBoundary> adminBoundaryHits = new HashSet<>();
-  private AdminBoundaryContext context;
-
-  public AdminBoundaryContext getContext(String text) {
-    context = null;
-    nameCodesMap.clear();
-    context = process(text);
-
-    return context;
-  }
 
   private final Set<String> countryHitSet = new HashSet<>();
   private final Map<String, String> countryMap = new HashMap<>();
@@ -77,22 +67,31 @@ public class AdminBoundaryContextGenerator {
 
   public static void main(String[] args) {
     try {
-      AdminBoundaryContextGenerator countryContext
-          = new AdminBoundaryContextGenerator(new EntityLinkerProperties(new File("C:\\Temp\\gaz_data\\newCountryContextfile.txt")));
+      AdminBoundaryContextGenerator countryContext = new AdminBoundaryContextGenerator(
+              new EntityLinkerProperties(new File("C:\\Temp\\gaz_data\\newCountryContextfile.txt")));
 
-      AdminBoundaryContext c = countryContext.process("This artcle is about fairfax county virginia in the north of florida in the united states. It is also about Moscow and atlanta. Hillsborough county florida is a nice place. Eastern Africa people are cool.");
+      AdminBoundaryContext c = countryContext.process(
+              "This article is about fairfax county virginia in the north of florida in the united states. " +
+                      "It is also about Moscow and atlanta. Hillsborough county florida is a nice place. " +
+                      "Eastern Africa people are cool.");
       System.out.println(c);
     } catch (Exception ex) {
       java.util.logging.Logger.getLogger(AdminBoundaryContextGenerator.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
 
+  public AdminBoundaryContext getContext(String text) {
+    nameCodesMap.clear();
+    return process(text);
+  }
+
   public AdminBoundaryContextGenerator(EntityLinkerProperties properties) throws IOException {
-    this.properties = properties;
     if (countrydata == null) {
-      String path = this.properties.getProperty("opennlp.geoentitylinker.countrycontext.filepath", "");
+      String path = properties.getProperty("opennlp.geoentitylinker.countrycontext.filepath", "");
       if (path == null || path.trim().isEmpty()) {
-        throw new IOException("missing country context data configuration. Property opennlp.geoentitylinker.countrycontext.filepath must have a valid path value in entitylinker properties file");
+        throw new IOException("missing country context data configuration. " +
+                "Property opennlp.geoentitylinker.countrycontext.filepath " +
+                "must have a valid path value in entitylinker properties file");
       }
       File countryContextFile = new File(path);
       if (countryContextFile == null || !countryContextFile.exists()) {
@@ -264,7 +263,7 @@ public class AdminBoundaryContextGenerator {
             newset.add(start);
             mentions.put(code, newset);
           }
-          if (!hit.equals("")) {
+          if (!hit.isEmpty()) {
             if (this.nameCodesMap.containsKey(hit)) {
               nameCodesMap.get(hit).add(code);
             } else {
@@ -333,40 +332,39 @@ public class AdminBoundaryContextGenerator {
 
   private void loadMaps(List<AdminBoundary> boundaries) {
     for (AdminBoundary adm : boundaries) {
-      if (!adm.getCountryCode().equals("null")) {
-        countryMap.put(adm.getCountryCode(), adm.getCountryName());
-        if (countryRegexMap.containsKey(adm.getCountryCode())) {
-          String currentRegex = countryRegexMap.get(adm.getCountryCode());
-          if (currentRegex.length() > adm.getCountryRegex().length()) {
+      if (!adm.countryCode().equals("null")) {
+        countryMap.put(adm.countryCode(), adm.countryName());
+        if (countryRegexMap.containsKey(adm.countryCode())) {
+          String currentRegex = countryRegexMap.get(adm.countryCode());
+          if (currentRegex.length() > adm.countryRegex().length()) {
             // the longest one wins if they are not all the same for each entry in the file
-            countryRegexMap.put(adm.getCountryCode(), currentRegex);
+            countryRegexMap.put(adm.countryCode(), currentRegex);
           }//else do nothing
         } else {
-          countryRegexMap.put(adm.getCountryCode(), adm.getCountryRegex());
+          countryRegexMap.put(adm.countryCode(), adm.countryRegex());
         }
 
         if (!adm.getProvCode().equals("null")) {
-          Map<String, String> provs = provMap.get(adm.getCountryCode());
+          Map<String, String> provs = provMap.get(adm.countryCode());
           if (provs == null) {
             provs = new HashMap<>();
           }
           //if (!provs.containsKey(adm.getProvCode())) {
-          provs.put(adm.getCountryCode() + "." + adm.getProvCode(), adm.getProvinceName());
-          provMap.put(adm.getCountryCode(), provs);
+          provs.put(adm.countryCode() + "." + adm.getProvCode(), adm.provinceName());
+          provMap.put(adm.countryCode(), provs);
           // }
 
-          if (!adm.getCountyCode().equalsIgnoreCase("no_data_found") && !adm.getCountyName().equalsIgnoreCase("no_data_found")) {
-            Map<String, String> counties = countyMap.get(adm.getCountryCode() + "." + adm.getProvCode());
+          if (!adm.countyCode().equalsIgnoreCase("no_data_found") && !adm.countyName().equalsIgnoreCase("no_data_found")) {
+            Map<String, String> counties = countyMap.get(adm.countryCode() + "." + adm.getProvCode());
             if (counties == null) {
               counties = new HashMap<>();
-            }            // if (!counties.containsKey(adm.getCountyCode())) {
-            String countyid = adm.getCountryCode() + "." + adm.getProvCode() + "." + adm.getCountyCode();
-            counties.put(countyid, adm.getCountyName());
-            countyMap.put(adm.getCountryCode() + "." + adm.getProvCode(), counties);
+            }
+            // if (!counties.containsKey(adm.getCountyCode())) {
+            String countyid = adm.countryCode() + "." + adm.getProvCode() + "." + adm.countyCode();
+            counties.put(countyid, adm.countyName());
+            countyMap.put(adm.countryCode() + "." + adm.getProvCode(), counties);
             // }
-
           }
-
         }
       }
     }
@@ -375,18 +373,17 @@ public class AdminBoundaryContextGenerator {
   }
 
   private void fillProvRegexMap() {
-    this.provinceRegexMap = new HashMap<>();
     // this.adminBoundaryData
     for (AdminBoundary adm : adminBoundaryData) {
 
       if (provinceRegexMap.containsKey(adm.getProvCode())) {
         String currentRegex = provinceRegexMap.get(adm.getProvCode());
-        if (currentRegex.length() > adm.getProvinceRegex().length()) {
+        if (currentRegex.length() > adm.provinceRegex().length()) {
           // the longest one wins if they are not all the same for each entry in the file
           provinceRegexMap.put(adm.getProvCode(), currentRegex);
         }//else do nothing
       } else {
-        provinceRegexMap.put(adm.getProvCode(), adm.getProvinceRegex());
+        provinceRegexMap.put(adm.getProvCode(), adm.provinceRegex());
       }
     }
   }
@@ -396,14 +393,14 @@ public class AdminBoundaryContextGenerator {
     // this.adminBoundaryData
     for (AdminBoundary adm : adminBoundaryData) {
 
-      if (countyRegexMap.containsKey(adm.getCountyCode())) {
-        String currentRegex = countyRegexMap.get(adm.getCountyCode());
-        if (currentRegex.length() > adm.getCountyRegex().length()) {
+      if (countyRegexMap.containsKey(adm.countyCode())) {
+        String currentRegex = countyRegexMap.get(adm.countyCode());
+        if (currentRegex.length() > adm.countyRegex().length()) {
           // the longest one wins if they are not all the same for each entry in the file
-          countyRegexMap.put(adm.getCountyCode(), currentRegex);
+          countyRegexMap.put(adm.countyCode(), currentRegex);
         }//else do nothing
       } else {
-        countyRegexMap.put(adm.getCountyCode(), adm.getCountyRegex());
+        countyRegexMap.put(adm.countyCode(), adm.countyRegex());
       }
     }
 
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/CountryContextEntry.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/CountryContextEntry.java
index 04039e9..d04073d 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/CountryContextEntry.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/CountryContextEntry.java
@@ -15,104 +15,11 @@
  */
 package opennlp.addons.geoentitylinker;
 
-import java.util.Objects;
-
 /**
- *Stores a tuple from the opennlp.geoentitylinker.countrycontext.txt file, which is used to find country mentions in document text.
- *
+ * Stores a tuple from the {@code opennlp.geoentitylinker.countrycontext.txt} file.
+ * It is used to find country mentions in document text.
  */
-public class CountryContextEntry {
-  /*
-   * rc,cc1, full_name_nd_ro,dsg
-   */
-
-  private String rc;
-  private String cc1;
-  private String full_name_nd_ro;
-  private String dsg;
-  private String provCode;
-  public CountryContextEntry() {
-  }
-
-  public CountryContextEntry(String rc, String cc1, String full_name_nd_ro, String dsg) {
-    this.rc = rc;
-    this.cc1 = cc1;
-    this.full_name_nd_ro = full_name_nd_ro;
-    this.dsg = dsg;
-  }
-
-  public String getProvCode() {
-    return provCode;
-  }
-
-  public void setProvCode(String provCode) {
-    this.provCode = provCode;
-  }
-
-  public String getRc() {
-    return rc;
-  }
-
-  public void setRc(String rc) {
-    this.rc = rc;
-  }
-
-  public String getCc1() {
-    return cc1;
-  }
-
-  public void setCc1(String cc1) {
-    this.cc1 = cc1;
-  }
-
-  public String getFull_name_nd_ro() {
-    return full_name_nd_ro;
-  }
-
-  public void setFull_name_nd_ro(String full_name_nd_ro) {
-    this.full_name_nd_ro = full_name_nd_ro;
-  }
-
-  public String getDsg() {
-    return dsg;
-  }
-
-  public void setDsg(String dsg) {
-    this.dsg = dsg;
-  }
-
-  @Override
-  public int hashCode() {
-    int hash = 7;
-    hash = 17 * hash + Objects.hashCode(this.rc);
-    hash = 17 * hash + Objects.hashCode(this.cc1);
-    hash = 17 * hash + Objects.hashCode(this.full_name_nd_ro);
-    hash = 17 * hash + Objects.hashCode(this.dsg);
-    return hash;
-  }
+public record CountryContextEntry(String rc, String cc1, String full_name_nd_ro,
+                                  String dsg, String provCode) {
 
-  @Override
-  public boolean equals(Object obj) {
-    if (obj == null) {
-      return false;
-    }
-    if (getClass() != obj.getClass()) {
-      return false;
-    }
-    final CountryContextEntry other = (CountryContextEntry) obj;
-    if (!Objects.equals(this.rc, other.rc)) {
-      return false;
-    }
-    if (!Objects.equals(this.cc1, other.cc1)) {
-      return false;
-    }
-    if (!Objects.equals(this.full_name_nd_ro, other.full_name_nd_ro)) {
-      return false;
-    }
-    if (!Objects.equals(this.dsg, other.dsg)) {
-      return false;
-    }
-    return true;
-  }
-  
 }
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/GazetteerEntry.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/GazetteerEntry.java
index b7ef387..86fc0ea 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/GazetteerEntry.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/GazetteerEntry.java
@@ -18,10 +18,11 @@ package opennlp.addons.geoentitylinker;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Objects;
+
 import opennlp.tools.entitylinker.BaseLink;
 
 /**
- * Stores a minimal amount of information from a geographic placenames gazetteer.
+ * Stores a minimal amount of information from a geographic place names gazetteer.
  */
 public class GazetteerEntry extends BaseLink {
 
@@ -29,10 +30,11 @@ public class GazetteerEntry extends BaseLink {
   private Double longitude;
   private String source;
   private String indexID;
-  private Map<String, String> indexData = new HashMap<>();
   private String countryCode;
   private String provinceCode;
   private String hierarchy;
+  
+  private Map<String, String> indexData = new HashMap<>();
 
   public GazetteerEntry(String parentID, String itemID, String itemName, String itemType) {
     super(parentID, itemID, itemName, itemType);
@@ -44,9 +46,7 @@ public class GazetteerEntry extends BaseLink {
   public String getIndexID() {
     return indexID;
   }
-  /**
-   * sets the id from the lucene document
-   */
+
   public void setIndexID(String indexID) {
     this.indexID = indexID;
   }
@@ -58,9 +58,6 @@ public class GazetteerEntry extends BaseLink {
     return latitude;
   }
 
-  /**
-   * sets the latitude from the gazetteer
-   */
   public void setLatitude(Double latitude) {
     this.latitude = latitude;
   }
@@ -72,11 +69,6 @@ public class GazetteerEntry extends BaseLink {
     return longitude;
   }
 
-  /**
-   * sets the longitude from the gaz
-   *
-   * @param longitude
-   */
   public void setLongitude(Double longitude) {
     this.longitude = longitude;
   }
@@ -88,11 +80,6 @@ public class GazetteerEntry extends BaseLink {
     return source;
   }
 
-  /**
-   * sets the source (the source of the gazetteer data)
-   *
-   * @param source
-   */
   public void setSource(String source) {
     this.source = source;
   }
@@ -113,10 +100,36 @@ public class GazetteerEntry extends BaseLink {
     this.indexData = indexData;
   }
 
+  public String getCountryCode() {
+    return countryCode;
+  }
+
+  public void setCountryCode(String countryCode) {
+    this.countryCode = countryCode;
+  }
+
+  public String getProvinceCode() {
+    return provinceCode;
+  }
+
+  public void setProvinceCode(String provinceCode) {
+    this.provinceCode = provinceCode;
+  }
+
+  public String getHierarchy() {
+    return hierarchy;
+  }
+
+  public void setHierarchy(String hierarchy) {
+    this.hierarchy = hierarchy;
+  }
+
   @Override
   public String toString() {
 
-    return super.toString() + "\n\t\tGazateerEntry\n" + "\t\tlatitude=" + latitude + ", \n\t\tlongitude=" + longitude + ", \n\t\tsource=" + source + ", \n\t\tindexID=" + indexID + ",\n\t\tindexData=" + indexData + "\n";
+    return super.toString() + "\n\t\tGazateerEntry\n" + "\t\tlatitude=" +
+            latitude + ", \n\t\tlongitude=" + longitude + ", \n\t\tsource=" +
+            source + ", \n\t\tindexID=" + indexID + ",\n\t\tindexData=" + indexData + "\n";
   }
 
   @Override
@@ -144,30 +157,4 @@ public class GazetteerEntry extends BaseLink {
     }
     return true;
   }
-
- 
-  public String getCountryCode() {
-    return countryCode;
-  }
-
-  public void setCountryCode(String countryCode) {
-    this.countryCode = countryCode;
-  }
-
-  public String getProvinceCode() {
-    return provinceCode;
-  }
-
-  public void setProvinceCode(String provinceCode) {
-    this.provinceCode = provinceCode;
-  }
-
-  public String getHierarchy() {
-    return hierarchy;
-  }
-
-  public void setHierarchy(String hierarchy) {
-    this.hierarchy = hierarchy;
-  }
-
 }
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/GazetteerSearchCache.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/GazetteerSearchCache.java
index 7d13c81..9cdca41 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/GazetteerSearchCache.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/GazetteerSearchCache.java
@@ -20,30 +20,28 @@ import java.util.HashMap;
 import java.util.Map;
 
 /**
- *
- * Caches gazateer query results statically. Clears itself if more than 10000 results are cached.
+ * Caches {@link GazetteerEntry gazetteer} query results statically.
+ * Clears itself if more than 10000 results are cached.
  */
 public class GazetteerSearchCache {
 
-  private static Map<String, ArrayList<GazetteerEntry>> gazCache = new HashMap<>();
+  private static final Map<String, ArrayList<GazetteerEntry>> CACHE = new HashMap<>();
 
-/**
- * returns the cached entries. Returns null if the query does not exist in the cache
- * @param searchString
- * @return
- */
+  /**
+   * @param searchString The search string to check for matching entries.
+   * @return Retrieves cached entries. Returns {@code null} if the query does not exist in the cache.
+   */
   public static synchronized ArrayList<GazetteerEntry> get(String searchString) {
-    return gazCache.get(searchString);
+    return CACHE.get(searchString);
   }
 
   public static synchronized void put(String searchString, ArrayList<GazetteerEntry> hits) {
-    if (gazCache.size() > 10000) {
-      gazCache.clear();
+    if (CACHE.size() > 10000) {
+      CACHE.clear();
     }
-    if (!gazCache.containsKey(searchString)) {
-      gazCache.put(searchString, hits);
+    if (!CACHE.containsKey(searchString)) {
+      CACHE.put(searchString, hits);
     }
   }
 
-
 }
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/GazetteerSearcher.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/GazetteerSearcher.java
index 4f5ad5d..804432a 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/GazetteerSearcher.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/GazetteerSearcher.java
@@ -52,8 +52,8 @@ import org.slf4j.LoggerFactory;
  */
 public class GazetteerSearcher {
 
-  private final String REGEX_CLEAN = "[^\\p{L}\\p{Nd}]";
   private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+  private static final String REGEX_CLEAN = "[^\\p{L}\\p{Nd}]";
   private double scoreCutoff = .70;
   private final boolean doubleQuoteAllSearchTerms = false;
   private boolean useHierarchyField = false;
@@ -61,14 +61,13 @@ public class GazetteerSearcher {
   private final EntityLinkerProperties properties;
 
   private Directory opennlpIndex;//= new MMapDirectory(new File(indexloc));
-  private IndexReader opennlpReader;// = DirectoryReader.open(geonamesIndex);
   private IndexSearcher opennlpSearcher;// = new IndexSearcher(geonamesReader);
   private Analyzer opennlpAnalyzer;
 
   public static void main(String[] args) {
     try {
-      boolean b = true;
-      new GazetteerSearcher(new EntityLinkerProperties(new File("c:\\temp\\entitylinker.properties"))).find("alabama", 5, " countrycode:us AND gazsource:usgs");
+      new GazetteerSearcher(new EntityLinkerProperties(new File("c:\\temp\\entitylinker.properties")))
+              .find("alabama", 5, " countrycode:us AND gazsource:usgs");
     } catch (IOException ex) {
       LOG.error(ex.getLocalizedMessage(), ex);
     }
@@ -84,11 +83,11 @@ public class GazetteerSearcher {
    *
    * @param searchString the location name to search for
    * @param rowsReturned how many index entries to return (top N...)
-   * @param whereClause the conditional statement that defines the index type
-   * and the country oode.
+   * @param whereClause the conditional statement that defines the i
+   *                    ndex type and the country code.
    * @return
    */
-  public ArrayList<GazetteerEntry> find(String searchString, int rowsReturned, String whereClause) {
+  public List<GazetteerEntry> find(String searchString, int rowsReturned, String whereClause) {
     ArrayList<GazetteerEntry> linkedData = new ArrayList<>();
     searchString = cleanInput(searchString);
     if (searchString.isEmpty()) {
@@ -199,12 +198,13 @@ public class GazetteerSearcher {
 
     if (opennlpIndex == null) {
       String indexloc = properties.getProperty("opennlp.geoentitylinker.gaz", "");
-      if (indexloc.equals("")) {
+      if (indexloc.isEmpty()) {
         LOG.error("Opennlp combined Gaz directory location not found!");
       }
 
       opennlpIndex = new MMapDirectory(Paths.get(indexloc));
-      opennlpReader = DirectoryReader.open(opennlpIndex);
+      // = DirectoryReader.open(geonamesIndex);
+      IndexReader opennlpReader = DirectoryReader.open(opennlpIndex);
       opennlpSearcher = new IndexSearcher(opennlpReader);
       opennlpAnalyzer
           = //new StandardAnalyzer(Version.LUCENE_48, new CharArraySet(Version.LUCENE_48, new ArrayList(), true));
@@ -221,7 +221,7 @@ public class GazetteerSearcher {
           = new PerFieldAnalyzerWrapper(opennlpAnalyzer, analyMap);
 
       String cutoff = properties.getProperty("opennlp.geoentitylinker.gaz.lucenescore.min", String.valueOf(scoreCutoff));
-      String usehierarchy = properties.getProperty("opennlp.geoentitylinker.gaz.hierarchyfield", String.valueOf("0"));
+      String usehierarchy = properties.getProperty("opennlp.geoentitylinker.gaz.hierarchyfield", "0");
       if (cutoff != null && !cutoff.isEmpty()) {
         scoreCutoff = Double.parseDouble(cutoff);
       }
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/GeoEntityLinker.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/GeoEntityLinker.java
index 7fa49be..769bbbc 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/GeoEntityLinker.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/GeoEntityLinker.java
@@ -16,17 +16,17 @@
 package opennlp.addons.geoentitylinker;
 
 import java.io.IOException;
-import opennlp.addons.geoentitylinker.scoring.ModelBasedScorer;
-import opennlp.addons.geoentitylinker.scoring.LinkedEntityScorer;
-import opennlp.addons.geoentitylinker.scoring.CountryProximityScorer;
-import opennlp.addons.geoentitylinker.scoring.GeoHashBinningScorer;
-import opennlp.addons.geoentitylinker.scoring.FuzzyStringMatchScorer;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import opennlp.addons.geoentitylinker.scoring.CountryProximityScorer;
+import opennlp.addons.geoentitylinker.scoring.FuzzyStringMatchScorer;
+import opennlp.addons.geoentitylinker.scoring.GeoHashBinningScorer;
+import opennlp.addons.geoentitylinker.scoring.LinkedEntityScorer;
+import opennlp.addons.geoentitylinker.scoring.ModelBasedScorer;
 import opennlp.addons.geoentitylinker.scoring.PlacetypeScorer;
 import opennlp.addons.geoentitylinker.scoring.ProvinceProximityScorer;
 import opennlp.tools.entitylinker.BaseLink;
@@ -41,29 +41,24 @@ import opennlp.tools.entitylinker.EntityLinker;
  * indexes. The indexes can be built using the GeoEntityLinkerSetupUtils class
  * in this same package.
  */
-public class GeoEntityLinker implements EntityLinker<LinkedSpan> {
+public class GeoEntityLinker implements EntityLinker<LinkedSpan<BaseLink>> {
 
   private static Integer topN = 2;
   private AdminBoundaryContextGenerator countryContext;
   private EntityLinkerProperties linkerProperties;
-  private GazetteerSearcher gazateerSearcher;
-  private final List<LinkedEntityScorer<AdminBoundaryContext>> scorers = new ArrayList<>();
+  private GazetteerSearcher gazetteerSearcher;
+  private final List<LinkedEntityScorer<? extends BaseLink, AdminBoundaryContext>> scorers = new ArrayList<>();
 
   @Override
-  public List<LinkedSpan> find(String doctext, Span[] sentences, Span[][] tokensBySentence, Span[][] namesBySentence) {
-    ArrayList<LinkedSpan> spans = new ArrayList<>();
-
-    if (linkerProperties == null) {
-      throw new IllegalArgumentException("EntityLinkerProperties cannot be null");
-    }
+  public List<LinkedSpan<BaseLink>> find(String doctext, Span[] sentences,
+                                         Span[][] tokensBySentence, Span[][] namesBySentence) {
+    List<LinkedSpan<BaseLink>> spans = new ArrayList<>();
     //countryMentions = countryContext.regexfind(doctext);
     AdminBoundaryContext context = countryContext.getContext(doctext);
     for (int s = 0; s < sentences.length; s++) {
       Span[] names = namesBySentence[s];
-
       Span[] tokenSpans = tokensBySentence[s];
       String[] tokens = Span.spansToStrings(tokenSpans, sentences[s].getCoveredText(doctext));
-
       String[] matches = Span.spansToStrings(names, tokens);
 
       for (int i = 0; i < matches.length; i++) {
@@ -71,16 +66,15 @@ public class GeoEntityLinker implements EntityLinker<LinkedSpan> {
         ArrayList<BaseLink> geoNamesEntries = new ArrayList<>();
         if (!context.getWhereClauses().isEmpty()) {
           for (String whereclause : context.getWhereClauses()) {
-            ArrayList<GazetteerEntry> find = gazateerSearcher.find(matches[i], topN, whereclause);
+            List<GazetteerEntry> find = gazetteerSearcher.find(matches[i], topN, whereclause);
             for (GazetteerEntry gazetteerEntry : find) {
               if (!geoNamesEntries.contains(gazetteerEntry)) {
                 geoNamesEntries.add(gazetteerEntry);
               }
             }
-
           }
-        } else {//this means there were no where clauses generated so the where clause will default to look at the entire index
-          ArrayList<GazetteerEntry> find = gazateerSearcher.find(matches[i], topN, " gaztype:usgs geonames regions ");
+        } else { //this means there were no where clauses generated so the where clause will default to look at the entire index
+          List<GazetteerEntry> find = gazetteerSearcher.find(matches[i], topN, " gaztype:usgs geonames regions ");
           for (GazetteerEntry gazetteerEntry : find) {
             if (!geoNamesEntries.contains(gazetteerEntry)) {
               geoNamesEntries.add(gazetteerEntry);
@@ -96,7 +90,7 @@ public class GeoEntityLinker implements EntityLinker<LinkedSpan> {
          */
         if (!spans.isEmpty()) {
 
-          Double maxscore = 0d;
+          double maxscore = 0d;
           for (BaseLink gazetteerEntry : geoNamesEntries) {
             Double deNormScore = gazetteerEntry.getScoreMap().get("lucene");
             if (deNormScore.compareTo(maxscore) > 0) {
@@ -115,20 +109,22 @@ public class GeoEntityLinker implements EntityLinker<LinkedSpan> {
         newspan.setSentenceid(s);
         spans.add(newspan);
       }
-
     }
 
     if (!scorers.isEmpty()) {
-      for (LinkedEntityScorer scorer : scorers) {
-        scorer.score(spans, doctext, sentences, linkerProperties, context);
+      for (LinkedEntityScorer<? extends BaseLink, AdminBoundaryContext> scorer : scorers) {
+        @SuppressWarnings("rawtypes")
+        LinkedEntityScorer<BaseLink, AdminBoundaryContext> s = (LinkedEntityScorer) scorer;
+        s.score(spans, doctext, sentences, linkerProperties, context);
       }
     }
+    
     /*
      * sort the data with the best score on top based on the sum of the scores
-     * below from the score map for each baselink object
+     * below from the score map for each BaseLink object
      */
-    for (LinkedSpan<BaseLink> s : spans) {
-      ArrayList<BaseLink> linkedData = s.getLinkedEntries();
+    for (LinkedSpan<? extends BaseLink> s : spans) {
+      ArrayList<? extends BaseLink> linkedData = s.getLinkedEntries();
       linkedData.sort(Collections.reverseOrder((o1, o2) -> {
         Map<String, Double> o1scoreMap = o1.getScoreMap();
         Map<String, Double> o2scoreMap = o2.getScoreMap();
@@ -149,11 +145,10 @@ public class GeoEntityLinker implements EntityLinker<LinkedSpan> {
           }
         }
 
-        return Double.compare(sumo1,
-                sumo2);
+        return Double.compare(sumo1, sumo2);
       }));
       //prune the list to topN
-      Iterator<BaseLink> iterator = linkedData.iterator();
+      Iterator<? extends BaseLink> iterator = linkedData.iterator();
       int n = 0;
       while (iterator.hasNext()) {
         if (n >= topN) {
@@ -174,12 +169,11 @@ public class GeoEntityLinker implements EntityLinker<LinkedSpan> {
    * @param valueToNormalize the value to place within the new range
    * @param minimum the min of the set to be transposed
    * @param maximum the max of the set to be transposed
-   * @return
+   * @return The value of the normalized distance.
    */
   private Double normalize(Double valueToNormalize, double minimum, double maximum) {
     double d = ((1 - 0) * (valueToNormalize - minimum)) / (maximum - minimum) + 0;
-    d = Double.isNaN(d) ? 0d : d;
-    return d;
+    return Double.isNaN(d) ? 0d : d;
   }
 
   private void loadScorers() {
@@ -195,10 +189,12 @@ public class GeoEntityLinker implements EntityLinker<LinkedSpan> {
 
   @Override
   public void init(EntityLinkerProperties properties) throws IOException {
-
+    if (properties == null) {
+      throw new IllegalArgumentException("EntityLinkerProperties cannot be null");
+    }
     this.linkerProperties = properties;
     countryContext = new AdminBoundaryContextGenerator(this.linkerProperties);
-    gazateerSearcher = new GazetteerSearcher(this.linkerProperties);
+    gazetteerSearcher = new GazetteerSearcher(this.linkerProperties);
     String rowsRetStr = this.linkerProperties.getProperty("opennlp.geoentitylinker.gaz.rowsreturned", "2");
     int rws;
     try {
@@ -208,12 +204,11 @@ public class GeoEntityLinker implements EntityLinker<LinkedSpan> {
     }
     topN = rws;
     loadScorers();
-
   }
 
   @Override
-  public List<LinkedSpan> find(String doctext, Span[] sentences, Span[][] tokensBySentence,
-      Span[][] namesBySentence, int sentenceIndex) {
+  public List<LinkedSpan<BaseLink>> find(String doctext, Span[] sentences, Span[][] tokensBySentence,
+                                         Span[][] namesBySentence, int sentenceIndex) {
     throw new UnsupportedOperationException("The GeoEntityLinker requires the entire document "
         + "for proper scoring. This method is unsupported");
   }
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GazetteerIndexer.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GazetteerIndexer.java
index d41b6ff..d178a44 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GazetteerIndexer.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GazetteerIndexer.java
@@ -39,42 +39,7 @@ import org.apache.lucene.store.MMapDirectory;
  */
 public class GazetteerIndexer {
 
-  public static void main(String[] args) {
-
-    if (args.length != 8) {
-      System.out.println("Usage: GazetteerIndexer geonamesData geoNamesCountryInfo geonamesAdmin1CodesASCII "
-          + "usgsDataFile usgsGovUnitsFile outputIndexDir outputCountryContextFile regionsFile");
-      System.out.println();
-      System.out.println("The GazetteerIndexer.index methods javadoc explains how to retrieve the data files.");
-      return;
-    }
-
-    File geonamesData = new File(args[0]);
-    File geoNamesCountryInfo = new File(args[1]);
-    File geonamesAdmin1CodesASCII = new File(args[2]);
-    File usgsDataFile = new File(args[3]);
-    File usgsGovUnitsFile = new File(args[4]);
-    File outputIndexDir = new File(args[5]);
-    File outputCountryContextFile = new File(args[6]);
-    File regionsFile = new File(args[7]);
-
-    try {
-      GazetteerIndexer i = new GazetteerIndexer();
-      i.index(geonamesData,
-          geoNamesCountryInfo,
-          geonamesAdmin1CodesASCII,
-          usgsDataFile,
-          usgsGovUnitsFile,
-          outputIndexDir,
-          outputCountryContextFile,
-          regionsFile);
-    } catch (Exception ex) {
-      ex.printStackTrace();
-    }
-  }
-
   public GazetteerIndexer() {
-
   }
 
   public interface Separable {
@@ -83,7 +48,6 @@ public class GazetteerIndexer {
   }
 
   public enum GazType implements Separable {
-
     GEONAMES {
           @Override
           public String toString() {
@@ -144,11 +108,13 @@ public class GazetteerIndexer {
    * format: tab delimited text with index 0 as the name of the region, index 1
    * as the longitude, and index 2 as the latitude
    *
-   * @throws Exception
+   * @throws IOException Thrown if IO errors occurred.
+   * @throws FileNotFoundException Thrown if required resources do not exist.
+   * @throws IllegalArgumentException Thrown if parameters are invalid.
    */
   public void index(File geonamesData, File geoNamesCountryInfo, File geonamesAdmin1CodesASCII, File usgsDataFile,
                     File usgsGovUnitsFile, File outputIndexDir, File outputCountryContextFile, File regionsFile)
-          throws Exception {
+          throws IOException {
     if (!outputIndexDir.isDirectory()) {
       throw new IllegalArgumentException("outputIndexDir must be a directory.");
     }
@@ -161,7 +127,6 @@ public class GazetteerIndexer {
     if (!geonamesAdmin1CodesASCII.exists()) {
       throw new FileNotFoundException("geonamesAdmin1CodesASCII data file does not exist");
     }
-
     if (!usgsDataFile.exists()) {
       throw new FileNotFoundException("usgsDataFile data file does not exist");
     }
@@ -190,15 +155,13 @@ public class GazetteerIndexer {
     IndexWriterConfig config = new IndexWriterConfig(aWrapper);
     try (IndexWriter w = new IndexWriter(index, config)) {
       //write the column headers for the countryContextFile
-      try (FileWriter countryContextFileWriter = new FileWriter(outputCountryContextFile, false)) {
+      try (FileWriter writer = new FileWriter(outputCountryContextFile, false)) {
         String colNamesForCountryContextFile = "countrycode\tprovcode\tcountycode\tcountryname\tprovincename\tcountyname\tcountryregex\tprovregex\tcountyregex\n";
-        countryContextFileWriter.write(colNamesForCountryContextFile);
-        countryContextFileWriter.flush();
+        writer.write(colNamesForCountryContextFile);
+        writer.flush();
       }
-
       USGSProcessor.process(usgsGovUnitsFile, usgsDataFile, outputCountryContextFile, w);
       GeonamesProcessor.process(geoNamesCountryInfo, geonamesAdmin1CodesASCII, geonamesData, outputCountryContextFile, w);
-
       RegionProcessor.process(regionsFile, outputCountryContextFile, w);
       w.commit();
     }
@@ -207,4 +170,38 @@ public class GazetteerIndexer {
             outputCountryContextFile.getPath() + "' to entitylinker.properties file");
   }
 
+
+  public static void main(String[] args) {
+
+    if (args.length != 8) {
+      System.out.println("Usage: GazetteerIndexer geonamesData geoNamesCountryInfo geonamesAdmin1CodesASCII "
+              + "usgsDataFile usgsGovUnitsFile outputIndexDir outputCountryContextFile regionsFile");
+      System.out.println();
+      System.out.println("The GazetteerIndexer.index methods javadoc explains how to retrieve the data files.");
+      return;
+    }
+
+    File geonamesData = new File(args[0]);
+    File geoNamesCountryInfo = new File(args[1]);
+    File geonamesAdmin1CodesASCII = new File(args[2]);
+    File usgsDataFile = new File(args[3]);
+    File usgsGovUnitsFile = new File(args[4]);
+    File outputIndexDir = new File(args[5]);
+    File outputCountryContextFile = new File(args[6]);
+    File regionsFile = new File(args[7]);
+
+    try {
+      GazetteerIndexer i = new GazetteerIndexer();
+      i.index(geonamesData,
+              geoNamesCountryInfo,
+              geonamesAdmin1CodesASCII,
+              usgsDataFile,
+              usgsGovUnitsFile,
+              outputIndexDir,
+              outputCountryContextFile,
+              regionsFile);
+    } catch (Exception ex) {
+      ex.printStackTrace();
+    }
+  }
 }
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GeonamesFileDownloader.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GeonamesFileDownloader.java
index 58d680c..df010ed 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GeonamesFileDownloader.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GeonamesFileDownloader.java
@@ -38,7 +38,6 @@ public class GeonamesFileDownloader {
 
   public static void downloadGeonamesFiles(String outputFileName, String outputDir) {
     String fileDownload = fileDownload(ALL_COUNTRIES, outputDir);
-
     unzipMyZip(fileDownload, outputDir);
 
     fileDownload(COUNTRY_INFO, outputDir);
@@ -46,19 +45,6 @@ public class GeonamesFileDownloader {
 
   }
 
-  public static void writeFile(InputStream in, OutputStream out)
-          throws IOException {
-    byte[] buffer = new byte[1024];
-    int len;
-
-    while ((len = in.read(buffer)) != 0) {
-      out.write(buffer, 0, len);
-    }
-
-    in.close();
-    out.close();
-  }
-
   public static void unzipMyZip(String zipFileName, String directoryToExtractTo) {
     Enumeration<? extends ZipEntry> entriesEnum;
     ZipFile zip;
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GeonamesProcessor.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GeonamesProcessor.java
index c58c92d..0553e3c 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GeonamesProcessor.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/GeonamesProcessor.java
@@ -21,52 +21,58 @@ import java.io.File;
 import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import opennlp.addons.geoentitylinker.AdminBoundary;
+
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.StringField;
 import org.apache.lucene.document.TextField;
 import org.apache.lucene.index.IndexWriter;
 
+import opennlp.addons.geoentitylinker.AdminBoundary;
+
 public class GeonamesProcessor {
 
-  public static void process(File countryCodesLookupFile, File adm1CodesLookupFile, File geonamesGazetteerFile, File outputCountryContextFile, IndexWriter w) throws Exception {
-    Map<String, String> countryCodes = getCountryCodes(countryCodesLookupFile);
+  private static final String REGEX_NUMBERS = "[0-9].*";
+  private static final String TAB = "\t";
+  
+  private static final String[] BOOSTS = (
+          "ADM1 ADM1H ADM2 ADM2H ADM3 ADM3H ADM4 ADM4H ADM5 ADMD ADMDH " +
+          "PCLD PCLH PCLI PCLIX TERR PCLIX PPL PPLA PPLA2 PPLA3 PPLA4 " +
+          "PPLC PPLCH PPLF PPLG PPLH PPLL PPLQ PPLR PPLS PPLX STLMT").split(" ");
 
-    Map<String, AdminBoundary> adm1s = getProvData(adm1CodesLookupFile, countryCodes);
+  public GeonamesProcessor() {
+  }
+
+  public static void process(File countryCodesLookup, File adm1CodesLookup,
+                             File geonamesGazetteer, File outputCountryContext, IndexWriter w) throws IOException {
+    Map<String, String> countryCodes = getCountryCodes(countryCodesLookup);
+
+    Map<String, AdminBoundary> adm1s = getProvData(adm1CodesLookup, countryCodes);
     //  List<AdminBoundary> adm2s = getCountryContextFromFile(new File("C:\\temp\\gazetteers\\geonamesdata\\admin2Codes.txt"));
     //admin2Codes.txt
 
-    readFile(geonamesGazetteerFile, GazetteerIndexer.GazType.GEONAMES, adm1s, countryCodes, w);
-    //now append to the coutnry context file
-    writeCountryContextFile(outputCountryContextFile, adm1s);
+    readFile(geonamesGazetteer, GazetteerIndexer.GazType.GEONAMES, adm1s, countryCodes, w);
+    //now append to the country context file
+    writeCountryContextFile(outputCountryContext, adm1s);
 
   }
 
-  public GeonamesProcessor() {
-  }
-
   private static Map<String, AdminBoundary> getProvData(File adm1CodesLookupFile, Map<String, String> ccodes) {
     System.out.println("Attempting to read geonames province data from: " + adm1CodesLookupFile.getPath());
 
     Map<String, AdminBoundary> outmap = new HashMap<>();
-    BufferedReader reader;
     Set<String> nullcodes = new HashSet<>();
-    try {
-
-      reader = new BufferedReader(new FileReader(adm1CodesLookupFile));
-      int i = 0;
+    try (BufferedReader reader = new BufferedReader(new FileReader(adm1CodesLookupFile))){
       String line;
       while ((line = reader.readLine()) != null) {
 
         // String line = reader.readLine();
-        String[] values = line.split("\t");
+        String[] values = line.split(TAB);
         if (values.length != 4) {
           throw new IOException("improperly formatted province lookup file");
         }
@@ -82,7 +88,7 @@ public class GeonamesProcessor {
 
         String pname = values[2];
 
-        if (ccode.matches("[0-9].*")) {
+        if (ccode.matches(REGEX_NUMBERS)) {
           String code = ccode;
           ccode = pcode;
           pcode = code;
@@ -99,7 +105,6 @@ public class GeonamesProcessor {
 
       }
       System.out.println("INFO: there were " + nullcodes.size() + " null prov codes. This is due to inconsistencies in reference data.");
-      reader.close();
     } catch (IOException ex) {
       ex.printStackTrace();
     }
@@ -111,30 +116,24 @@ public class GeonamesProcessor {
 
   private static Map<String, String> getCountryCodes(File countryContextFile) {
     Map<String, String> ccs = new HashMap<>();
-    BufferedReader reader;
-    try {
-
-      reader = new BufferedReader(new FileReader(countryContextFile));
-      int i = 0;
+    try (BufferedReader reader = new BufferedReader(new FileReader(countryContextFile))){
       String line;
       boolean start = false;
       while ((line = reader.readLine()) != null) {
         if (!line.toLowerCase().startsWith("#iso\t") && !start) {
-
           continue;
         } else {
           start = true;
         }
-        String[] values = line.split("\t");
+        String[] values = line.split(TAB);
 
         String ccode = values[0].toLowerCase();//this is the 2 digit ISO code
         String cname = values[4].toLowerCase();
-        if (!ccode.equals("")) {
+        if (!ccode.isEmpty()) {
           ccs.put(ccode, cname);
         }
 
       }
-      reader.close();
     } catch (IOException ex) {
       ex.printStackTrace();
     }
@@ -145,23 +144,18 @@ public class GeonamesProcessor {
   }
 
   public static void writeCountryContextFile(File outfile, Map<String, AdminBoundary> adms) {
-    // FileWriter writer = null;
-    try (FileWriter writer = new FileWriter(outfile, true)) {
-      BufferedWriter bw = new BufferedWriter(writer);
-
+    try (BufferedWriter bw = new BufferedWriter(new FileWriter(outfile, true))) {
       for (String admKey : adms.keySet()) {
         AdminBoundary adm = adms.get(admKey);
         if (adm == null) {
           continue;
         }
-        String province = adm.getProvinceName();
-        String country = adm.getCountryName();
+        String province = adm.provinceName();
+        String country = adm.countryName();
 
-        String line = adm.getCountryCode() + "\t" + adm.getProvCode() + "\t" + "\t" + country + "\t" + province + "\t" + "\t" + "(" + country + ")" + "\t"
-            + adm.getProvinceName() + "\t" + adm.getCountyName() + "\n";
+        String line = adm.countryCode() + TAB + adm.getProvCode() + TAB + TAB + country + TAB + province +
+                TAB + TAB + "(" + country + ")" + TAB + adm.provinceName() + TAB + adm.countyName() + "\n";
         bw.write(line);
-        // System.out.println(line);
-
       }
 
     } catch (IOException ex) {
@@ -177,119 +171,104 @@ public class GeonamesProcessor {
    * @param adms the province info
    * @param countrycodes the country code info
    * @param w the lucene index writer
-   * @throws Exception
+   *
+   * @throws IOException Thrown if IO errors occurred.
    */
-  public static void readFile(File gazateerInputData, GazetteerIndexer.GazType type, Map<String, AdminBoundary> adms, Map<String, String> countrycodes, IndexWriter w) throws Exception {
+  public static void readFile(File gazateerInputData, GazetteerIndexer.GazType type,
+                              Map<String, AdminBoundary> adms, Map<String, String> countrycodes,
+                              IndexWriter w) throws IOException {
 
-    BufferedReader reader = new BufferedReader(new FileReader(gazateerInputData));
-    String[] boosts = "ADM1 ADM1H ADM2 ADM2H ADM3 ADM3H ADM4 ADM4H ADM5 ADMD ADMDH PCLD PCLH PCLI PCLIX TERR PCLIX PPL PPLA PPLA2 PPLA3 PPLA4 PPLC PPLCH PPLF PPLG PPLH PPLL PPLQ PPLR PPLS PPLX STLMT".split(" ");
-    Map<String, Float> boostMap = new HashMap<>();
-    for (String boost : boosts) {
+    final Map<String, Float> boostMap = new HashMap<>();
+    for (String boost : BOOSTS) {
       boostMap.put(boost.toLowerCase(), 10f);
     }
-    String[] fieldStrings = new String[]{
-      "geonameid",
-      "name",
-      "asciiname",
-      "alternatenames",
-      "latitude",
-      "longitude",
-      "feature_class",
-      "feature_code",
-      "country code",
-      "cc2",
-      "admin1_code",
-      "admin2_code",
-      "admin3_code",
-      "admin4_code",
-      "population",
-      "elevation",
-      "dem ",
-      "timezone",
-      "modification_date"};
-
-    List<String> fields = Arrays.asList(fieldStrings);
+    final List<String> fields = List.of("geonameid", "name", "asciiname", "alternatenames",
+            "latitude", "longitude", "feature_class", "feature_code", "country code", "cc2",
+            "admin1_code", "admin2_code", "admin3_code", "admin4_code", "population",
+            "elevation", "dem ", "timezone", "modification_date");
+
     int counter = 0;
     System.out.println("reading gazetteer data from file...........");
     String line;
-    while ((line = reader.readLine()) != null) {
-      String[] values = line.split(type.getSeparator());
-
-      Document doc = new Document();
-      String admincode = values[10].toLowerCase();
-      String ccode = values[8].toLowerCase();
-      if (ccode.contains(",")) {
-        String[] codes = ccode.split(",");
-        if (codes.length > 0) {
-          ccode = codes[0];
+
+    try (BufferedReader reader = new BufferedReader(new FileReader(gazateerInputData))) {
+      while ((line = reader.readLine()) != null) {
+        String[] values = line.split(type.getSeparator());
+
+        Document doc = new Document();
+        String admincode = values[10].toLowerCase();
+        String ccode = values[8].toLowerCase();
+        if (ccode.contains(",")) {
+          String[] codes = ccode.split(",");
+          if (codes.length > 0) {
+            ccode = codes[0];
+          }
         }
-      }
-      AdminBoundary adm = adms.get(ccode + "." + admincode);
-
-      String placeName = values[2];
-      String lat = values[4];
-      String lon = values[5];
-      String dsg = values[7].toLowerCase();
-
-      String id = values[0];
-      String concatIndexEntry;
-      String countryname;
-      if (adm != null) {
-        concatIndexEntry = adm.getCountryName() + ", " + adm.getProvinceName() + ", " + placeName;
-        countryname = adm.getCountryName();
-      } else {
-        //there is no admin info, but we can still use the countrycode to concat the country name
-        String n = countrycodes.get(ccode);
-        countryname = n;
-        if (n != null) {
-          concatIndexEntry = n + ", " + placeName;
+        AdminBoundary adm = adms.get(ccode + "." + admincode);
+
+        String placeName = values[2];
+        String lat = values[4];
+        String lon = values[5];
+        String dsg = values[7].toLowerCase();
+
+        String id = values[0];
+        String concatIndexEntry;
+        String countryname;
+        if (adm != null) {
+          concatIndexEntry = adm.countryName() + ", " + adm.provinceName() + ", " + placeName;
+          countryname = adm.countryName();
         } else {
-          ///don't want a single token hierarchy entry.
-          concatIndexEntry = "";
+          //there is no admin info, but we can still use the countrycode to concat the country name
+          String n = countrycodes.get(ccode);
+          countryname = n;
+          if (n != null) {
+            concatIndexEntry = n + ", " + placeName;
+          } else {
+            ///don't want a single token hierarchy entry.
+            concatIndexEntry = "";
+          }
         }
-      }
-      if (ccode == null) {
-        System.out.println("naughty country code");
-      }
-      for (int i = 0; i < fields.size() - 1; i++) {
-        doc.add(new TextField(fields.get(i), values[i].trim(), Field.Store.YES));
+        if (ccode == null) {
+          System.out.println("naughty country code");
+        }
+        for (int i = 0; i < fields.size() - 1; i++) {
+          doc.add(new TextField(fields.get(i), values[i].trim(), Field.Store.YES));
 
-      }
-      if (dsg.equals("pcli")) {
-        System.out.println("placename: " + placeName + " RESET TO: " + countryname);
-        placeName = countryname;
-      }
-      /*
-       * add standard fields to the index
-       */
-      doc.add(new TextField("hierarchy", concatIndexEntry, Field.Store.YES));
-      doc.add(new TextField("placename", placeName, Field.Store.YES));
-      // doc.add(new TextField("countryname", countryname, Field.Store.YES));
-      //System.out.println(placeName);
-
-      doc.add(new TextField("latitude", lat, Field.Store.YES));
-      doc.add(new TextField("longitude", lon, Field.Store.YES));
-      doc.add(new StringField("loctype", dsg, Field.Store.YES));
-      doc.add(new StringField("admincode", (ccode + "." + admincode).toLowerCase(), Field.Store.YES));
-      doc.add(new StringField("countrycode", ccode.toLowerCase(), Field.Store.YES));
-      doc.add(new StringField("countycode", "", Field.Store.YES));
-      doc.add(new StringField("locid", id, Field.Store.YES));
-      placeName = placeName.replace("republic of", "").replace("federative", "");
-      if (id.equals("3175395")) {
-        System.out.println(placeName);
-      }
-      doc.add(new StringField("gazsource", "geonames", Field.Store.YES));
+        }
+        if (dsg.equals("pcli")) {
+          System.out.println("placename: " + placeName + " RESET TO: " + countryname);
+          placeName = countryname;
+        }
+        /*
+         * add standard fields to the index
+         */
+        doc.add(new TextField("hierarchy", concatIndexEntry, Field.Store.YES));
+        doc.add(new TextField("placename", placeName, Field.Store.YES));
+        // doc.add(new TextField("countryname", countryname, Field.Store.YES));
+        //System.out.println(placeName);
+
+        doc.add(new TextField("latitude", lat, Field.Store.YES));
+        doc.add(new TextField("longitude", lon, Field.Store.YES));
+        doc.add(new StringField("loctype", dsg, Field.Store.YES));
+        doc.add(new StringField("admincode", (ccode + "." + admincode).toLowerCase(), Field.Store.YES));
+        doc.add(new StringField("countrycode", ccode.toLowerCase(), Field.Store.YES));
+        doc.add(new StringField("countycode", "", Field.Store.YES));
+        doc.add(new StringField("locid", id, Field.Store.YES));
+        placeName = placeName.replace("republic of", "").replace("federative", "");
+        if (id.equals("3175395")) {
+          System.out.println(placeName);
+        }
+        doc.add(new StringField("gazsource", "geonames", Field.Store.YES));
 
-      w.addDocument(doc);
+        w.addDocument(doc);
 
-      counter++;
-      if (counter % 100000 == 0) {
-        w.commit();
-        System.out.println(counter + " .........Geonames entries committed to index..............");
+        counter++;
+        if (counter % 100000 == 0) {
+          w.commit();
+          System.out.println(counter + " .........Geonames entries committed to index..............");
+        }
       }
-
     }
-
     System.out.println("Completed indexing geonames gaz! index name is: " + type.toString());
   }
 
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/RegionProcessor.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/RegionProcessor.java
index c6b2d0c..5335c2b 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/RegionProcessor.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/RegionProcessor.java
@@ -20,8 +20,10 @@ import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileReader;
 import java.io.FileWriter;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.StringField;
@@ -31,13 +33,15 @@ import org.apache.lucene.index.IndexWriter;
 public class RegionProcessor {
 
   public static void main(String[] args) {
-    RegionProcessor.process(new File("C:\\temp\\gazetteers\\regions.txt"), new File("C:\\temp\\gazetteers\\testRegionContext.txt"), null);
+    RegionProcessor.process(
+            new File("C:\\temp\\gazetteers\\regions.txt"),
+            new File("C:\\temp\\gazetteers\\testRegionContext.txt"), null);
   }
 
   /**
    *
    * @param regionsFile the file that stores Region references. the format of
-   * this file is tab delimitted text with index 0 as the name of the region,
+   * this file is tab delimited text with index 0 as the name of the region,
    * index 1 as the longitude, and index 2 as the latitude
    * @param outputCountryContextfile this is the country context files shared by
    * all indexing processors
@@ -51,64 +55,65 @@ public class RegionProcessor {
     }
   }
 
-  public static void readFile(File gazateerInputData, File outputCountryContextfile, IndexWriter w) throws Exception {
+  public static void readFile(File gazateerInputData, File outputCountryContextfile,
+                              IndexWriter w) throws IOException {
     List<String> ccfileentries = new ArrayList<>();
-    BufferedReader reader = new BufferedReader(new FileReader(gazateerInputData));
     List<String> fields = new ArrayList<>();
     int counter = 0;
     System.out.println("reading gazetteer data from Regions file...........");
     String line;
-    while ((line = reader.readLine()) != null) {
-
-      String[] values = line.split("\t");
-      if (counter == 0) {
+    try (BufferedReader reader = new BufferedReader(new FileReader(gazateerInputData))) {
+      while ((line = reader.readLine()) != null) {
+        String[] values = line.split("\t");
+        if (counter == 0) {
 
-      } else {
-        Document doc = new Document();
-        for (int i = 0; i < fields.size() - 1; i++) {
-          doc.add(new TextField(fields.get(i), values[i].trim(), Field.Store.YES));
-        }
-        String placeName = values[0];
-        String lat = values[2];
-        String lon = values[1];
-        String dsg = "region";
-        String id = "rg" + counter;
+        } else {
+          Document doc = new Document();
+          for (int i = 0; i < fields.size() - 1; i++) {
+            doc.add(new TextField(fields.get(i), values[i].trim(), Field.Store.YES));
+          }
+          String placeName = values[0];
+          String lat = values[2];
+          String lon = values[1];
+          String dsg = "region";
+          String id = "rg" + counter;
 
-        String hierarchy = placeName;
+          String hierarchy = placeName;
 
-        doc.add(new TextField("hierarchy", hierarchy, Field.Store.YES));
-        doc.add(new TextField("placename", placeName, Field.Store.YES));
-        doc.add(new StringField("latitude", lat, Field.Store.YES));
-        doc.add(new StringField("longitude", lon, Field.Store.YES));
-        doc.add(new StringField("loctype", dsg, Field.Store.YES));
-        doc.add(new StringField("admincode", "", Field.Store.YES));
-        doc.add(new StringField("countrycode", id, Field.Store.YES));
-        doc.add(new StringField("countycode", "", Field.Store.YES));
+          doc.add(new TextField("hierarchy", hierarchy, Field.Store.YES));
+          doc.add(new TextField("placename", placeName, Field.Store.YES));
+          doc.add(new StringField("latitude", lat, Field.Store.YES));
+          doc.add(new StringField("longitude", lon, Field.Store.YES));
+          doc.add(new StringField("loctype", dsg, Field.Store.YES));
+          doc.add(new StringField("admincode", "", Field.Store.YES));
+          doc.add(new StringField("countrycode", id, Field.Store.YES));
+          doc.add(new StringField("countycode", "", Field.Store.YES));
 
-        doc.add(new StringField("locid", id, Field.Store.YES));
-        doc.add(new StringField("gazsource", "region", Field.Store.YES));
-        //countrycontext file format
-        // US	KY	131	United States	Kentucky	Leslie
+          doc.add(new StringField("locid", id, Field.Store.YES));
+          doc.add(new StringField("gazsource", "region", Field.Store.YES));
+          //countrycontext file format
+          // US	KY	131	United States	Kentucky	Leslie
 
-        ccfileentries.add(id + "\t" + id + "\t" + id + "\t" + placeName + "\t" + "NO_DATA_FOUND" + "\t" + "NO_DATA_FOUND" + "\t" + "("
-            + placeName + ")" + "\t" + "NO_DATA_FOUND" + "\t" + "NO_DATA_FOUND" + "\n");
-        if (w != null) {
-          w.addDocument(doc);
+          ccfileentries.add(id + "\t" + id + "\t" + id + "\t" + placeName + "\t" + "NO_DATA_FOUND" + "\t" + "NO_DATA_FOUND" + "\t" + "("
+                  + placeName + ")" + "\t" + "NO_DATA_FOUND" + "\t" + "NO_DATA_FOUND" + "\n");
+          if (w != null) {
+            w.addDocument(doc);
+          }
         }
-      }
-      counter++;
+        counter++;
 
+      }
+      if (w != null) {
+        w.commit();
+      }
     }
-    if (w != null) {
-      w.commit();
-    }
-    FileWriter writer = new FileWriter(outputCountryContextfile, true);
-    BufferedWriter bw = new BufferedWriter(writer);
-    for (String string : ccfileentries) {
-      bw.write(string);
+
+    try (BufferedWriter bw = new BufferedWriter(new FileWriter(outputCountryContextfile, true))) {
+      for (String string : ccfileentries) {
+        bw.write(string);
+      }
+      System.out.println("successfully wrote Region entries to country oontext file");
     }
-    System.out.println("successfully wrote Region entries to country oontext file");
-    bw.close();
     System.out.println("Completed indexing regions!");
   }
 
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/USGSProcessor.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/USGSProcessor.java
index 46e6200..ac1e91f 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/USGSProcessor.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/indexing/USGSProcessor.java
@@ -27,16 +27,19 @@ import java.util.List;
 import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import opennlp.addons.geoentitylinker.AdminBoundary;
+
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.StringField;
 import org.apache.lucene.document.TextField;
-
 import org.apache.lucene.index.IndexWriter;
 
+import opennlp.addons.geoentitylinker.AdminBoundary;
+
 public class USGSProcessor {
 
+  private static final String TAB = "\t";
+
   public static void main(String[] args) {
     try {
       Map<String, AdminBoundary> provData = getProvData(new File("C:\\temp\\gazetteers\\usgsdata\\GOVT_UNITS_20140601.txt"), GazetteerIndexer.GazType.USGS);
@@ -46,13 +49,15 @@ public class USGSProcessor {
     }
   }
 
-  public static void process(File lookupData, File usgsGazDataFile, File outputCountryContextfile, IndexWriter w) throws Exception {
+  public static void process(File lookupData, File usgsGazDataFile,
+                             File outputCountryContextfile, IndexWriter w) throws IOException {
     Map<String, AdminBoundary> provData = getProvData(lookupData, GazetteerIndexer.GazType.USGS);
     readFile(usgsGazDataFile, w, GazetteerIndexer.GazType.USGS, provData);
     writeCountryContextFile(outputCountryContextfile, provData);
   }
 
-  public static void readFile(File gazateerInputData, IndexWriter w, GazetteerIndexer.GazType type, Map<String, AdminBoundary> lookupMap) throws Exception {
+  public static void readFile(File gazateerInputData, IndexWriter w, GazetteerIndexer.GazType type,
+                              Map<String, AdminBoundary> lookupMap) throws IOException {
 
     Map<String, StateCentroid> states = new HashMap<>();
     try (BufferedReader reader = new BufferedReader(new FileReader(gazateerInputData))) {
@@ -89,18 +94,18 @@ public class USGSProcessor {
             continue;
 
           }
-          String countyCode = get.getCountyCode();
+          String countyCode = get.countyCode();
 
-          if (!get.getCountyName().equals("NO_DATA_FOUND_VALUE")) {
-            countyname = get.getCountyName();
+          if (!get.countyName().equals("NO_DATA_FOUND_VALUE")) {
+            countyname = get.countyName();
           }
-          if (!get.getCountyCode().equals("NO_DATA_FOUND_VALUE")) {
-            countyCode = get.getCountyCode();
+          if (!get.countyCode().equals("NO_DATA_FOUND_VALUE")) {
+            countyCode = get.countyCode();
           }
-          String hierarchy = get.getCountryName() + ", " + get.getProvinceName() + ", " + countyname + ", " + placeName;
+          String hierarchy = get.countryName() + ", " + get.provinceName() + ", " + countyname + ", " + placeName;
 
-          if (states.containsKey(get.getProvinceName())) {
-            StateCentroid entry = states.get(get.getProvinceName());
+          if (states.containsKey(get.provinceName())) {
+            StateCentroid entry = states.get(get.provinceName());
             entry.count++;
             entry.latSum += Double.parseDouble(lat);
             entry.longSum += Double.parseDouble(lon);
@@ -110,7 +115,7 @@ public class USGSProcessor {
             centroid.count = 1;
             centroid.latSum = Double.parseDouble(lat);
             centroid.longSum = Double.parseDouble(lon);
-            states.put(get.getProvinceName(), centroid);
+            states.put(get.provinceName(), centroid);
           }
 
           doc.add(new TextField("hierarchy", hierarchy, Field.Store.YES));
@@ -118,9 +123,9 @@ public class USGSProcessor {
           doc.add(new TextField("latitude", lat, Field.Store.YES));
           doc.add(new TextField("longitude", lon, Field.Store.YES));
           doc.add(new StringField("loctype", dsg, Field.Store.YES));
-          doc.add(new StringField("admincode", (get.getCountryCode() + "." + get.getProvCode()).toLowerCase(), Field.Store.YES));
-          doc.add(new StringField("countrycode", get.getCountryCode().toLowerCase(), Field.Store.YES));
-          doc.add(new StringField("countycode", (get.getCountryCode() + "." + get.getProvCode() + "." + countyCode).toLowerCase(), Field.Store.YES));
+          doc.add(new StringField("admincode", (get.countryCode() + "." + get.getProvCode()).toLowerCase(), Field.Store.YES));
+          doc.add(new StringField("countrycode", get.countryCode().toLowerCase(), Field.Store.YES));
+          doc.add(new StringField("countycode", (get.countryCode() + "." + get.getProvCode() + "." + countyCode).toLowerCase(), Field.Store.YES));
 
           doc.add(new StringField("locid", id, Field.Store.YES));
           doc.add(new StringField("gazsource", "usgs", Field.Store.YES));
@@ -231,16 +236,18 @@ public class USGSProcessor {
         if (adm == null) {
           continue;
         }
-        String province = adm.getProvinceName();
-        String country = adm.getCountryName();
+        String province = adm.provinceName();
+        String country = adm.countryName();
         /*
          * this is the standard format of the country context file... Geonames
          * data will have an empty string for the county
          */
-        String line = adm.getCountryCode() + "\t" + adm.getProvCode() + "\t" + adm.getCountyCode() + "\t" + country + "\t" + province + "\t" + adm.getCountyName() + "\t"
-            + "(U\\.S\\.[ $]|U\\.S\\.A\\.[ $]|United States|the US[ $]|a us[ $])" + "\t" + adm.getProvinceName() + "\t" + adm.getCountyName() + "\n";
+        String line = adm.countryCode() + TAB + adm.getProvCode() + TAB + adm.countyCode() +
+                TAB + country + TAB + province + TAB + adm.countyName() + TAB
+                + "(U\\.S\\.[ $]|U\\.S\\.A\\.[ $]|United States|the US[ $]|a us[ $])" +
+                TAB + adm.provinceName() + TAB + adm.countyName() + "\n";
         bw.write(line);
-        ///  System.out.println(line);
+        //  System.out.println(line);
       }
     } catch (IOException ex) {
       Logger.getLogger(GeonamesProcessor.class.getName()).log(Level.SEVERE, null, ex);
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/CountryProximityScorer.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/CountryProximityScorer.java
index b706c5f..726c809 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/CountryProximityScorer.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/CountryProximityScorer.java
@@ -23,6 +23,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
 import java.util.regex.Pattern;
+
 import opennlp.addons.geoentitylinker.AdminBoundaryContext;
 import opennlp.tools.entitylinker.EntityLinkerProperties;
 import opennlp.tools.entitylinker.BaseLink;
@@ -36,18 +37,16 @@ import opennlp.tools.util.Span;
  * indicator of Germany, it is more likely to be Berlin Germany than Berlin
  * Connecticut (if Connecticut is mentioned further down in the article).
  */
-public class CountryProximityScorer implements LinkedEntityScorer<AdminBoundaryContext> {
+public class CountryProximityScorer  implements LinkedEntityScorer<BaseLink, AdminBoundaryContext> {
 
   private Map<String, Set<String>> nameCodesMap;
   String dominantCode = "";
   private Map<String, String> regexMap = new HashMap<>();
 
   @Override
-  public void score(List<LinkedSpan> linkedSpans, String docText, Span[] sentenceSpans, EntityLinkerProperties properties, AdminBoundaryContext additionalContext) {
-
+  public void score(List<LinkedSpan<BaseLink>> linkedSpans, String docText, Span[] sentenceSpans, EntityLinkerProperties properties, AdminBoundaryContext additionalContext) {
     regexMap = additionalContext.getCountryRegexMap();
     score(linkedSpans, additionalContext.getCountryMentions(), additionalContext.getNameCodesMap(), docText, sentenceSpans, 1000);
-
   }
 
   /**
@@ -70,7 +69,7 @@ public class CountryProximityScorer implements LinkedEntityScorer<AdminBoundaryC
    * Named Entity.
    * @return
    */
-  public List<LinkedSpan> score(List<LinkedSpan> linkedData, Map<String, Set<Integer>> countryHits, Map<String, Set<String>> nameCodesMap, String docText, Span[] sentences, Integer maxAllowedDist) {
+  public List<LinkedSpan<BaseLink>> score(List<LinkedSpan<BaseLink>> linkedData, Map<String, Set<Integer>> countryHits, Map<String, Set<String>> nameCodesMap, String docText, Span[] sentences, Integer maxAllowedDist) {
     this.nameCodesMap = nameCodesMap;
     setDominantCode(countryHits);
     for (LinkedSpan<BaseLink> linkedspan : linkedData) {
@@ -254,10 +253,9 @@ public class CountryProximityScorer implements LinkedEntityScorer<AdminBoundaryC
     for (double d : windowOfAverages) {
       sum += d;
     }
-    double result = sum / windowOfAverages.size();
     //TODO: ++ prob when large amounts of mentions for a code
     //System.out.println("avg of window:" + result);
-    return result;
+    return sum / windowOfAverages.size();
   }
 
   /**
@@ -274,4 +272,5 @@ public class CountryProximityScorer implements LinkedEntityScorer<AdminBoundaryC
     d = d == null ? 0d : d;
     return d;
   }
+
 }
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/FuzzyStringMatchScorer.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/FuzzyStringMatchScorer.java
index 5367122..a9a7e3e 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/FuzzyStringMatchScorer.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/FuzzyStringMatchScorer.java
@@ -19,6 +19,7 @@ import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+
 import opennlp.addons.geoentitylinker.AdminBoundaryContext;
 import opennlp.addons.geoentitylinker.GazetteerEntry;
 import opennlp.tools.entitylinker.EntityLinkerProperties;
@@ -30,15 +31,14 @@ import opennlp.tools.util.Span;
  *
  * Generates scores based on string comparisons levenstein and dice
  */
-public class FuzzyStringMatchScorer implements LinkedEntityScorer<AdminBoundaryContext> {
+public class FuzzyStringMatchScorer implements LinkedEntityScorer<GazetteerEntry, AdminBoundaryContext> {
 
   @Override
-  public void score(List<LinkedSpan> linkedSpans, String docText, Span[] sentenceSpans, EntityLinkerProperties properties, AdminBoundaryContext additionalContext) {
+  public void score(List<LinkedSpan<GazetteerEntry>> linkedSpans, String docText, Span[] sentenceSpans, EntityLinkerProperties properties, AdminBoundaryContext additionalContext) {
 
-    for (LinkedSpan<BaseLink> linkedSpan : linkedSpans) {
+    for (LinkedSpan<GazetteerEntry> linkedSpan : linkedSpans) {
       for (BaseLink link : linkedSpan.getLinkedEntries()) {
-        if (link instanceof GazetteerEntry) {
-          GazetteerEntry entry = (GazetteerEntry) link;
+        if (link instanceof GazetteerEntry entry) {
           String hierarchy = entry.getHierarchy();
           if (hierarchy != null) {
             Double dice = getDiceCoefficient(linkedSpan.getSearchTerm().toLowerCase(), hierarchy.toLowerCase(), 2);
@@ -50,12 +50,10 @@ public class FuzzyStringMatchScorer implements LinkedEntityScorer<AdminBoundaryC
            if (placename != null) {
             Double dice = getDiceCoefficient(linkedSpan.getSearchTerm().toLowerCase(), placename, 2);
             link.getScoreMap().put("placenamedicecoef", dice);
-            
           }
         }
       }
     }
-
   }
 
   /**
@@ -75,14 +73,14 @@ public class FuzzyStringMatchScorer implements LinkedEntityScorer<AdminBoundaryC
     List<String> s2Grams = new ArrayList<>();
     String[] split1 = s1.split("[ ,]");
     for (String token : split1) {
-      if (token.trim().equals("")) {
+      if (token.trim().isEmpty()) {
         continue;
       }
       s1Grams.add(token);
     }
     String[] split2 = s2.split("[ ,]");
     for (String token : split2) {
-      if (token.trim().equals("")) {
+      if (token.trim().isEmpty()) {
         continue;
       }
       s2Grams.add(token);
@@ -99,8 +97,7 @@ public class FuzzyStringMatchScorer implements LinkedEntityScorer<AdminBoundaryC
     return Math.min(Math.min(a, b), c);
   }
 
-  public int getLevenshteinDistance(CharSequence str1,
-          CharSequence str2) {
+  public int getLevenshteinDistance(CharSequence str1, CharSequence str2) {
     int[][] distance = new int[str1.length() + 1][str2.length() + 1];
 
     for (int i = 0; i <= str1.length(); i++) {
@@ -112,9 +109,7 @@ public class FuzzyStringMatchScorer implements LinkedEntityScorer<AdminBoundaryC
 
     for (int i = 1; i <= str1.length(); i++) {
       for (int j = 1; j <= str2.length(); j++) {
-        distance[i][j] = minimum(
-                distance[i - 1][j] + 1,
-                distance[i][j - 1] + 1,
+        distance[i][j] = minimum(distance[i - 1][j] + 1, distance[i][j - 1] + 1,
                 distance[i - 1][j - 1] + ((str1.charAt(i - 1) == str2.charAt(j - 1)) ? 0 : 1));
       }
     }
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/GeoHashBinningScorer.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/GeoHashBinningScorer.java
index 6b245d6..30f98c4 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/GeoHashBinningScorer.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/GeoHashBinningScorer.java
@@ -18,10 +18,10 @@ package opennlp.addons.geoentitylinker.scoring;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+
 import opennlp.addons.geoentitylinker.AdminBoundaryContext;
 import opennlp.addons.geoentitylinker.GazetteerEntry;
 import opennlp.tools.entitylinker.EntityLinkerProperties;
-import opennlp.tools.entitylinker.BaseLink;
 import opennlp.tools.entitylinker.LinkedSpan;
 import opennlp.tools.util.Span;
 
@@ -29,33 +29,28 @@ import opennlp.tools.util.Span;
  * Scores toponymns based on geographic point binning. Based on the heuristic
  * that docs are generally about a small amount of locations, so one can detect
  * outliers by finding those points that are not near the majority
- *
  */
-public class GeoHashBinningScorer implements LinkedEntityScorer<AdminBoundaryContext> {
+public class GeoHashBinningScorer implements LinkedEntityScorer<GazetteerEntry, AdminBoundaryContext> {
 
   private final PointClustering CLUSTERER = new PointClustering();
-  private int PRECISION = 3;
+  private final static int PRECISION = 3;
 
   @Override
-  public void score(List<LinkedSpan> linkedSpans, String docText, Span[] sentenceSpans, EntityLinkerProperties properties,  AdminBoundaryContext additionalContext) {
+  public void score(List<LinkedSpan<GazetteerEntry>> linkedSpans, String docText, Span[] sentenceSpans,
+                    EntityLinkerProperties properties,  AdminBoundaryContext additionalContext) {
     List<GazetteerEntry> allGazEntries = new ArrayList<>();
 
     /*
      * collect all the gaz entry references
      */
-    for (LinkedSpan<BaseLink> ls : linkedSpans) {
-      for (BaseLink bl : ls.getLinkedEntries()) {
-        if (bl instanceof GazetteerEntry) {
-          allGazEntries.add((GazetteerEntry) bl);
-        }
-      }
+    for (LinkedSpan<GazetteerEntry> ls : linkedSpans) {
+      allGazEntries.addAll(ls.getLinkedEntries());
     }
     /*
      * use the point clustering to score each hit
      */
     Map<String, List<GazetteerEntry>> cluster = CLUSTERER.cluster(allGazEntries, PRECISION);
     CLUSTERER.scoreClusters(cluster);
-
   }
 
 }
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/LinkedEntityScorer.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/LinkedEntityScorer.java
index 8054d6f..ad9f220 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/LinkedEntityScorer.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/LinkedEntityScorer.java
@@ -16,6 +16,8 @@
 package opennlp.addons.geoentitylinker.scoring;
 
 import java.util.List;
+
+import opennlp.tools.entitylinker.BaseLink;
 import opennlp.tools.entitylinker.EntityLinkerProperties;
 import opennlp.tools.entitylinker.LinkedSpan;
 import opennlp.tools.util.Span;
@@ -23,18 +25,21 @@ import opennlp.tools.util.Span;
 /**
  * Structure for scoring linked entities. The Map logically represents a pair :
  * "Score type" to the "actual Score."
- * @param <T> a generic for providing additional context
+ * 
+ * @param <L> A template type for the {@link LinkedSpan} type.
+ * @param <T> A template type for providing additional context.
  */
-public interface LinkedEntityScorer<T> {
+public interface LinkedEntityScorer<L extends BaseLink, T> {
 
-/**
- * Scores a collection of linked entities. Implementations should populate the scoreMap in the list of BaseLink for each linkedSpan
- * this method internally affects the reference to linkedSpans that was passed in
- * @param linkedSpans the spans that have been linked to some external source and have all the data they need to be scored
- * @param docText the full text of the document.
- * @param sentenceSpans the sentence spans the correspond to the document text
- * @param properties the entitylinker properties config file
- * @param additionalContext any additional data required to perform the scoring operation
- */
-  void score(List<LinkedSpan> linkedSpans, String docText, Span[] sentenceSpans, EntityLinkerProperties properties, T additionalContext);
+  /**
+   * Scores a collection of linked entities. Implementations should populate the scoreMap in the list of BaseLink for each linkedSpan
+   * this method internally affects the reference to linkedSpans that was passed in
+   * @param linkedSpans the spans that have been linked to some external source and have all the data they need to be scored
+   * @param docText the full text of the document.
+   * @param sentenceSpans the sentence spans that corresponds to the document text
+   * @param properties the entitylinker properties config file
+   * @param additionalContext any additional data required to perform the scoring operation
+   */
+  void score(List<LinkedSpan<L>> linkedSpans, String docText, Span[] sentenceSpans,
+             EntityLinkerProperties properties, T additionalContext);
 }
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/ModelBasedScorer.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/ModelBasedScorer.java
index 1c39855..d227b8d 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/ModelBasedScorer.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/ModelBasedScorer.java
@@ -20,6 +20,10 @@ import java.lang.invoke.MethodHandles;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import opennlp.addons.geoentitylinker.AdminBoundaryContext;
 import opennlp.tools.doccat.DoccatModel;
 import opennlp.tools.doccat.DocumentCategorizerME;
@@ -27,14 +31,11 @@ import opennlp.tools.entitylinker.EntityLinkerProperties;
 import opennlp.tools.entitylinker.BaseLink;
 import opennlp.tools.entitylinker.LinkedSpan;
 import opennlp.tools.util.Span;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
- *
  * Utilizes a doccat model to score toponyms based on surrounding context
  */
-public class ModelBasedScorer implements LinkedEntityScorer<AdminBoundaryContext> {
+public class ModelBasedScorer implements LinkedEntityScorer<BaseLink, AdminBoundaryContext> {
 
   private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
   
@@ -44,11 +45,12 @@ public class ModelBasedScorer implements LinkedEntityScorer<AdminBoundaryContext
   boolean modelexists = false;
 
   @Override
-  public void score(List<LinkedSpan> linkedSpans, String docText, Span[] sentenceSpans, EntityLinkerProperties properties, AdminBoundaryContext additionalContext) {
+  public void score(List<LinkedSpan<BaseLink>> linkedSpans, String docText, Span[] sentenceSpans,
+                    EntityLinkerProperties properties, AdminBoundaryContext additionalContext) {
     try {
       if (doccatModel == null) {
         String path = properties.getProperty("opennlp.geoentitylinker.modelbasedscorer.modelpath", "");
-        if (path.equals("")) {
+        if (path.isEmpty()) {
           return;
         }
         modelexists = true;
@@ -58,7 +60,7 @@ public class ModelBasedScorer implements LinkedEntityScorer<AdminBoundaryContext
       Map<Integer, String> proximalFeatures = generateProximalFeatures(linkedSpans, sentenceSpans, docText, RADIUS);
       for (Map.Entry<Integer, String> entry : proximalFeatures.entrySet()) {
         Map<String, Double> scores = this.getScore(entry.getValue());
-        for (BaseLink link : (List<BaseLink>) linkedSpans.get(entry.getKey()).getLinkedEntries()) {
+        for (BaseLink link : linkedSpans.get(entry.getKey()).getLinkedEntries()) {
           double score = 0d;
           if (scores.containsKey(link.getItemParentID())) {
             score = scores.get(link.getItemParentID());
@@ -83,7 +85,8 @@ public class ModelBasedScorer implements LinkedEntityScorer<AdminBoundaryContext
    * @return a map of the index of the linked span to the string of surrounding
    * text: Map&lt;indexofspan,surrounding text&gt;
    */
-  public Map<Integer, String> generateProximalFeatures(List<LinkedSpan> linkedSpans, Span[] sentenceSpans, String docText, int radius) {
+  public Map<Integer, String> generateProximalFeatures(List<LinkedSpan<BaseLink>> linkedSpans,
+                                                       Span[] sentenceSpans, String docText, int radius) {
     Map<Integer, String> featureBags = new HashMap<>();
     Map<Integer, Integer> nameMentionMap = new HashMap<>();
     /*
@@ -144,7 +147,7 @@ public class ModelBasedScorer implements LinkedEntityScorer<AdminBoundaryContext
     return chunk;
   }
 
-  private Map<String, Double> getScore(String text) throws Exception {
+  private Map<String, Double> getScore(String text) {
     Map<String, Double> scoreMap = new HashMap<>();
     double[] categorize = documentCategorizerME.categorize(List.of(text).toArray(new String[0]));
     int catSize = documentCategorizerME.getNumberOfCategories();
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/PlacetypeScorer.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/PlacetypeScorer.java
index 9a3e2d1..4a3b05a 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/PlacetypeScorer.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/PlacetypeScorer.java
@@ -19,6 +19,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
 import opennlp.addons.geoentitylinker.AdminBoundaryContext;
 import opennlp.addons.geoentitylinker.GazetteerEntry;
 import opennlp.tools.entitylinker.EntityLinkerProperties;
@@ -29,17 +30,21 @@ import opennlp.tools.util.Span;
  *
  * @author mgiaconia
  */
-public class PlacetypeScorer implements LinkedEntityScorer<AdminBoundaryContext> {
+public class PlacetypeScorer implements LinkedEntityScorer<GazetteerEntry, AdminBoundaryContext> {
 
-  private static final String[] boosts = "ADM1 ADM1H ADM2 ADM2H ADM3 ADM3H ADM4 ADM4H ADM5 ADMD ADMDH PCLD PCLH PCLI PCLIX TERR PCLIX PPL PPLA PPLA2 PPLA3 PPLA4 PPLC PPLCH PPLF PPLG PPLH PPLL PPLQ PPLR PPLS PPLX STLMT civil Populated_Place".split(" ");
-  private Map<String, Double> boosetedTypes = new HashMap<>();
+  private static final String[] boosts = ("ADM1 ADM1H ADM2 ADM2H ADM3 ADM3H ADM4 ADM4H ADM5 ADMD " +
+          "ADMDH PCLD PCLH PCLI PCLIX TERR PCLIX PPL PPLA PPLA2 PPLA3 PPLA4 PPLC PPLCH PPLF PPLG " +
+          "PPLH PPLL PPLQ PPLR PPLS PPLX STLMT civil Populated_Place").split(" ");
+  
+  private final Map<String, Double> boosetedTypes = new HashMap<>();
 
   public PlacetypeScorer() {
     fillMap();
   }
 
   @Override
-  public void score(List<LinkedSpan> linkedSpans, String docText, Span[] sentenceSpans, EntityLinkerProperties properties, AdminBoundaryContext additionalContext) {
+  public void score(List<LinkedSpan<GazetteerEntry>> linkedSpans, String docText, Span[] sentenceSpans,
+                    EntityLinkerProperties properties, AdminBoundaryContext additionalContext) {
     for (LinkedSpan<GazetteerEntry> geospan : linkedSpans) {
       ArrayList<GazetteerEntry> linkedEntries = geospan.getLinkedEntries();
       for (GazetteerEntry gazetteerEntry : linkedEntries) {
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/PointClustering.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/PointClustering.java
index a8677e4..a49c1aa 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/PointClustering.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/PointClustering.java
@@ -58,8 +58,8 @@ public class PointClustering {
   }
 
   public void scoreClusters(Map<String, List<GazetteerEntry>> clusters) {
-    Double min = 0d;
-    Double max = -1d;
+    double min = 0d;
+    double max = -1d;
     for (String key : clusters.keySet()) {
       int size = clusters.get(key).size();
       if (size > max) {
@@ -84,8 +84,7 @@ public class PointClustering {
    * @return
    */
   public String geoHash(Double lat, Double lon) {
-    String encodeLatLon = GeohashUtils.encodeLatLon(lat, lon);
-    return encodeLatLon;
+    return GeohashUtils.encodeLatLon(lat, lon);
   }
 
   /**
@@ -97,8 +96,7 @@ public class PointClustering {
    */
   public double[] geoHashToPoint(String geohash) {
     Point decode = GeohashUtils.decode(geohash, SpatialContext.GEO);
-    double[] coords = new double[]{decode.getX(), decode.getY()};
-    return coords;
+    return new double[]{decode.getX(), decode.getY()};
   }
 
   /**
@@ -110,8 +108,7 @@ public class PointClustering {
    */
   public String geoHashToPointStr(String geohash) {
     Point decode = GeohashUtils.decode(geohash, SpatialContext.GEO);
-    String point = decode.getX() + "," + decode.getY();
-    return point;
+    return decode.getX() + "," + decode.getY();
   }
 
 
diff --git a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/ProvinceProximityScorer.java b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/ProvinceProximityScorer.java
index 27e9354..6badb60 100644
--- a/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/ProvinceProximityScorer.java
+++ b/geoentitylinker-addon/src/main/java/opennlp/addons/geoentitylinker/scoring/ProvinceProximityScorer.java
@@ -23,6 +23,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
 import java.util.regex.Pattern;
+
 import opennlp.addons.geoentitylinker.AdminBoundaryContext;
 import opennlp.addons.geoentitylinker.GazetteerEntry;
 import opennlp.tools.entitylinker.BaseLink;
@@ -37,17 +38,15 @@ import opennlp.tools.util.Span;
  * indicator of Connecticut, it is more likely to be Berlin Connecticut than
  * Berlin Germany (if Germany did not exist in, or is mentioned further away in
  * the article).
- *
- *
  */
-public class ProvinceProximityScorer implements LinkedEntityScorer<AdminBoundaryContext> {
+public class ProvinceProximityScorer implements LinkedEntityScorer<BaseLink, AdminBoundaryContext> {
 
   private Map<String, Set<String>> nameCodesMap;
   String dominantCode = "";
   private Map<String, String> regexMap = new HashMap<>();
 
   @Override
-  public void score(List<LinkedSpan> linkedSpans, String docText, Span[] sentenceSpans, EntityLinkerProperties properties, AdminBoundaryContext additionalContext) {
+  public void score(List<LinkedSpan<BaseLink>> linkedSpans, String docText, Span[] sentenceSpans, EntityLinkerProperties properties, AdminBoundaryContext additionalContext) {
     if (!additionalContext.getProvHits().isEmpty()) {
       regexMap = additionalContext.getProvinceRegexMap();
       score(linkedSpans, additionalContext.getProvMentions(), additionalContext.getNameCodesMap(), docText, sentenceSpans, 1000);
@@ -81,11 +80,10 @@ public class ProvinceProximityScorer implements LinkedEntityScorer<AdminBoundary
    * Named Entity.
    * @return
    */
-  public List<LinkedSpan> score(List<LinkedSpan> linkedData, Map<String, Set<Integer>> countryHits, Map<String, Set<String>> nameCodesMap, String docText, Span[] sentences, Integer maxAllowedDist) {
+  public List<LinkedSpan<BaseLink>> score(List<LinkedSpan<BaseLink>> linkedData, Map<String, Set<Integer>> countryHits, Map<String, Set<String>> nameCodesMap, String docText, Span[] sentences, Integer maxAllowedDist) {
     this.nameCodesMap = nameCodesMap;
     setDominantCode(countryHits);
     for (LinkedSpan<BaseLink> linkedspan : linkedData) {
-
       linkedspan = simpleProximityAnalysis(sentences, countryHits, linkedspan, maxAllowedDist);
     }
     return linkedData;
@@ -116,7 +114,8 @@ public class ProvinceProximityScorer implements LinkedEntityScorer<AdminBoundary
    * @param span
    * @return
    */
-  private LinkedSpan<BaseLink> simpleProximityAnalysis(Span[] sentences, Map<String, Set<Integer>> countryHits, LinkedSpan<BaseLink> span, Integer maxAllowedDistance) {
+  private LinkedSpan<BaseLink> simpleProximityAnalysis(Span[] sentences, Map<String, Set<Integer>> countryHits,
+                                                       LinkedSpan<BaseLink> span, Integer maxAllowedDistance) {
     Double score = 0.0;
     /*
      * get the index of the actual span, begining of sentence //should generate
@@ -125,14 +124,14 @@ public class ProvinceProximityScorer implements LinkedEntityScorer<AdminBoundary
      */
     int sentenceIdx = span.getSentenceid();
     int sentIndexInDoc = sentences[sentenceIdx].getStart();
-    /**
+    /*
      * create a map of all the span's proximal country mentions in the document
      * Map< countrycode, set of <distances from this NamedEntity>>
      */
     Map<String, Set<Integer>> distancesFromCodeMap = new HashMap<>();
     //map = Map<countrycode, Set <of distances this span is from all the mentions of the code>>
     for (String cCode : countryHits.keySet()) {
-//iterate over all the regex start values and calculate an offset
+      //iterate over all the regex start values and calculate an offset
       for (Integer cHit : countryHits.get(cCode)) {
         Integer absDist = Math.abs(sentIndexInDoc - cHit);
         //only include near mentions based on a heuristic
@@ -151,7 +150,7 @@ public class ProvinceProximityScorer implements LinkedEntityScorer<AdminBoundary
     }
     //we now know how far this named entity is from every country mention in the document
 
-    /**
+    /*
      * the gaz matches that have a country code that have mentions in the doc
      * that are closest to the Named Entity should return the best score.
      * Analyzemap generates a likelihood score that the toponym from the gaz is
@@ -209,7 +208,8 @@ public class ProvinceProximityScorer implements LinkedEntityScorer<AdminBoundary
    * @param span
    * @return
    */
-  private Map<String, Double> analyzeMap(Map<String, Set<Integer>> distanceMap, Span[] sentences, LinkedSpan<BaseLink> span) {
+  private Map<String, Double> analyzeMap(Map<String, Set<Integer>> distanceMap,
+                                         Span[] sentences, LinkedSpan<BaseLink> span) {
 
     Map<String, Double> scoreMap = new HashMap<>();
     if (distanceMap.isEmpty()) {
@@ -232,7 +232,7 @@ public class ProvinceProximityScorer implements LinkedEntityScorer<AdminBoundary
       for (Integer i : distanceMap.get(key)) {
         Double norm = normalize(i, min, max);
         //reverse the normed distance so low numbers (closer) are better
-        //this could be improved with a "decaying " function using an imcreaseing negative exponent
+        //this could be improved with a "decaying " function using an increasing negative exponent
         Double reverse = Math.abs(norm - 1);
         normalizedDistances.add(reverse);
       }
@@ -271,10 +271,9 @@ public class ProvinceProximityScorer implements LinkedEntityScorer<AdminBoundary
     for (double d : windowOfAverages) {
       sum += d;
     }
-    double result = sum / windowOfAverages.size();
     //TODO: ++ prob when large amounts of mentions for a code
     //System.out.println("avg of window:" + result);
-    return result;
+    return sum / windowOfAverages.size();
   }
 
   /**


(opennlp-addons) 03/04: corrects minor typo in README.md

Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 0895034220b3eb626dcd421e0118de83ac70b2fa
Author: Martin Wiesner <ma...@hs-heilbronn.de>
AuthorDate: Sat Jan 25 21:15:10 2025 +0100

    corrects minor typo in README.md
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index ca4c58d..975ff67 100644
--- a/README.md
+++ b/README.md
@@ -59,7 +59,7 @@ Currently, the library has different components:
 
 ## Getting Started
 
-You can import the addons components directly via Maven, SBT or Gradle after you have build it locally:
+You can import the addons components directly via Maven, SBT or Gradle after you have built it locally:
 
 #### Maven