Examples of SentenceModel


Examples of com.aliasi.sentences.SentenceModel

    String[] tokens = new String[tokenList.size()];
    String[] whites = new String[whiteList.size()];
    tokenList.toArray(tokens);
    whiteList.toArray(whites);

    SentenceModel sentenceModel = lingPipeFactory.getSentenceModelInstance();
    int[] sentenceBoundaries = sentenceModel.boundaryIndices(tokens, whites);

    int sentenceEndToken;
    int sentenceEndOffset = -1;
    int sentenceStartOffset = whites[0].length();
    int iToken = 0;
View Full Code Here

Examples of com.aliasi.sentences.SentenceModel

    String[] tokens = new String[tokenList.size()];
    String[] whites = new String[whiteList.size()];
    tokenList.toArray(tokens);
    whiteList.toArray(whites);

    SentenceModel sentenceModel = lingPipeFactory.getSentenceModelInstance();
    sentenceBoundaries = sentenceModel.boundaryIndices(tokens, whites);
    LOG.trace("Sentence segmentation took " + (System.currentTimeMillis() - start) + "ms.");


    //3.) Part-of-Speech tagging
    start = System.currentTimeMillis();
View Full Code Here

Examples of opennlp.tools.sentdetect.SentenceModel

     * @throws IOException
     */
    public ApacheExtractor() throws IOException {
        nameFinder = new NameFinderME(new TokenNameFinderModel(ApacheExtractor.class.getResourceAsStream(pathToNERModel)));
        tokenizer = new TokenizerME(new TokenizerModel(ApacheExtractor.class.getResourceAsStream(pathToTokenizerModel)));
        sentenceDetector = new SentenceDetectorME(new SentenceModel(ApacheExtractor.class.getResourceAsStream(pathToSentenceDetectorModel)));
    }
View Full Code Here

Examples of opennlp.tools.sentdetect.SentenceModel

    System.setProperty("model.dir", "./opennlp-models");
    System.setProperty("wordnet.dir", "./WordNet-3.0");

    File modelFile = new File(models, "en-sent.bin");
    InputStream modelStream = new FileInputStream(modelFile);
    SentenceModel model = new SentenceModel(modelStream);
    sentenceDetector = new SentenceDetectorME(model);
    finders = new HashMap<String, NameFinderME>();
    finders.put("Names", new NameFinderME(new TokenNameFinderModel(
            new FileInputStream(getPersonModel()))));
    finders.put("Dates", new NameFinderME(new TokenNameFinderModel(
View Full Code Here

Examples of opennlp.tools.sentdetect.SentenceModel

    //<start id="openSentDetect"/>
    //... Setup the models
    File modelFile = new File(modelDir, "en-sent.bin");
    InputStream modelStream = new FileInputStream(modelFile);
    SentenceModel model = new SentenceModel(modelStream);
    SentenceDetector detector = //<co id="openSentDetect.co.detect"/>
      new SentenceDetectorME(model);
    String testString = "This is a sentence. It has fruits, vegetables," +
      " etc. but does not have meat. Mr. Smith went to Washington.";
    String[] result = detector.sentDetect(testString); //<co id="openSentDetect.co.run"/>
View Full Code Here

Examples of opennlp.tools.sentdetect.SentenceModel

              )));
    }

    File modelFile = new File(modelDir, "en-sent.bin");
    InputStream modelStream = new FileInputStream(modelFile);
    SentenceModel model = new SentenceModel(modelStream);
    detector = new SentenceDetectorME(model);
  }
View Full Code Here

Examples of opennlp.tools.sentdetect.SentenceModel

    String modelFile = modelDirectory +
        File.separatorChar + language + "-sent.bin";
   
    log.info("Loading sentence model {}", modelFile);
    InputStream modelStream = new FileInputStream(modelFile);
    SentenceModel model = new SentenceModel(modelStream);
    detector = new SentenceDetectorME(model);
  }
View Full Code Here

Examples of opennlp.tools.sentdetect.SentenceModel

  public void initialize(UimaContext context)
      throws ResourceInitializationException {

    super.initialize(context);

    SentenceModel model;

    try {
      SentenceModelResource modelResource = (SentenceModelResource) context
          .getResourceObject(UimaUtil.MODEL_PARAMETER);
View Full Code Here

Examples of opennlp.tools.sentdetect.SentenceModel

    return model;
  }

  @Override
  protected SentenceModel loadModel(InputStream in) throws IOException {
    return new SentenceModel(in);
  }
View Full Code Here

Examples of opennlp.tools.sentdetect.SentenceModel

    if (sampleTraceFile != null) {
        samplesOut = new OutputStreamWriter(new FileOutputStream(sampleTraceFile), sampleTraceFileEncoding);
        samples = new SampleTraceStream<SentenceSample>(samples, samplesOut);
    }
   
    SentenceModel sentenceModel = SentenceDetectorME.train(language, samples,
         sdFactory, mlParams);
   
    // dereference to allow garbage collection
    sentenceSamples = null;
   
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.