Author: joern
Date: Fri Apr 17 10:21:00 2015
New Revision: 1674262

URL: http://svn.apache.org/r1674262
Log:
OPENNLP-767 Removed trailing white spaces on all lines

Modified:
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/ObjectStreamFactory.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/entitylinker/EntityLinkerTool.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderTrainerTool.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/ParserEvaluatorTool.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/doccat/DocumentSample.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/entitylinker/EntityLinker.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/formats/brat/AnnotationConfiguration.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratAnnotationStream.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratDocumentStream.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/BinaryGISModelReader.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/BinaryGISModelWriter.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/BinaryQNModelReader.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/BinaryQNModelWriter.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/GISModelReader.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/GISModelWriter.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/ObjectGISModelReader.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/ObjectGISModelWriter.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/ObjectQNModelReader.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/ObjectQNModelWriter.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/OldFormatGISModelReader.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/PlainTextGISModelReader.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/PlainTextGISModelWriter.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/PooledGISModelReader.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/QNModelReader.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/QNModelWriter.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/SuffixSensitiveGISModelReader.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/SuffixSensitiveGISModelWriter.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/ArrayMath.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/Function.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/LineSearch.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/NegLogLikelihood.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/ParallelNegLogLikelihood.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/QNMinimizer.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/QNModel.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/QNTrainer.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/namefind/NameFinderME.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinder.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinderFactory.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinderModel.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/parser/ParserChunkerFactory.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/parser/ParserEvaluator.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/parser/chunking/Parser.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/parser/lang/es/AncoraSpanishHeadRules.java
    opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSModel.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/sentdetect/SentenceDetectorME.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/sentdetect/lang/Factory.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/tokenize/DetokenizationDictionary.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/tokenize/SimpleTokenizer.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenizerFactory.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/ObjectStream.java
    opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/Span.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/BrownBigramFeatureGenerator.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/BrownCluster.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/BrownTokenClassFeatureGenerator.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/BrownTokenClasses.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/BrownTokenFeatureGenerator.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/GeneratorFactory.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/PreviousTwoMapFeatureGenerator.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/TrigramNameFeatureGenerator.java

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/ObjectStreamFactory.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/ObjectStreamFactory.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/ObjectStreamFactory.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/ObjectStreamFactory.java
 Fri Apr 17 10:21:00 2015
@@ -23,7 +23,7 @@ public interface ObjectStreamFactory<T>
 
   /**
    * Returns interface with parameters description.
-   * 
+   *
    * @param <P> interfaces which describes the parameters.
    *
    * @return interface with parameters description

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/entitylinker/EntityLinkerTool.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/entitylinker/EntityLinkerTool.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/entitylinker/EntityLinkerTool.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/entitylinker/EntityLinkerTool.java
 Fri Apr 17 10:21:00 2015
@@ -100,11 +100,11 @@ public class EntityLinkerTool extends Ba
             for (int i = 0; i < document.size(); i++) {
 
               NameSample sample = document.get(i);
-              
+
               namesBySentence[i] = sample.getNames();
-              
+
               int sentenceBegin = text.length();
-              
+
               Span[] tokens = new Span[sample.getSentence().length];
 
               // for all tokens
@@ -114,9 +114,9 @@ public class EntityLinkerTool extends Ba
                 text.append(" ");
                 tokens[ti] = new Span(tokenBegin, text.length());
               }
-              
+
               tokensBySentence[i] = tokens;
-              
+
               sentences[i] = new Span(sentenceBegin, text.length());
               text.append("\n");
             }

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderTrainerTool.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderTrainerTool.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderTrainerTool.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderTrainerTool.java
 Fri Apr 17 10:21:00 2015
@@ -126,7 +126,7 @@ public final class TokenNameFinderTraine
       }
 
       File resourceFiles[] = resourcePath.listFiles();
-      
+
       for (File resourceFile : resourceFiles) {
         String resourceName = resourceFile.getName();
         //gettting the serializer key from the element tag name

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/ParserEvaluatorTool.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/ParserEvaluatorTool.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/ParserEvaluatorTool.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/parser/ParserEvaluatorTool.java
 Fri Apr 17 10:21:00 2015
@@ -33,7 +33,7 @@ public class ParserEvaluatorTool extends
   public ParserEvaluatorTool() {
     super(Parse.class, EvaluatorParams.class);
   }
-  
+
   public String getShortDescription() {
     return "Measures the performance of the Parser model with the reference 
data";
   }

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/doccat/DocumentSample.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/doccat/DocumentSample.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/doccat/DocumentSample.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/doccat/DocumentSample.java
 Fri Apr 17 10:21:00 2015
@@ -69,7 +69,7 @@ public class DocumentSample {
     return text.toArray(new String[text.size()]);
   }
 
-  public Map<String, Object> getExtraInformation() {  
+  public Map<String, Object> getExtraInformation() {
     return extraInformation;
   }
 
@@ -88,10 +88,10 @@ public class DocumentSample {
       // remove last space
       sampleString.setLength(sampleString.length() - 1);
     }
-    
+
     return sampleString.toString();
   }
-  
+
   @Override
   public boolean equals(Object obj) {
     if (this == obj) {

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/entitylinker/EntityLinker.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/entitylinker/EntityLinker.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/entitylinker/EntityLinker.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/entitylinker/EntityLinker.java
 Fri Apr 17 10:21:00 2015
@@ -62,7 +62,7 @@ public interface EntityLinker<T extends
    *                         same sentence.Similar in nature to
    *                         Map&lt;SentenceIndex,List&lt;Name Spans For This
    *                         Sentence's Tokens&gt;&gt; @ return
-   * @return 
+   * @return
    */
   List<T> find(String doctext, Span[] sentences, Span[][] tokensBySentence, 
Span[][] namesBySentence);
 

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/formats/brat/AnnotationConfiguration.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/formats/brat/AnnotationConfiguration.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/formats/brat/AnnotationConfiguration.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/formats/brat/AnnotationConfiguration.java
 Fri Apr 17 10:21:00 2015
