You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by jo...@apache.org on 2014/01/06 12:00:18 UTC

svn commit: r1555712 - in /opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools: chunker/ doccat/ namefind/ parser/chunking/ parser/treeinsert/ postag/

Author: joern
Date: Mon Jan  6 11:00:18 2014
New Revision: 1555712

URL: http://svn.apache.org/r1555712
Log:
OPENNLP-573 Removed deprecated 1.4 API

Removed:
    opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerTrainer.java
Modified:
    opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/chunker/ChunkerME.java
    opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/doccat/DocumentCategorizerME.java
    opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/namefind/NameFinderME.java
    opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/parser/chunking/Parser.java
    opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/parser/treeinsert/Parser.java
    opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java

Modified: opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/chunker/ChunkerME.java
URL: http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/chunker/ChunkerME.java?rev=1555712&r1=1555711&r2=1555712&view=diff
==============================================================================
--- opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/chunker/ChunkerME.java (original)
+++ opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/chunker/ChunkerME.java Mon Jan  6 11:00:18 2014
@@ -114,41 +114,6 @@ public class ChunkerME implements Chunke
     this(model, DEFAULT_BEAM_SIZE);
   }
 
-  /**
-   * Creates a chunker using the specified model.
-   *
-   * @param mod The maximum entropy model for this chunker.
-   */
-  @Deprecated
-  public ChunkerME(MaxentModel mod) {
-    this(mod, new DefaultChunkerContextGenerator(), DEFAULT_BEAM_SIZE);
-  }
-
-  /**
-   * Creates a chunker using the specified model and context generator.
-   *
-   * @param mod The maximum entropy model for this chunker.
-   * @param cg The context generator to be used by the specified model.
-   */
-  @Deprecated
-  public ChunkerME(MaxentModel mod, ChunkerContextGenerator cg) {
-    this(mod, cg, DEFAULT_BEAM_SIZE);
-  }
-
-  /**
-   * Creates a chunker using the specified model and context generator and decodes the
-   * model using a beam search of the specified size.
-   *
-   * @param mod The maximum entropy model for this chunker.
-   * @param cg The context generator to be used by the specified model.
-   * @param beamSize The size of the beam that should be used when decoding sequences.
-   */
-  @Deprecated
-  public ChunkerME(MaxentModel mod, ChunkerContextGenerator cg, int beamSize) {
-    beam = new BeamSearch<String>(beamSize, cg, mod);
-    this.model = mod;
-  }
-
   @Deprecated
   public List<String> chunk(List<String> toks, List<String> tags) {
     bestSequence =

Modified: opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/doccat/DocumentCategorizerME.java
URL: http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/doccat/DocumentCategorizerME.java?rev=1555712&r1=1555711&r2=1555712&view=diff
==============================================================================
--- opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/doccat/DocumentCategorizerME.java (original)
+++ opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/doccat/DocumentCategorizerME.java Mon Jan  6 11:00:18 2014
@@ -67,36 +67,6 @@ public class DocumentCategorizerME imple
   public DocumentCategorizerME(DoccatModel model) {
     this(model, defaultFeatureGenerator);
   }
-  
-  /**
-   * Initializes the current instance with the given {@link MaxentModel}.
-   *
-   * @param model
-   * 
-   * @deprecated Use {@link DocumentCategorizerME#DocumentCategorizerME(DoccatModel)} instead.
-   */
-  @Deprecated
-  public DocumentCategorizerME(MaxentModel model) {
-    this(model, new FeatureGenerator[]{new BagOfWordsFeatureGenerator()});
-  }
-
-  /**
-   * Initializes the current instance with a the given {@link MaxentModel}
-   * and {@link FeatureGenerator}s.
-   *
-   * @param model
-   * @param featureGenerators
-   * 
-   * @deprecated Use {@link DocumentCategorizerME#DocumentCategorizerME(DoccatModel, FeatureGenerator...)} instead.
-   */
-  @Deprecated
-  public DocumentCategorizerME(MaxentModel model,
-      FeatureGenerator... featureGenerators) {
-
-    this.model = model;
-    mContextGenerator =
-        new DocumentCategorizerContextGenerator(featureGenerators);
-  }
 
   /**
    * Categorizes the given text.
@@ -136,19 +106,6 @@ public class DocumentCategorizerME imple
     return model.getAllOutcomes(results);
   }
 
-  /**
-   * Trains a new model for the {@link DocumentCategorizerME}.
-   *
-   * @param eventStream
-   *
-   * @return the new model
-   */
-   @Deprecated
-  public static AbstractModel train(DocumentCategorizerEventStream eventStream) throws IOException {
-    return GIS.trainModel(100, new TwoPassDataIndexer(eventStream, 5));
-  }
-  
-   
    public static DoccatModel train(String languageCode, ObjectStream<DocumentSample> samples,
        TrainingParameters mlParams, FeatureGenerator... featureGenerators)
    throws IOException {

Modified: opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/namefind/NameFinderME.java
URL: http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/namefind/NameFinderME.java?rev=1555712&r1=1555711&r2=1555712&view=diff
==============================================================================
--- opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/namefind/NameFinderME.java (original)
+++ opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/namefind/NameFinderME.java Mon Jan  6 11:00:18 2014
@@ -126,47 +126,6 @@ public class NameFinderME implements Tok
     this(model, null, beamSize);
   }
 
-
-  /**
-   * Creates a new name finder with the specified model.
-   *
-   * @param mod The model to be used to find names.
-   *
-   * @deprecated Use the new model API!
-   */
-  @Deprecated
-  public NameFinderME(MaxentModel mod) {
-    this(mod, new DefaultNameContextGenerator(), DEFAULT_BEAM_SIZE);
-  }
-
-  /**
-   * Creates a new name finder with the specified model and context generator.
-   *
-   * @param mod The model to be used to find names.
-   * @param cg The context generator to be used with this name finder.
-   */
-  @Deprecated
-  public NameFinderME(MaxentModel mod, NameContextGenerator cg) {
-    this(mod, cg, DEFAULT_BEAM_SIZE);
-  }
-
-  /**
-   * Creates a new name finder with the specified model and context generator.
-   *
-   * @param mod The model to be used to find names.
-   * @param cg The context generator to be used with this name finder.
-   * @param beamSize The size of the beam to be used in decoding this model.
-   */
-  @Deprecated
-  public NameFinderME(MaxentModel mod, NameContextGenerator cg, int beamSize) {
-    model = mod;
-    contextGenerator = cg;
-
-    contextGenerator.addFeatureGenerator(new WindowFeatureGenerator(additionalContextFeatureGenerator, 8, 8));
-    beam = new BeamSearch<String>(beamSize, cg, mod,
-        new NameFinderSequenceValidator(), beamSize);
-  }
-
   private static AdaptiveFeatureGenerator createFeatureGenerator() {
    return new CachedFeatureGenerator(
          new AdaptiveFeatureGenerator[]{

Modified: opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/parser/chunking/Parser.java
URL: http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/parser/chunking/Parser.java?rev=1555712&r1=1555711&r2=1555712&view=diff
==============================================================================
--- opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/parser/chunking/Parser.java (original)
+++ opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/parser/chunking/Parser.java Mon Jan  6 11:00:18 2014
@@ -86,19 +86,6 @@ public class Parser extends AbstractBott
   }
 
   /**
-   * Creates a new parser using the specified models and head rules.
-   * @param buildModel The model to assign constituent labels.
-   * @param checkModel The model to determine a constituent is complete.
-   * @param tagger The model to assign pos-tags.
-   * @param chunker The model to assign flat constituent labels.
-   * @param headRules The head rules for head word perculation.
-   */
-  @Deprecated
-  public Parser(MaxentModel buildModel, MaxentModel checkModel, POSTagger tagger, Chunker chunker, HeadRules headRules) {
-  	this(buildModel,checkModel,tagger,chunker,headRules,defaultBeamSize,defaultAdvancePercentage);
-  }
-
-  /**
    * Creates a new parser using the specified models and head rules using the specified beam size and advance percentage.
    * @param buildModel The model to assign constituent labels.
    * @param checkModel The model to determine a constituent is complete.
@@ -109,8 +96,7 @@ public class Parser extends AbstractBott
    * @param advancePercentage The minimal amount of probability mass which advanced outcomes must represent.
    * Only outcomes which contribute to the top "advancePercentage" will be explored.
    */
-  @Deprecated
-  public Parser(MaxentModel buildModel, MaxentModel checkModel, POSTagger tagger, Chunker chunker, HeadRules headRules, int beamSize, double advancePercentage) {
+  private Parser(MaxentModel buildModel, MaxentModel checkModel, POSTagger tagger, Chunker chunker, HeadRules headRules, int beamSize, double advancePercentage) {
     super(tagger, chunker, headRules, beamSize, advancePercentage);
     this.buildModel = buildModel;
     this.checkModel = checkModel;

Modified: opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/parser/treeinsert/Parser.java
URL: http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/parser/treeinsert/Parser.java?rev=1555712&r1=1555711&r2=1555712&view=diff
==============================================================================
--- opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/parser/treeinsert/Parser.java (original)
+++ opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/parser/treeinsert/Parser.java Mon Jan  6 11:00:18 2014
@@ -112,8 +112,7 @@ public class Parser extends AbstractBott
     this(model, defaultBeamSize, defaultAdvancePercentage);
   }
   
-  @Deprecated
-  public Parser(MaxentModel buildModel, MaxentModel attachModel, MaxentModel checkModel, POSTagger tagger, Chunker chunker, HeadRules headRules, int beamSize, double advancePercentage) {
+  private Parser(MaxentModel buildModel, MaxentModel attachModel, MaxentModel checkModel, POSTagger tagger, Chunker chunker, HeadRules headRules, int beamSize, double advancePercentage) {
     super(tagger,chunker,headRules,beamSize,advancePercentage);
     this.buildModel = buildModel;
     this.attachModel = attachModel;
@@ -135,11 +134,6 @@ public class Parser extends AbstractBott
     this.completeIndex = checkModel.getIndex(Parser.COMPLETE);
   }
 
-  @Deprecated
-  public Parser(MaxentModel buildModel, MaxentModel attachModel, MaxentModel checkModel, POSTagger tagger, Chunker chunker, HeadRules headRules) {
-    this(buildModel,attachModel,checkModel, tagger,chunker,headRules,defaultBeamSize,defaultAdvancePercentage);
-  }
-
   /**
    * Returns the right frontier of the specified parse tree with nodes ordered from deepest
    * to shallowest.

Modified: opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java
URL: http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java?rev=1555712&r1=1555711&r2=1555712&view=diff
==============================================================================
--- opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java (original)
+++ opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java Mon Jan  6 11:00:18 2014
@@ -134,80 +134,6 @@ public class POSTaggerME implements POST
   }
 
   /**
-   * Creates a new tagger with the specified model and tag dictionary.
-   *
-   * @param model The model used for tagging.
-   * @param tagdict The tag dictionary used for specifying a set of valid tags.
-   */
-  @Deprecated
-  public POSTaggerME(AbstractModel model, TagDictionary tagdict) {
-    this(model, new DefaultPOSContextGenerator(null),tagdict);
-  }
-
-  /**
-   * Creates a new tagger with the specified model and n-gram dictionary.
-   *
-   * @param model The model used for tagging.
-   * @param dict The n-gram dictionary used for feature generation.
-   */
-  @Deprecated
-  public POSTaggerME(AbstractModel model, Dictionary dict) {
-    this(model, new DefaultPOSContextGenerator(dict));
-  }
-
-  /**
-   * Creates a new tagger with the specified model, n-gram dictionary, and tag dictionary.
-   *
-   * @param model The model used for tagging.
-   * @param dict The n-gram dictionary used for feature generation.
-   * @param tagdict The dictionary which specifies the valid set of tags for some words.
-   */
-  @Deprecated
-  public POSTaggerME(AbstractModel model, Dictionary dict, TagDictionary tagdict) {
-      this(DEFAULT_BEAM_SIZE,model, new DefaultPOSContextGenerator(dict),tagdict);
-    }
-
-  /**
-   * Creates a new tagger with the specified model and context generator.
-   *
-   * @param model The model used for tagging.
-   * @param cg The context generator used for feature creation.
-   */
-  @Deprecated
-  public POSTaggerME(AbstractModel model, POSContextGenerator cg) {
-    this(DEFAULT_BEAM_SIZE, model, cg, null);
-  }
-
-  /**
-   * Creates a new tagger with the specified model, context generator, and tag dictionary.
-   *
-   * @param model The model used for tagging.
-   * @param cg The context generator used for feature creation.
-   * @param tagdict The dictionary which specifies the valid set of tags for some words.
-   */
-  @Deprecated
-  public POSTaggerME(AbstractModel model, POSContextGenerator cg, TagDictionary tagdict) {
-      this(DEFAULT_BEAM_SIZE, model, cg, tagdict);
-    }
-
-  /**
-   * Creates a new tagger with the specified beam size, model, context generator, and tag dictionary.
-   *
-   * @param beamSize The number of alternate tagging considered when tagging.
-   * @param model The model used for tagging.
-   * @param cg The context generator used for feature creation.
-   * @param tagdict The dictionary which specifies the valid set of tags for some words.
-   */
-  @Deprecated
-  public POSTaggerME(int beamSize, AbstractModel model, POSContextGenerator cg, TagDictionary tagdict) {
-    size = beamSize;
-    posModel = model;
-    contextGen = cg;
-    beam = new BeamSearch<String>(size, cg, model);
-    tagDictionary = tagdict;
-  }
-
-  /**
    * Returns the number of different tags predicted by this model.
    *
    * @return the number of different tags predicted by this model.