Package opennlp.tools.doccat

Examples of opennlp.tools.doccat.BagOfWordsFeatureGenerator


    int cutoff = 5;
    int iterations = 100;
    NameFinderFeatureGenerator nffg //<co id="tm.fg"/>
      = new NameFinderFeatureGenerator();
    BagOfWordsFeatureGenerator bowfg
      = new BagOfWordsFeatureGenerator();

    DoccatModel model = DocumentCategorizerME.train("en",
        ds, cutoff, iterations, nffg, bowfg); //<co id="tm.train"/>
    model.serialize(new FileOutputStream(modelFile));
   
View Full Code Here


  private static void execute(File[] inputFiles, File modelFile)
      throws IOException, FileNotFoundException {
    //<start id="maxent.examples.test.setup"/>
    NameFinderFeatureGenerator nffg //<co id="tmx.feature"/>
      = new NameFinderFeatureGenerator();
    BagOfWordsFeatureGenerator bowfg
      = new BagOfWordsFeatureGenerator();

    InputStream modelStream = //<co id="tmx.modelreader"/>
        new FileInputStream(modelFile);
    DoccatModel model = new DoccatModel(modelStream);
    DocumentCategorizer categorizer //<co id="tmx.categorizer"/>
View Full Code Here

    return WhitespaceTokenizer.INSTANCE;
  }

  static FeatureGenerator[] createFeatureGenerators(String featureGeneratorsNames) {
    if(featureGeneratorsNames == null) {
      FeatureGenerator[] def = {new BagOfWordsFeatureGenerator()};
      return def;
    }
    String[] classes = featureGeneratorsNames.split(",");
    FeatureGenerator[] featureGenerators = new FeatureGenerator[classes.length];
    for (int i = 0; i < featureGenerators.length; i++) {
View Full Code Here

TOP

Related Classes of opennlp.tools.doccat.BagOfWordsFeatureGenerator

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.