Examples of SuffixSensitiveGISModelReader

  • opennlp.tools.ml.maxent.io.SuffixSensitiveGISModelReader
    A reader for GIS models which inspects the filename and invokes the appropriate GISModelReader depending on the filename's suffixes.

    The following assumption are made about suffixes:


  • Examples of opennlp.maxent.io.SuffixSensitiveGISModelReader

        if (ResolverMode.TEST == this.mode) {
          if (loadAsResource) {
            model = (new BinaryGISModelReader(new DataInputStream(this.getClass().getResourceAsStream(modelName+modelExtension)))).getModel();
          }
          else {
            model = (new SuffixSensitiveGISModelReader(new File(modelName+modelExtension))).getModel();
          }
          sameIndex = model.getIndex(SAME);
        }
        else if (ResolverMode.TRAIN == this.mode) {
          events = new ArrayList();
    View Full Code Here

    Examples of opennlp.maxent.io.SuffixSensitiveGISModelReader

        super(getModel(modelFile), new DefaultPOSContextGenerator(null));
      }

      private static MaxentModel getModel(String name) {
        try {
          return new SuffixSensitiveGISModelReader(new File(name)).getModel();
        }
        catch (IOException e) {
          e.printStackTrace();
          return null;
        }
    View Full Code Here

    Examples of opennlp.maxent.io.SuffixSensitiveGISModelReader

    public class TokenChunker extends NameFinderME {

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

    Examples of opennlp.maxent.io.SuffixSensitiveGISModelReader

      public ParserTagger(String modelFile,Dictionary dict) throws IOException {
        this(modelFile,K,K,dict);
      }

      public ParserTagger(String modelFile,int beamSize, int cacheSize,Dictionary dict) throws IOException {
        super(beamSize, new SuffixSensitiveGISModelReader(new File(modelFile)).getModel(), new DefaultPOSContextGenerator(cacheSize,dict), null);
        this.beamSize = beamSize;
      }
    View Full Code Here

    Examples of opennlp.maxent.io.SuffixSensitiveGISModelReader

      public ParserTagger(String modelFile, String tagDictionary, boolean useCase, Dictionary dict) throws IOException {
        this(modelFile,K,dict,tagDictionary,useCase,K);
      }
     
      public ParserTagger(String modelFile, int beamSize, Dictionary dict, String tagDictionary, boolean useCase, int cacheSize) throws IOException {
        super(beamSize, new SuffixSensitiveGISModelReader(new File(modelFile)).getModel(), new DefaultPOSContextGenerator(cacheSize,dict), new POSDictionary(tagDictionary, useCase));
        this.beamSize = beamSize;
      }
    View Full Code Here

    Examples of opennlp.maxent.io.SuffixSensitiveGISModelReader

       * Creates an English Treebank Chunker which uses the specified model file.
       * @param modelFile The name of the maxent model to be used.
       * @throws IOException When the model file can't be open or read.
       */
      public TreebankChunker(String modelFile) throws IOException {
        this(new SuffixSensitiveGISModelReader(new File(modelFile)).getModel());
      }
    View Full Code Here

    Examples of opennlp.maxent.io.SuffixSensitiveGISModelReader

       * Loads a new sentence detector using the model specified by the model name.
       * @param modelName The name of the maxent model trained for sentence detection.
       * @throws IOException If the model specified can not be read.
       */
      public SentenceDetector(String modelName) throws IOException {
        super((new SuffixSensitiveGISModelReader(new File(modelName))).getModel());
      }
    View Full Code Here

    Examples of opennlp.maxent.io.SuffixSensitiveGISModelReader

        super(getModel(modelFile), new DefaultPOSContextGenerator(dict));
      }

      private static MaxentModel getModel(String name) {
        try {
          return new SuffixSensitiveGISModelReader(new File(name)).getModel();
        }
        catch (IOException e) {
          e.printStackTrace();
          return null;
        }
    View Full Code Here

    Examples of opennlp.maxent.io.SuffixSensitiveGISModelReader

      public ParserChunker(String modelFile) throws IOException {
        this(modelFile,K,K);
      }
     
      public ParserChunker(String modelFile, int beamSize, int cacheSize) throws IOException {
        super(new SuffixSensitiveGISModelReader(new File(modelFile)).getModel(), new ChunkContextGenerator(cacheSize), beamSize);
        continueStartMap = new HashMap(model.getNumOutcomes());
        for (int oi=0,on=model.getNumOutcomes();oi<on;oi++) {
          String outcome = model.getOutcome(oi);
          if (outcome.startsWith(ParserME.CONT)){
            continueStartMap.put(outcome,ParserME.START+outcome.substring(ParserME.CONT.length()));
    View Full Code Here

    Examples of opennlp.maxent.io.SuffixSensitiveGISModelReader

      private static Pattern untokenizedParenPattern1 = Pattern.compile("([^ ])([({)}])");
      private static Pattern untokenizedParenPattern2 = Pattern.compile("([({)}])([^ ])");
      public static ParserME getParser(String dataDir, boolean useTagDictionary, boolean useCaseSensitiveTagDictionary, int beamSize, double advancePercentage) throws IOException {
        if (useTagDictionary) {
          return new ParserME(
            new SuffixSensitiveGISModelReader(new File(dataDir + "/build.bin.gz")).getModel(),
            new SuffixSensitiveGISModelReader(new File(dataDir + "/check.bin.gz")).getModel(),
            new ParserTagger(dataDir + "/tag.bin.gz", dataDir + "/tagdict", useCaseSensitiveTagDictionary ),//, new Dictionary(dataDir+"/dict.bin.gz")),
            new ParserChunker(dataDir + "/chunk.bin.gz"),
            new HeadRules(dataDir + "/head_rules"),beamSize,advancePercentage);
        }
        else {
          return new ParserME(
            new SuffixSensitiveGISModelReader(new File(dataDir + "/build.bin.gz")).getModel(),
            new SuffixSensitiveGISModelReader(new File(dataDir + "/check.bin.gz")).getModel(),
            new ParserTagger(dataDir + "/tag.bin.gz",null), //new Dictionary(dataDir+"/dict.bin.gz")),
            new ParserChunker(dataDir + "/chunk.bin.gz"),
            new HeadRules(dataDir + "/head_rules"),beamSize,advancePercentage);
        }
      }
    View Full Code Here
    TOP
    Copyright © 2018 www.massapi.com. 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.