Package opennlp.maxent.io

Examples of opennlp.maxent.io.SuffixSensitiveGISModelReader


* @author      Jason Baldridge
* @author      Tom Morton
*/
public class Tokenizer extends TokenizerME  {
  public Tokenizer(String name) throws IOException  {
    super((new SuffixSensitiveGISModelReader(new File(name))).getModel());
    setAlphaNumericOptimization(true);
  }
View Full Code Here


    }
    NameFinder[] finders = new NameFinder[args.length-ai];
    String[] names = new String[args.length-ai];
    for (int fi=0; ai < args.length; ai++,fi++) {
      String modelName = args[ai];
      finders[fi] = new NameFinder(new SuffixSensitiveGISModelReader(new File(modelName)).getModel());
      int nameStart = modelName.lastIndexOf(System.getProperty("file.separator")) + 1;
      int nameEnd = modelName.indexOf('.', nameStart);
      if (nameEnd == -1) {
        nameEnd = modelName.length();
      }
View Full Code Here

    else if (mode == ResolverMode.TEST) {
      if (loadAsResource) {
        model = (new BinaryGISModelReader(new DataInputStream(this.getClass().getResourceAsStream(modelName)))).getModel();
      }
      else {
        model = (new SuffixSensitiveGISModelReader(new File(modelName+modelExtension))).getModel();
      }
      nonRefIndex = model.getIndex(MaxentResolver.SAME);
    }
    else {
      throw new RuntimeException("unexpected mode "+mode);
View Full Code Here

    else {
      if (MaxentResolver.loadAsResource()) {
        testModel = (new PlainTextGISModelReader(new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream(modelName))))).getModel();
      }
      else {
        testModel = (new SuffixSensitiveGISModelReader(new File(modelName+modelExtension))).getModel();
      }
      SAME_INDEX = testModel.getIndex(SAME);
    }
  }
View Full Code Here

    }
    else {
      //if (MaxentResolver.loadAsResource()) {
      //  testModel = (new PlainTextGISModelReader(new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream(modelName))))).getModel();
      //}
      testModel = (new SuffixSensitiveGISModelReader(new File(modelName+modelExtension))).getModel();
      singularIndex = testModel.getIndex(NumberEnum.SINGULAR.toString());
      pluralIndex = testModel.getIndex(NumberEnum.PLURAL.toString());
    }
  }
View Full Code Here

    {
        iv_logger.info("Loading resource: " + dr.getUrl());
        try
        {
            File modelFile = new File(dr.getUri());
            SuffixSensitiveGISModelReader reader = new SuffixSensitiveGISModelReader(modelFile);

            iv_maxentModel = reader.getModel();

            iv_logger.info("Loaded resource, bytes=" + modelFile.length());
        }
        catch (IOException ioe)
        {
View Full Code Here

    this.modelName = modelName;
    if (train) {
      events = new ArrayList<Event>();
    }
    else {
      testModel = (new SuffixSensitiveGISModelReader(new File(modelName+modelExtension))).getModel();
      SAME_INDEX = testModel.getIndex(SAME);
    }
  }
View Full Code Here

public class TokenChunker {

  private NameFinderME nameFinder;

  public TokenChunker(String modelName) throws IOException {
  nameFinder = new NameFinderME(new SuffixSensitiveGISModelReader(
      new File(modelName)).getModel());
  }
View Full Code Here

        ai++;
        dict = new Dictionary(new FileInputStream(args[ai]));
      }
      else if (args[ai].equals("-model")) {
        ai++;
        model = (new SuffixSensitiveGISModelReader(new File(args[ai]))).getModel();
      }
      else {
        System.err.println("Invalid option " + args[ai]);
        System.exit(1);
      }
View Full Code Here

      nameFinderLabels = new String[numNefs];
      neAnnotationMakers = new Constructor[numNefs];
      for (int i = 0; i < numNefs; i++) {
        String modelName = modelFiles[i].getName();
        System.out.print("Loading model: " + modelName + "...");
        nameFinders[i] = new NameFinder(new SuffixSensitiveGISModelReader(modelFiles[i]).getModel());
        int nameStart = modelName.lastIndexOf(System.getProperty("file.separator")) + 1;
        int nameEnd = modelName.indexOf('.', nameStart);
        if (nameEnd == -1) {
          nameEnd = modelName.length();
        }
View Full Code Here

TOP

Related Classes of opennlp.maxent.io.SuffixSensitiveGISModelReader

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.