Package opennlp.tools.util.featuregen

Examples of opennlp.tools.util.featuregen.AdaptiveFeatureGenerator


    byte descriptorBytes[] = (byte[]) artifactMap.get(GENERATOR_DESCRIPTOR_ENTRY_NAME);
   
    if (descriptorBytes != null) {
      InputStream descriptorIn = new ByteArrayInputStream(descriptorBytes);
 
      AdaptiveFeatureGenerator generator = null;
      try {
        generator = GeneratorFactory.create(descriptorIn, new FeatureGeneratorResourceProvider() {
 
          public Object getResource(String key) {
            return artifactMap.get(key);
View Full Code Here


    if (generator != null) {
      contextGenerator = new DefaultNameContextGenerator(generator);
    }
    else {
      // If model has a generator use that one, otherwise create default
      AdaptiveFeatureGenerator featureGenerator = model.createFeatureGenerators();
     
      if (featureGenerator == null)
        featureGenerator = createFeatureGenerator();
     
      contextGenerator = new DefaultNameContextGenerator(featureGenerator);
View Full Code Here

  }
 
  private static AdaptiveFeatureGenerator createFeatureGenerator(
      byte[] generatorDescriptor, final Map<String, Object> resources)
      throws IOException {
    AdaptiveFeatureGenerator featureGenerator;

    if (generatorDescriptor != null) {
      featureGenerator = GeneratorFactory.create(new ByteArrayInputStream(
          generatorDescriptor), new FeatureGeneratorResourceProvider() {
View Full Code Here

   public static TokenNameFinderModel train(String languageCode, String type, ObjectStream<NameSample> samples,
       TrainingParameters trainParams, AdaptiveFeatureGenerator generator, final Map<String, Object> resources) throws IOException {
    
     Map<String, String> manifestInfoEntries = new HashMap<String, String>();
    
     AdaptiveFeatureGenerator featureGenerator;
    
     if (generator != null)
       featureGenerator = generator;
     else
       featureGenerator = createFeatureGenerator();
View Full Code Here

       byte[] generatorDescriptor, final Map<String, Object> resources,
       int iterations, int cutoff) throws IOException {
    
     // TODO: Pass in resource manager ...
    
     AdaptiveFeatureGenerator featureGenerator = createFeatureGenerator(generatorDescriptor, resources);
    
     TokenNameFinderModel model = train(languageCode, type, samples, featureGenerator,
         resources, iterations, cutoff);
    
     if (generatorDescriptor != null) {
View Full Code Here

          new PreviousMapFeatureGenerator()};
    }
  }

  public void addFeatureGenerator(AdaptiveFeatureGenerator generator) {
      AdaptiveFeatureGenerator generators[] = featureGenerators;

      featureGenerators = new AdaptiveFeatureGenerator[featureGenerators.length + 1];

      System.arraycopy(generators, 0, featureGenerators, 0, generators.length);
View Full Code Here

          new PreviousMapFeatureGenerator()};
    }
  }

  public void addFeatureGenerator(AdaptiveFeatureGenerator generator) {
      AdaptiveFeatureGenerator generators[] = featureGenerators;

      featureGenerators = new AdaptiveFeatureGenerator[featureGenerators.length + 1];

      System.arraycopy(generators, 0, featureGenerators, 0, generators.length);
View Full Code Here

    byte descriptorBytes[] = (byte[]) artifactMap.get(GENERATOR_DESCRIPTOR_ENTRY_NAME);
   
    if (descriptorBytes != null) {
      InputStream descriptorIn = new ByteArrayInputStream(descriptorBytes);
 
      AdaptiveFeatureGenerator generator = null;
      try {
        generator = GeneratorFactory.create(descriptorIn, new FeatureGeneratorResourceProvider() {
 
          public Object getResource(String key) {
            return artifactMap.get(key);
View Full Code Here

    if (generator != null) {
      contextGenerator = new DefaultNameContextGenerator(generator);
    }
    else {
      // If model has a generator use that one, otherwise create default
      AdaptiveFeatureGenerator featureGenerator = model.createFeatureGenerators();

      if (featureGenerator == null)
        featureGenerator = createFeatureGenerator();

      contextGenerator = new DefaultNameContextGenerator(featureGenerator);
View Full Code Here

  }

  private static AdaptiveFeatureGenerator createFeatureGenerator(
      byte[] generatorDescriptor, final Map<String, Object> resources)
      throws IOException {
    AdaptiveFeatureGenerator featureGenerator;

    if (generatorDescriptor != null) {
      featureGenerator = GeneratorFactory.create(new ByteArrayInputStream(
          generatorDescriptor), new FeatureGeneratorResourceProvider() {
View Full Code Here

TOP

Related Classes of opennlp.tools.util.featuregen.AdaptiveFeatureGenerator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.