Author: ragerri
Date: Mon Nov  3 17:01:07 2014
New Revision: 1636392

URL: http://svn.apache.org/r1636392
Log:
OPENNLP-725 adding javadoc

Modified:
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/cmdline/namefind/TokenNameFinderTrainerTool.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinderModel.java
    
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/GeneratorFactory.java

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=1636392&r1=1636391&r2=1636392&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
 Mon Nov  3 17:01:07 2014
@@ -88,6 +88,13 @@ public final class TokenNameFinderTraine
     return featureGeneratorBytes;
   }
 
+  /**
+   * Load the resources, such as dictionaries, by reading the feature xml 
descriptor
+   * and looking into the directory passed as argument.
+   * @param resourcePath the directory in which the resources are to be found
+   * @param featureGenDescriptor the feature xml descriptor
+   * @return a map consisting of the file name of the resource and its 
corresponding Object
+   */
   public static Map<String, Object> loadResources(File resourcePath, File 
featureGenDescriptor) {
     Map<String, Object> resources = new HashMap<String, Object>();
 
@@ -155,6 +162,12 @@ public final class TokenNameFinderTraine
     return resources;
   }
 
+  /**
+   * Calls a loadResources method above to load any external resource required 
for training.
+   * @param resourceDirectory the directory where the resources are to be found
+   * @param featureGeneratorDescriptor the xml feature generator
+   * @return a map containing the file name of the resource and its mapped 
Object
+   */
   static Map<String, Object> loadResources(String resourceDirectory, File 
featureGeneratorDescriptor) {
 
     if (resourceDirectory != null) {

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinderModel.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinderModel.java?rev=1636392&r1=1636391&r2=1636392&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinderModel.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/namefind/TokenNameFinderModel.java
 Mon Nov  3 17:01:07 2014
@@ -251,6 +251,15 @@ public class TokenNameFinderModel extend
     serializers.put("featuregen", new ByteArraySerializer());
   }
 
+  /**
+   * Create the artifact serializers. Currently for serializers related to
+   * features that require external resources, such as {@code 
W2VClassesDictionary}
+   * objects, the convention is to add its element tag name as key of the 
serializer map.
+   * For example, the element tag name for the {@code 
WordClusterFeatureGenerator} which
+   * uses {@code W2VClassesDictionary} objects serialized by the {@code 
W2VClassesDictionarySerializer}
+   * is 'w2vwordcluster', which is the key used to add the serializer to the 
map.
+   * @return the map containing the added serializers
+   */
   public static Map<String, ArtifactSerializer> createArtifactSerializers()  {
 
     // TODO: Not so nice, because code cannot really be reused by the other 
create serializer method

Modified: 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/GeneratorFactory.java
URL: 
http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/GeneratorFactory.java?rev=1636392&r1=1636391&r2=1636392&view=diff
==============================================================================
--- 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/GeneratorFactory.java
 (original)
+++ 
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/featuregen/GeneratorFactory.java
 Mon Nov  3 17:01:07 2014
@@ -21,13 +21,11 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
-import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -41,7 +39,6 @@ import opennlp.tools.dictionary.Dictiona
 import opennlp.tools.util.InvalidFormatException;
 import opennlp.tools.util.ext.ExtensionLoader;
 import opennlp.tools.util.model.ArtifactSerializer;
-import opennlp.tools.util.model.SerializableArtifact;
 
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
@@ -670,6 +667,13 @@ public class GeneratorFactory {
     return mapping;
   }
   
+  /**
+   * Provides a list with all the elements in the xml feature descriptor.
+   * @param xmlDescriptorIn the xml feature descriptor
+   * @return a list containing all elements
+   * @throws IOException if inputstream cannot be open
+   * @throws InvalidFormatException if xml is not well-formed
+   */
   public static List<Element> getDescriptorElements(
       InputStream xmlDescriptorIn)
       throws IOException, InvalidFormatException {


Reply via email to