opennlp.tools.util.featuregen
Class GeneratorFactory

java.lang.Object
  extended by opennlp.tools.util.featuregen.GeneratorFactory

public class GeneratorFactory
extends Object

Creates a set of feature generators based on a provided XML descriptor. Example of an XML descriptor: Each XML element is mapped to a GeneratorFactory.XmlFeatureGeneratorFactory which is responsible to process the element and create the specified AdaptiveFeatureGenerator. Elements can contain other elements in this case it is the responsibility of the mapped factory to process the child elements correctly. In some factories this leads to recursive calls the GeneratorFactory.XmlFeatureGeneratorFactory#create(Element, FeatureGeneratorResourceProvider) method. In the example above the generators element is mapped to the GeneratorFactory.AggregatedFeatureGeneratorFactory which then creates all the aggregated AdaptiveFeatureGenerators to accomplish this it evaluates the mapping with the same mechanism and gives the child element to the corresponding factories. All created generators are added to a new instance of the AggregatedFeatureGenerator which is then returned.


Constructor Summary
GeneratorFactory()
           
 
Method Summary
static AdaptiveFeatureGenerator create(InputStream xmlDescriptorIn, FeatureGeneratorResourceProvider resourceManager)
          Creates an AdaptiveFeatureGenerator from an provided XML descriptor.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeneratorFactory

public GeneratorFactory()
Method Detail

create

public static AdaptiveFeatureGenerator create(InputStream xmlDescriptorIn,
                                              FeatureGeneratorResourceProvider resourceManager)
                                       throws IOException,
                                              InvalidFormatException
Creates an AdaptiveFeatureGenerator from an provided XML descriptor. Usually this XML descriptor contains a set of nested feature generators which are then used to generate the features by one of the opennlp components.

Parameters:
xmlDescriptorIn - the InputStream from which the descriptor is read, the stream remains open and must be closed by the caller.
resourceManager - the resource manager which is used to resolve resources referenced by a key in the descriptor
Returns:
created feature generators
Throws:
IOException - if an error occurs during reading from the descriptor InputStream
InvalidFormatException


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.