@@ -66,7 +66,7 @@ public class AnnotationConfiguration {
         sectionType = line.substring(line.indexOf('[') + 1, line.indexOf(']'));
       }
       else {
-        
+
         switch (sectionType) {
         case "entities":
           typeToClassMap.put(line, AnnotationConfiguration.ENTITY_TYPE);
@@ -75,11 +75,11 @@ public class AnnotationConfiguration {
         case "relations":
           typeToClassMap.put(line.substring(0, line.indexOf(' ')), 
AnnotationConfiguration.RELATION_TYPE);
           break;
-          
+
         case "attributes":
           typeToClassMap.put(line.substring(0, line.indexOf(' ')), 
AnnotationConfiguration.ATTRIBUTE_TYPE);
           break;
-          
+
         default:
           break;
         }

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratAnnotationStream.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratAnnotationStream.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratAnnotationStream.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratAnnotationStream.java
 Fri Apr 17 10:21:00 2015
@@ -116,21 +116,21 @@ public class BratAnnotationStream implem
   }
 
   static class AttributeAnnotationParser extends BratAnnotationParser {
-    
+
     private static final int ATTACHED_TO_OFFSET = 2;
     private static final int VALUE_OFFSET = 3;
-    
+
     @Override
     BratAnnotation parse(Span[] values, CharSequence line) throws IOException {
-      
+
       if (values.length == 3 || values.length == 4) {
-        
+
         String value = null;
-        
+
         if (values.length == 4) {
           value = values[VALUE_OFFSET].getCoveredText(line).toString();
         }
-        
+
         return new 
AttributeAnnotation(values[ID_OFFSET].getCoveredText(line).toString(),
             values[TYPE_OFFSET].getCoveredText(line).toString(),
             values[ATTACHED_TO_OFFSET].getCoveredText(line).toString(), value);
@@ -140,7 +140,7 @@ public class BratAnnotationStream implem
       }
     }
   }
-  
+
   private final Map<String, BratAnnotationParser> parsers =
       new HashMap<String, BratAnnotationParser>();
   private final AnnotationConfiguration config;

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratDocumentStream.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratDocumentStream.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratDocumentStream.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/formats/brat/BratDocumentStream.java
 Fri Apr 17 10:21:00 2015
@@ -39,12 +39,12 @@ public class BratDocumentStream implemen
   /**
    * Creates a BratDocumentStream which reads the documents from the given 
input directory.
    *
-   * @param config the annotation.conf from the brat project as an Annotation 
Configuration object 
+   * @param config the annotation.conf from the brat project as an Annotation 
Configuration object
    * @param bratCorpusDirectory the directory containing all the brat training 
data files
    * @param searchRecursive specifies if the corpus directory should be 
traversed recursively
    * to find training data files.
    * @param fileFilter  a custom file filter to filter out certain files or 
null to accept all files
-   * 
+   *
    * @throws IOException if reading from the brat directory fails in anyway
    */
   public BratDocumentStream(AnnotationConfiguration config, File 
bratCorpusDirectory,

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/BinaryGISModelReader.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/BinaryGISModelReader.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/BinaryGISModelReader.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/BinaryGISModelReader.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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
@@ -31,7 +31,7 @@ public class BinaryGISModelReader extend
   /**
    * Constructor which directly instantiates the DataInputStream containing the
    * model contents.
-   * 
+   *
    * @param dis
    *          The DataInputStream containing the model information.
    */

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/BinaryGISModelWriter.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/BinaryGISModelWriter.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/BinaryGISModelWriter.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/BinaryGISModelWriter.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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
@@ -37,7 +37,7 @@ public class BinaryGISModelWriter extend
    * Constructor which takes a GISModel and a File and prepares itself to write
    * the model to that file. Detects whether the file is gzipped or not based 
on
    * whether the suffix contains ".gz".
-   * 
+   *
    * @param model
    *          The GISModel which is to be persisted.
    * @param f
@@ -58,7 +58,7 @@ public class BinaryGISModelWriter extend
   /**
    * Constructor which takes a GISModel and a DataOutputStream and prepares
    * itself to write the model to that stream.
-   * 
+   *
    * @param model
    *          The GISModel which is to be persisted.
    * @param dos

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/BinaryQNModelReader.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/BinaryQNModelReader.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/BinaryQNModelReader.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/BinaryQNModelReader.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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
@@ -30,7 +30,7 @@ public class BinaryQNModelReader extends
   /**
    * Constructor which directly instantiates the DataInputStream containing the
    * model contents.
-   * 
+   *
    * @param dis
    *          The DataInputStream containing the model information.
    */

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/BinaryQNModelWriter.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/BinaryQNModelWriter.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/BinaryQNModelWriter.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/BinaryQNModelWriter.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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
@@ -33,7 +33,7 @@ public class BinaryQNModelWriter extends
    * Constructor which takes a GISModel and a File and prepares itself to write
    * the model to that file. Detects whether the file is gzipped or not based 
on
    * whether the suffix contains ".gz".
-   * 
+   *
    * @param model
    *          The GISModel which is to be persisted.
    * @param f
@@ -54,7 +54,7 @@ public class BinaryQNModelWriter extends
   /**
    * Constructor which takes a GISModel and a DataOutputStream and prepares
    * itself to write the model to that stream.
-   * 
+   *
    * @param model
    *          The GISModel which is to be persisted.
    * @param dos

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/GISModelReader.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/GISModelReader.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/GISModelReader.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/GISModelReader.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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
@@ -44,7 +44,7 @@ public class GISModelReader extends Abst
   /**
    * Retrieve a model from disk. It assumes that models are saved in the
    * following sequence:
-   * 
+   *
    * <br>
    * GIS (model type identifier) <br>
    * 1. # of parameters (int) <br>
@@ -57,15 +57,15 @@ public class GISModelReader extends Abst
    * [# of predicates for which outcome pattern is true] [outcome pattern] <br>
    * 6. # of predicates (int) <br>
    * * list of predicate names (String)
-   * 
+   *
    * <p>
    * If you are creating a reader for a format which won't work with this
    * (perhaps a database or xml file), override this method and ignore the 
other
    * methods provided in this abstract class.
-   * 
+   *
    * @return The GISModel stored in the format and location specified to this
    *         GISModelReader (usually via its the constructor).
-   */  
+   */
   public AbstractModel constructModel() throws IOException {
     int correctionConstant = getCorrectionConstant();
     double correctionParam = getCorrectionParameter();
@@ -84,7 +84,7 @@ public class GISModelReader extends Abst
       System.out.println("Error: attempting to load a " + modelType
           + " model as a GIS model." + " You should expect problems.");
   }
-    
+
   protected int getCorrectionConstant() throws java.io.IOException {
     return readInt();
   }

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/GISModelWriter.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/GISModelWriter.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/GISModelWriter.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/GISModelWriter.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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
@@ -60,7 +60,7 @@ public abstract class GISModelWriter ext
   /**
    * Writes the model to disk, using the <code>writeX()</code> methods provided
    * by extending classes.
-   * 
+   *
    * <p>
    * If you wish to create a GISModelWriter which uses a different structure, 
it
    * will be necessary to override the persist method in addition to
@@ -125,7 +125,7 @@ public abstract class GISModelWriter ext
       numParams += numActive;
       /*
        * double[] activeParams = new double[numActive];
-       * 
+       *
        * int id = 0; for (int i=0; i < predkeys.length; i++) { int oid =
        * predkeys[i]; activeOutcomes[id] = oid; activeParams[id] =
        * PARAMS[pid].getParams(oid); id++; }

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/ObjectGISModelReader.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/ObjectGISModelReader.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/ObjectGISModelReader.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/ObjectGISModelReader.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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
@@ -30,7 +30,7 @@ public class ObjectGISModelReader extend
   /**
    * Constructor which directly instantiates the ObjectInputStream containing
    * the model contents.
-   * 
+   *
    * @param ois The DataInputStream containing the model information.
    */
 

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/ObjectGISModelWriter.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/ObjectGISModelWriter.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/ObjectGISModelWriter.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/ObjectGISModelWriter.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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
@@ -27,7 +27,7 @@ import opennlp.tools.ml.model.AbstractMo
 public class ObjectGISModelWriter extends GISModelWriter {
 
   protected ObjectOutputStream output;
-  
+
   /**
    * Constructor which takes a GISModel and a ObjectOutputStream and prepares
    * itself to write the model to that stream.

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/ObjectQNModelReader.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/ObjectQNModelReader.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/ObjectQNModelReader.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/ObjectQNModelReader.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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
@@ -23,7 +23,7 @@ import java.io.ObjectInputStream;
 import opennlp.tools.ml.model.ObjectDataReader;
 
 public class ObjectQNModelReader extends QNModelReader {
-       
+
   public ObjectQNModelReader(ObjectInputStream ois) {
     super(new ObjectDataReader(ois));
   }

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/ObjectQNModelWriter.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/ObjectQNModelWriter.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/ObjectQNModelWriter.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/ObjectQNModelWriter.java
 Fri Apr 17 10:21:00 2015
@@ -8,9 +8,9 @@ package opennlp.tools.ml.maxent.io;
  * 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
@@ -26,7 +26,7 @@ import opennlp.tools.ml.model.AbstractMo
 public class ObjectQNModelWriter extends QNModelWriter {
 
   protected ObjectOutputStream output;
-  
+
   /**
    * Constructor which takes a GISModel and a ObjectOutputStream and prepares
    * itself to write the model to that stream.

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/OldFormatGISModelReader.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/OldFormatGISModelReader.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/OldFormatGISModelReader.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/OldFormatGISModelReader.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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
@@ -49,7 +49,7 @@ public class OldFormatGISModelReader ext
 
   /**
    * Reads the parameters from a file and populates an array of context 
objects.
-   * 
+   *
    * @param outcomePatterns
    *          The outcomes patterns for the model. The first index refers to
    *          which outcome pattern (a set of outcomes that occurs with a
@@ -86,11 +86,11 @@ public class OldFormatGISModelReader ext
 
   /**
    * Convert a model created with Maxent 1.0 to a format used with Maxent 1.2.
-   * 
+   *
    * <p>
    * Usage: java opennlp.tools.ml.maxent.io.OldFormatGISModelReader 
model_name_prefix
    * (new_model_name)");
-   * 
+   *
    * <p>
    * If the new_model_name is left unspecified, the new model will be saved in
    * gzipped, binary format as "&lt;model_name_prefix&gt;.bin.gz".

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/PlainTextGISModelReader.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/PlainTextGISModelReader.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/PlainTextGISModelReader.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/PlainTextGISModelReader.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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
@@ -33,7 +33,7 @@ public class PlainTextGISModelReader ext
   /**
    * Constructor which directly instantiates the BufferedReader containing the
    * model contents.
-   * 
+   *
    * @param br
    *          The BufferedReader containing the model information.
    */
@@ -44,7 +44,7 @@ public class PlainTextGISModelReader ext
   /**
    * Constructor which takes a File and creates a reader for it. Detects 
whether
    * the file is gzipped or not based on whether the suffix contains ".gz".
-   * 
+   *
    * @param f
    *          The File in which the model is stored.
    */

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/PlainTextGISModelWriter.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/PlainTextGISModelWriter.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/PlainTextGISModelWriter.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/PlainTextGISModelWriter.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/PooledGISModelReader.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/PooledGISModelReader.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/PooledGISModelReader.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/PooledGISModelReader.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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
@@ -23,7 +23,7 @@ import java.io.File;
 import java.io.IOException;
 
 /**
- * This class works exactly like the SuffisSensitiveGISModelReader except that 
it 
+ * This class works exactly like the SuffisSensitiveGISModelReader except that 
it
  * attempts to pool all context strings.  This is useful when loading models 
which
  * share many context strings.
  *
@@ -40,7 +40,7 @@ public class PooledGISModelReader extend
    *    <li>.txt --&gt; the file is plain text</li>
    *    <li>.bin --&gt; the file is binary</li>
    * </ul>
-   * 
+   *
    * @param f
    * @throws IOException
    */

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/QNModelReader.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/QNModelReader.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/QNModelReader.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/QNModelReader.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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
@@ -29,11 +29,11 @@ public class QNModelReader extends GISMo
   public QNModelReader(DataReader dataReader) {
     super(dataReader);
   }
-  
+
   public QNModelReader(File file) throws IOException {
     super(file);
   }
-  
+
   @Override
   public void checkModelType() throws IOException {
     String modelType = readUTF();

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/QNModelWriter.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/QNModelWriter.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/QNModelWriter.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/QNModelWriter.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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
@@ -25,7 +25,7 @@ import opennlp.tools.ml.model.AbstractMo
 import opennlp.tools.ml.model.ComparablePredicate;
 
 public abstract class QNModelWriter extends GISModelWriter {
-  
+
   public QNModelWriter(AbstractModel model) {
     super(model);
   }
@@ -34,37 +34,37 @@ public abstract class QNModelWriter exte
   public void persist() throws IOException {
     // the type of model (QN)
     writeUTF("QN");
-  
+
     // the mapping from outcomes to their integer indexes
     writeInt(OUTCOME_LABELS.length);
-  
+
     for (int i = 0; i < OUTCOME_LABELS.length; i++)
       writeUTF(OUTCOME_LABELS[i]);
-  
+
     // the mapping from predicates to the outcomes they contributed to.
     // The sorting is done so that we actually can write this out more
     // compactly than as the entire list.
     ComparablePredicate[] sorted = sortValues();
     List<List<ComparablePredicate>> compressed = compressOutcomes(sorted);
-  
+
     writeInt(compressed.size());
-  
+
     for (int i = 0; i < compressed.size(); i++) {
       List<ComparablePredicate> a = compressed.get(i);
       writeUTF(a.size() + a.get(0).toString());
     }
-  
+
     // the mapping from predicate names to their integer indexes
     writeInt(PARAMS.length);
-  
+
     for (int i = 0; i < sorted.length; i++)
       writeUTF(sorted[i].name);
-  
+
     // write out the parameters
     for (int i = 0; i < sorted.length; i++)
       for (int j = 0; j < sorted[i].params.length; j++)
         writeDouble(sorted[i].params[j]);
-  
+
     close();
   }
 }

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/SuffixSensitiveGISModelReader.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/SuffixSensitiveGISModelReader.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/SuffixSensitiveGISModelReader.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/SuffixSensitiveGISModelReader.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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
@@ -41,14 +41,14 @@ public class SuffixSensitiveGISModelRead
   /**
    * Constructor which takes a File and invokes the GISModelReader appropriate
    * for the suffix.
-   * 
+   *
    * @param f
    *          The File in which the model is stored.
    */
   public SuffixSensitiveGISModelReader(File f) throws IOException {
     super(f);
   }
-    
+
   // activate this if adding another type of reader which can't read model
   // information in the way that the default getModel() method in
   // GISModelReader does.
@@ -58,18 +58,18 @@ public class SuffixSensitiveGISModelRead
 
   /**
    * To convert between different formats of the new style.
-   * 
+   *
    * <p>
    * java opennlp.tools.ml.maxent.io.SuffixSensitiveGISModelReader 
old_model_name
    * new_model_name
-   * 
+   *
    * <p>
    * For example, to convert a model called "model.bin.gz" (which is thus saved
    * in gzipped binary format) to one in (unzipped) text format:
-   * 
+   *
    * <p>
    * java opennlp.tools.ml.maxent.io.SuffixSensitiveGISModelReader 
model.bin.gz model.txt
-   * 
+   *
    * <p>
    * This particular example would of course be useful when you generally want
    * to create models which take up less space (.bin.gz), but want to be able 
to

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/SuffixSensitiveGISModelWriter.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/SuffixSensitiveGISModelWriter.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/SuffixSensitiveGISModelWriter.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/io/SuffixSensitiveGISModelWriter.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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
@@ -78,7 +78,7 @@ public class SuffixSensitiveGISModelWrit
       suffixAppropriateWriter =
         new PlainTextGISModelWriter(model,
             new BufferedWriter(new OutputStreamWriter(output)));
-    }    
+    }
   }
 
   public void writeUTF (String s) throws java.io.IOException {

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/ArrayMath.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/ArrayMath.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/ArrayMath.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/ArrayMath.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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
@@ -35,7 +35,7 @@ public class ArrayMath {
     }
     return product;
   }
-  
+
   /**
    * L1-norm
    */
@@ -45,25 +45,25 @@ public class ArrayMath {
       norm += Math.abs(v[i]);
     return norm;
   }
-  
+
   /**
-   * L2-norm 
+   * L2-norm
    */
   public static double l2norm(double[] v) {
     return Math.sqrt(innerProduct(v, v));
   }
-  
+
   /**
    * Inverse L2-norm
    */
   public static double invL2norm(double[] v) {
     return 1 / l2norm(v);
   }
-  
+
   /**
-   * Computes \log(\sum_{i=1}^n e^{x_i}) using a maximum-element trick 
+   * Computes \log(\sum_{i=1}^n e^{x_i}) using a maximum-element trick
    * to avoid arithmetic overflow.
-   * 
+   *
    * @param x input vector
    * @return log-sum of exponentials of vector elements
    */
@@ -92,7 +92,7 @@ public class ArrayMath {
     if (x == null || x.length == 0) {
       throw new IllegalArgumentException("Vector x is null or empty");
     }
-    
+
     int maxIdx = 0;
     for (int i = 1; i < x.length; i++) {
       if (x[maxIdx] < x[i])
@@ -100,10 +100,10 @@ public class ArrayMath {
     }
     return maxIdx;
   }
-  
+
   // === Not really related to math ===
   /**
-   * Convert a list of Double objects into an array of primitive doubles 
+   * Convert a list of Double objects into an array of primitive doubles
    */
   public static double[] toDoubleArray(List<Double> list) {
     double[] arr = new double[list.size()];
@@ -112,13 +112,13 @@ public class ArrayMath {
     }
     return arr;
   }
-  
+
   /**
    *  Convert a list of Integer objects into an array of primitive integers
    */
   public static int[] toIntArray(List<Integer> list) {
     int[] arr = new int[list.size()];
-    for (int i = 0; i < arr.length; i++) { 
+    for (int i = 0; i < arr.length; i++) {
       arr[i] = list.get(i);
     }
     return arr;

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/Function.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/Function.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/Function.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/Function.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/LineSearch.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/LineSearch.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/LineSearch.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/LineSearch.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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
@@ -28,8 +28,8 @@ public class LineSearch {
   /**
    * Backtracking line search (see Nocedal &amp; Wright 2006, Numerical 
Optimization, p. 37)
    */
-  public static void doLineSearch(Function function, 
-      double[] direction, LineSearchResult lsr, double initialStepSize) 
+  public static void doLineSearch(Function function,
+      double[] direction, LineSearchResult lsr, double initialStepSize)
   {
     double stepSize      = initialStepSize;
     int currFctEvalCount = lsr.getFctEvalCount();
@@ -37,7 +37,7 @@ public class LineSearch {
     double[] gradAtX     = lsr.getGradAtNext();
     double valueAtX      = lsr.getValueAtNext();
     int dimension        = x.length;
-    
+
     // Retrieve current points and gradient for array reuse purpose
     double[] nextPoint       = lsr.getCurrPoint();
     double[] gradAtNextPoint = lsr.getGradAtCurr();
@@ -47,16 +47,16 @@ public class LineSearch {
 
     // To avoid recomputing in the loop
     double cachedProd = C * dirGradientAtX;
-    
+
     while (true) {
       // Get next point
       for (int i = 0; i < dimension; i++) {
         nextPoint[i] = x[i] + direction[i] * stepSize;
       }
-      
+
       // New value
       valueAtNextPoint = function.valueAt(nextPoint);
-      
+
       currFctEvalCount++;
 
       // Check Armijo condition
@@ -68,20 +68,20 @@ public class LineSearch {
     }
 
     // Compute and save gradient at the new point
-    System.arraycopy(function.gradientAt(nextPoint), 0, gradAtNextPoint, 0, 
+    System.arraycopy(function.gradientAt(nextPoint), 0, gradAtNextPoint, 0,
         gradAtNextPoint.length);
-    
+
     // Update line search result
-    lsr.setAll(stepSize, valueAtX, valueAtNextPoint, 
-        gradAtX, gradAtNextPoint, x, nextPoint, currFctEvalCount);    
+    lsr.setAll(stepSize, valueAtX, valueAtNextPoint,
+        gradAtX, gradAtNextPoint, x, nextPoint, currFctEvalCount);
   }
 
   /**
-   * Constrained line search (see section 3.2 in the paper "Scalable Training 
+   * Constrained line search (see section 3.2 in the paper "Scalable Training
    * of L1-Regularized Log-Linear Models", Andrew et al. 2007)
    */
-  public static void doConstrainedLineSearch(Function function, 
-      double[] direction, LineSearchResult lsr, double l1Cost, double 
initialStepSize) 
+  public static void doConstrainedLineSearch(Function function,
+      double[] direction, LineSearchResult lsr, double l1Cost, double 
initialStepSize)
   {
     double stepSize        = initialStepSize;
     int currFctEvalCount   = lsr.getFctEvalCount();
@@ -96,37 +96,37 @@ public class LineSearch {
     double[] nextPoint       = lsr.getCurrPoint();
     double[] gradAtNextPoint = lsr.getGradAtCurr();
     double valueAtNextPoint;
-    
+
     double dirGradientAtX;
-    
-    // New sign vector 
+
+    // New sign vector
     for (int i = 0; i < dimension; i++) {
       signX[i] = x[i] == 0? -pseudoGradAtX[i] : x[i];
     }
-    
+
     while (true) {
       // Get next point
       for (int i = 0; i < dimension; i++) {
         nextPoint[i] = x[i] + direction[i] * stepSize;
       }
-      
+
       // Projection
       for (int i = 0; i < dimension; i++) {
-        if (nextPoint[i] * signX[i] <= 0) 
+        if (nextPoint[i] * signX[i] <= 0)
           nextPoint[i] = 0;
       }
 
       // New value
-      valueAtNextPoint = function.valueAt(nextPoint) + 
+      valueAtNextPoint = function.valueAt(nextPoint) +
           l1Cost * ArrayMath.l1norm(nextPoint);
-      
+
       currFctEvalCount++;
 
       dirGradientAtX = 0;
       for (int i = 0; i < dimension; i++) {
         dirGradientAtX += (nextPoint[i] - x[i]) * pseudoGradAtX[i];
       }
-      
+
       // Check the sufficient decrease condition
       if (valueAtNextPoint <= valueAtX + C * dirGradientAtX)
         break;
@@ -136,21 +136,21 @@ public class LineSearch {
     }
 
     // Compute and save gradient at the new point
-    System.arraycopy(function.gradientAt(nextPoint), 0, gradAtNextPoint, 0, 
+    System.arraycopy(function.gradientAt(nextPoint), 0, gradAtNextPoint, 0,
         gradAtNextPoint.length);
-    
+
     // Update line search result
     lsr.setAll(stepSize, valueAtX, valueAtNextPoint, gradAtX,
-        gradAtNextPoint, pseudoGradAtX, x, nextPoint, signX, 
currFctEvalCount);      
+        gradAtNextPoint, pseudoGradAtX, x, nextPoint, signX, currFctEvalCount);
   }
-  
+
   // 
-------------------------------------------------------------------------------------
 //
-  
+
   /**
    * Class to store lineSearch result
    */
   public static class LineSearchResult {
-    
+
     private int fctEvalCount;
     private double stepSize;
     private double valueAtCurr;
@@ -166,16 +166,16 @@ public class LineSearch {
      * Constructor
      */
     public LineSearchResult(
-        double stepSize, 
-        double valueAtCurr, 
-        double valueAtNext, 
-        double[] gradAtCurr, 
-        double[] gradAtNext, 
-        double[] currPoint, 
-        double[] nextPoint, 
-        int fctEvalCount) 
+        double stepSize,
+        double valueAtCurr,
+        double valueAtNext,
+        double[] gradAtCurr,
+        double[] gradAtNext,
+        double[] currPoint,
+        double[] nextPoint,
+        int fctEvalCount)
     {
-      setAll(stepSize, valueAtCurr, valueAtNext, gradAtCurr, gradAtNext, 
+      setAll(stepSize, valueAtCurr, valueAtNext, gradAtCurr, gradAtNext,
         currPoint, nextPoint, fctEvalCount);
     }
 
@@ -183,18 +183,18 @@ public class LineSearch {
      * Constructor with sign vector
      */
     public LineSearchResult(
-        double stepSize, 
-        double valueAtCurr, 
-        double valueAtNext, 
-        double[] gradAtCurr, 
+        double stepSize,
+        double valueAtCurr,
+        double valueAtNext,
+        double[] gradAtCurr,
         double[] gradAtNext,
         double[] pseudoGradAtNext,
-        double[] currPoint, 
-        double[] nextPoint, 
-        double[] signVector, 
-        int fctEvalCount) 
+        double[] currPoint,
+        double[] nextPoint,
+        double[] signVector,
+        int fctEvalCount)
     {
-      setAll(stepSize, valueAtCurr, valueAtNext, gradAtCurr, gradAtNext, 
+      setAll(stepSize, valueAtCurr, valueAtNext, gradAtCurr, gradAtNext,
         pseudoGradAtNext, currPoint, nextPoint, signVector, fctEvalCount);
     }
 
@@ -202,16 +202,16 @@ public class LineSearch {
      * Update line search elements
      */
     public void setAll(
-        double stepSize, 
-        double valueAtCurr, 
-        double valueAtNext, 
-        double[] gradAtCurr, 
-        double[] gradAtNext, 
-        double[] currPoint, 
-        double[] nextPoint, 
-        int fctEvalCount) 
+        double stepSize,
+        double valueAtCurr,
+        double valueAtNext,
+        double[] gradAtCurr,
+        double[] gradAtNext,
+        double[] currPoint,
+        double[] nextPoint,
+        int fctEvalCount)
     {
-      setAll(stepSize, valueAtCurr, valueAtNext, gradAtCurr, gradAtNext, 
+      setAll(stepSize, valueAtCurr, valueAtNext, gradAtCurr, gradAtNext,
           null, currPoint, nextPoint, null, fctEvalCount);
     }
 
@@ -219,16 +219,16 @@ public class LineSearch {
      * Update line search elements
      */
     public void setAll(
-        double stepSize, 
-        double valueAtCurr, 
-        double valueAtNext, 
-        double[] gradAtCurr, 
+        double stepSize,
+        double valueAtCurr,
+        double valueAtNext,
+        double[] gradAtCurr,
         double[] gradAtNext,
         double[] pseudoGradAtNext,
-        double[] currPoint, 
-        double[] nextPoint, 
-        double[] signVector, 
-        int fctEvalCount) 
+        double[] currPoint,
+        double[] nextPoint,
+        double[] signVector,
+        int fctEvalCount)
     {
       this.stepSize         = stepSize;
       this.valueAtCurr      = valueAtCurr;
@@ -241,46 +241,46 @@ public class LineSearch {
       this.signVector       = signVector;
       this.fctEvalCount     = fctEvalCount;
     }
-    
+
     public double getFuncChangeRate() {
       return (valueAtCurr - valueAtNext) / valueAtCurr;
     }
-    
+
     public double getStepSize() {
       return stepSize;
     }
     public void setStepSize(double stepSize) {
       this.stepSize = stepSize;
     }
-    
+
     public double getValueAtCurr() {
       return valueAtCurr;
     }
     public void setValueAtCurr(double valueAtCurr) {
       this.valueAtCurr = valueAtCurr;
     }
-    
+
     public double getValueAtNext() {
       return valueAtNext;
     }
     public void setValueAtNext(double valueAtNext) {
       this.valueAtNext = valueAtNext;
     }
-    
+
     public double[] getGradAtCurr() {
       return gradAtCurr;
     }
     public void setGradAtCurr(double[] gradAtCurr) {
       this.gradAtCurr = gradAtCurr;
     }
-    
+
     public double[] getGradAtNext() {
       return gradAtNext;
     }
     public void setGradAtNext(double[] gradAtNext) {
       this.gradAtNext = gradAtNext;
     }
-    
+
     public double[] getPseudoGradAtNext() {
       return pseudoGradAtNext;
     }
@@ -294,14 +294,14 @@ public class LineSearch {
     public void setCurrPoint(double[] currPoint) {
       this.currPoint = currPoint;
     }
-    
+
     public double[] getNextPoint() {
       return nextPoint;
     }
     public void setNextPoint(double[] nextPoint) {
       this.nextPoint = nextPoint;
     }
-    
+
     public double[] getSignVector() {
       return signVector;
     }
@@ -315,39 +315,39 @@ public class LineSearch {
     public void setFctEvalCount(int fctEvalCount) {
       this.fctEvalCount = fctEvalCount;
     }
-    
+
     /**
-     * Initial linear search object 
+     * Initial linear search object
      */
     public static LineSearchResult getInitialObject(
-        double valueAtX, 
+        double valueAtX,
         double[] gradAtX,
-        double[] x) 
+        double[] x)
     {
       return getInitialObject(valueAtX, gradAtX, null, x, null, 0);
     }
-    
+
     /**
      * Initial linear search object for L1-regularization
      */
     public static LineSearchResult getInitialObjectForL1(
-        double valueAtX, 
+        double valueAtX,
         double[] gradAtX,
-        double[] pseudoGradAtX, 
-        double[] x) 
+        double[] pseudoGradAtX,
+        double[] x)
     {
       return getInitialObject(valueAtX, gradAtX, pseudoGradAtX, x, new 
double[x.length], 0);
     }
-    
+
     public static LineSearchResult getInitialObject(
-        double valueAtX, 
+        double valueAtX,
         double[] gradAtX,
         double[] pseudoGradAtX,
-        double[] x, 
-        double[] signX, 
-        int fctEvalCount) 
+        double[] x,
+        double[] signX,
+        int fctEvalCount)
     {
-      return new LineSearchResult(0.0, 0.0, valueAtX, new double[x.length], 
gradAtX, 
+      return new LineSearchResult(0.0, 0.0, valueAtX, new double[x.length], 
gradAtX,
           pseudoGradAtX, new double[x.length], x, signX, fctEvalCount);
     }
   }

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/NegLogLikelihood.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/NegLogLikelihood.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/NegLogLikelihood.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/NegLogLikelihood.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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
@@ -27,7 +27,7 @@ import opennlp.tools.ml.model.OnePassRea
  * Evaluate negative log-likelihood and its gradient from DataIndexer.
  */
 public class NegLogLikelihood implements Function {
-  
+
   protected int dimension;
   protected int numOutcomes;
   protected int numFeatures;
@@ -39,14 +39,14 @@ public class NegLogLikelihood implements
   protected final int[] outcomeList;
   protected final int[] numTimesEventsSeen;
 
-  // For calculating negLogLikelihood and gradient 
+  // For calculating negLogLikelihood and gradient
   protected double[] tempSums;
   protected double[] expectation;
-  
+
   protected double[] gradient;
-  
+
   public NegLogLikelihood(DataIndexer indexer) {
-    
+
     // Get data from indexer.
     if (indexer instanceof OnePassRealValueDataIndexer) {
       this.values = indexer.getValues();
@@ -62,7 +62,7 @@ public class NegLogLikelihood implements
     this.numFeatures = indexer.getPredLabels().length;
     this.numContexts = this.contexts.length;
     this.dimension   = numOutcomes * numFeatures;
-    
+
     this.expectation = new double[numOutcomes];
     this.tempSums    = new double[numOutcomes];
     this.gradient    = new double[dimension];
@@ -80,7 +80,7 @@ public class NegLogLikelihood implements
    * Negative log-likelihood
    */
   public double valueAt(double[] x) {
-    
+
     if (x.length != dimension)
       throw new IllegalArgumentException(
           "x is invalid, its dimension is not equal to domain dimension.");
@@ -88,7 +88,7 @@ public class NegLogLikelihood implements
     int ci, oi, ai, vectorIndex, outcome;
     double predValue, logSumOfExps;
     double negLogLikelihood = 0;
-    
+
     for (ci = 0; ci < numContexts; ci++) {
       for (oi = 0; oi < numOutcomes; oi++) {
         tempSums[oi] = 0;
@@ -98,32 +98,32 @@ public class NegLogLikelihood implements
           tempSums[oi] += predValue * x[vectorIndex];
         }
       }
-      
+
       logSumOfExps = ArrayMath.logSumOfExps(tempSums);
-      
+
       outcome = outcomeList[ci];
       negLogLikelihood -= (tempSums[outcome] - logSumOfExps) * 
numTimesEventsSeen[ci];
     }
-    
+
     return negLogLikelihood;
-  }  
-  
+  }
+
   /**
    * Compute gradient
    */
   public double[] gradientAt(double[] x) {
-    
+
     if (x.length != dimension)
       throw new IllegalArgumentException(
           "x is invalid, its dimension is not equal to the function.");
-    
+
     int ci, oi, ai, vectorIndex;
     double predValue, logSumOfExps;
     int empirical;
-    
+
     // Reset gradient
     Arrays.fill(gradient, 0);
-    
+
     for (ci = 0; ci < numContexts; ci++) {
       for (oi = 0; oi < numOutcomes; oi++) {
         expectation[oi] = 0;
@@ -133,27 +133,27 @@ public class NegLogLikelihood implements
           expectation[oi] += predValue * x[vectorIndex];
         }
       }
-      
+
       logSumOfExps = ArrayMath.logSumOfExps(expectation);
-      
+
       for (oi = 0; oi < numOutcomes; oi++) {
         expectation[oi] = Math.exp(expectation[oi] - logSumOfExps);
       }
-      
+
       for (oi = 0; oi < numOutcomes; oi++) {
         empirical = outcomeList[ci] == oi? 1 : 0;
         for (ai = 0; ai < contexts[ci].length; ai++) {
           vectorIndex = indexOf(oi, contexts[ci][ai]);
           predValue = values != null? values[ci][ai] : 1.0;
-          gradient[vectorIndex] += 
+          gradient[vectorIndex] +=
               predValue * (expectation[oi] - empirical) * 
numTimesEventsSeen[ci];
         }
       }
     }
-    
+
     return gradient;
   }
-  
+
   protected int indexOf(int outcomeId, int featureId) {
     return outcomeId * numFeatures + featureId;
   }

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/ParallelNegLogLikelihood.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/ParallelNegLogLikelihood.java?rev=1674262&r1=1674261&r2=1674262&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/ParallelNegLogLikelihood.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/ml/maxent/quasinewton/ParallelNegLogLikelihood.java
 Fri Apr 17 10:21:00 2015
@@ -6,9 +6,9 @@
  * 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
@@ -33,23 +33,23 @@ import opennlp.tools.ml.model.DataIndexe
  * Evaluate negative log-likelihood and its gradient in parallel
  */
 public class ParallelNegLogLikelihood extends NegLogLikelihood {
-  
+
   // Number of threads
   int threads;
 
   // Partial value of negative log-likelihood to be computed by each thread
   private double[] negLogLikelihoodThread;
-  
+
   // Partial gradient
   private double[][] gradientThread;
-  
+
   public ParallelNegLogLikelihood(DataIndexer indexer, int threads) {
     super(indexer);
-    
+
     if (threads <= 0)
       throw new IllegalArgumentException(
           "Number of threads must 1 or larger");
-    
+
     this.threads                = threads;
     this.negLogLikelihoodThread = new double[threads];
     this.gradientThread         = new double[threads][dimension];
@@ -60,35 +60,35 @@ public class ParallelNegLogLikelihood ex
    */
   @Override
   public double valueAt(double[] x) {
-    
+
     if (x.length != dimension)
       throw new IllegalArgumentException(
           "x is invalid, its dimension is not equal to domain dimension.");
 
     // Compute partial value of negative log-likelihood in each thread
     computeInParallel(x, NegLLComputeTask.class);
-    
+
     double negLogLikelihood = 0;
     for (int t = 0; t < threads; t++) {
       negLogLikelihood += negLogLikelihoodThread[t];
     }
-    
+
     return negLogLikelihood;
-  }  
-  
+  }
+
   /**
    * Compute gradient
    */
   @Override
   public double[] gradientAt(double[] x) {
-    
+
     if (x.length != dimension)
       throw new IllegalArgumentException(
           "x is invalid, its dimension is not equal to the function.");
-    
+
     // Compute partial gradient in each thread
     computeInParallel(x, GradientComputeTask.class);
-    
+
     // Accumulate gradient
     for (int i = 0; i < dimension; i++) {
       gradient[i] = 0;
@@ -96,7 +96,7 @@ public class ParallelNegLogLikelihood ex
         gradient[i] += gradientThread[t][i];
       }
     }
-    
+
     return gradient;
   }
 
@@ -107,18 +107,18 @@ public class ParallelNegLogLikelihood ex
     ExecutorService executor = Executors.newFixedThreadPool(threads);
     int taskSize = numContexts / threads;
     int leftOver = numContexts % threads;
-    
+
     try {
       Constructor<? extends ComputeTask> cons = taskClass.getConstructor(
-          ParallelNegLogLikelihood.class, 
+          ParallelNegLogLikelihood.class,
           int.class, int.class, int.class, double[].class);
-      
+
       List<Future<?>> futures = new ArrayList<Future<?>>();
       for (int i = 0; i < threads; i++) {
         if (i != threads - 1)
           futures.add(executor.submit(
               cons.newInstance(this, i, i*taskSize, taskSize, x)));
-        else 
+        else
           futures.add(executor.submit(
               cons.newInstance(this, i, i*taskSize, taskSize + leftOver, x)));
       }
@@ -129,10 +129,10 @@ public class ParallelNegLogLikelihood ex
     } catch (Exception e) {
       e.printStackTrace();
     }
-    
+
     executor.shutdown();
   }
-  
+
   /**
    * Task that is computed in parallel
    */
@@ -142,38 +142,38 @@ public class ParallelNegLogLikelihood ex
 
     // Start index of contexts to compute
     final int startIndex;
-    
+
     // Number of contexts to compute
     final int length;
 
     final double[] x;
-    
+
     public ComputeTask(int threadIndex, int startIndex, int length, double[] 
x) {
       this.threadIndex = threadIndex;
       this.startIndex  = startIndex;
       this.length      = length;
-      this.x           = x;     
+      this.x           = x;
     }
   }
-  
+
   /**
    * Task for computing partial value of negative log-likelihood
    */
   class NegLLComputeTask extends ComputeTask {
 
     final double[] tempSums;
-    
+
     public NegLLComputeTask(int threadIndex, int startIndex, int length, 
double[] x) {
       super(threadIndex, startIndex, length, x);
       this.tempSums = new double[numOutcomes];
     }
-    
+
     @Override
     public NegLLComputeTask call() {
       int ci, oi, ai, vectorIndex, outcome;
       double predValue, logSumOfExps;
       negLogLikelihoodThread[threadIndex] = 0;
-      
+
       for (ci = startIndex; ci < startIndex + length; ci++) {
         for (oi = 0; oi < numOutcomes; oi++) {
           tempSums[oi] = 0;
@@ -183,25 +183,25 @@ public class ParallelNegLogLikelihood ex
             tempSums[oi] += predValue * x[vectorIndex];
           }
         }
-        
+
         logSumOfExps = ArrayMath.logSumOfExps(tempSums);
-        
+
         outcome = outcomeList[ci];
-        negLogLikelihoodThread[threadIndex] -= 
+        negLogLikelihoodThread[threadIndex] -=
             (tempSums[outcome] - logSumOfExps) * numTimesEventsSeen[ci];
       }
-      
+
       return this;
     }
   }
-  
+
   /**
    * Task for computing partial gradient
    */
   class GradientComputeTask extends ComputeTask {
 
     final double[] expectation;
-    
+
     public GradientComputeTask(int threadIndex, int startIndex, int length, 
double[] x) {
       super(threadIndex, startIndex, length, x);
       this.expectation = new double[numOutcomes];
@@ -212,10 +212,10 @@ public class ParallelNegLogLikelihood ex
       int ci, oi, ai, vectorIndex;
       double predValue, logSumOfExps;
       int empirical;
-      
+
       // Reset gradientThread
       Arrays.fill(gradientThread[threadIndex], 0);
-        
+
       for (ci = startIndex; ci < startIndex + length; ci++) {
         for (oi = 0; oi < numOutcomes; oi++) {
           expectation[oi] = 0;
@@ -225,24 +225,24 @@ public class ParallelNegLogLikelihood ex
             expectation[oi] += predValue * x[vectorIndex];
           }
         }
-    
+
         logSumOfExps = ArrayMath.logSumOfExps(expectation);
-        
+
         for (oi = 0; oi < numOutcomes; oi++) {
           expectation[oi] = Math.exp(expectation[oi] - logSumOfExps);
         }
-        
+
         for (oi = 0; oi < numOutcomes; oi++) {
           empirical = outcomeList[ci] == oi? 1 : 0;
           for (ai = 0; ai < contexts[ci].length; ai++) {
             vectorIndex = indexOf(oi, contexts[ci][ai]);
             predValue = values != null? values[ci][ai] : 1.0;
-            gradientThread[threadIndex][vectorIndex] += 
+            gradientThread[threadIndex][vectorIndex] +=
                 predValue * (expectation[oi] - empirical) * 
numTimesEventsSeen[ci];
           }
         }
       }
-      
+
       return this;
     }
   }


Reply via email to