Package opennlp.tools.tokenize

Examples of opennlp.tools.tokenize.TokenSample


    Span[] spans = openNLPSpans.toArray(new Span[openNLPSpans.size()]);
   
    Arrays.sort(spans);
   
    tokenSamples.add(new TokenSample(sentence.getCoveredText(), spans));
  }
View Full Code Here


        .getResource("opennlp/tools/formats/ad.sample").toURI());
    String[] args = { "-data", data.getCanonicalPath(), "-encoding", "UTF-8",
        "-lang", "pt", "-detokenizer", dict.getCanonicalPath() };
    ObjectStream<TokenSample> tokenSampleStream = factory.create(args);

    TokenSample sample = tokenSampleStream.read();

    while (sample != null) {
      samples.add(sample);
      sample = tokenSampleStream.read();
    }
View Full Code Here

      line = in.readLine();
    } catch (IOException e) {
      e.printStackTrace();
      line = null;
    }
    return new TokenSample(sb.toString(),spans.toArray(new Span[spans.size()]));
  }
View Full Code Here

      }
      ai++;
    }
    TokenSampleStream tss = new TokenSampleStream(System.in);
    while(tss.hasNext()) {
      TokenSample ts = tss.next();
      String text = ts.getText();
      System.out.println(text);
      Span[] tokenSpans = ts.getTokenSpans();
      int ti=0;
      if (showSpans) {
        for (int i=0;i<text.length();i++) {
          if (ti-1 >= 0 && i==tokenSpans[ti-1].getEnd()-1) {
            System.out.print("]");
View Full Code Here

    Span[] spans = openNLPSpans.toArray(new Span[openNLPSpans.size()]);
   
    Arrays.sort(spans);
   
    tokenSamples.add(new TokenSample(sentence.getCoveredText(), spans));
  }
View Full Code Here

  }
 
  public TokenSample read() throws IOException {
    NameSample nameSample = samples.read();
   
    TokenSample tokenSample = null;
   
    if (nameSample != null ) {
      tokenSample = new TokenSample(detokenizer, nameSample.getSentence());
    }
   
    return tokenSample;
  }
View Full Code Here

 
  public TokenSample read() throws IOException {
   
    POSSample posSample = samples.read();
   
    TokenSample tokenSample = null;
   
    if (posSample != null ) {
      tokenSample = new TokenSample(detokenizer, posSample.getSentence());
    }
   
    return tokenSample;
  }
View Full Code Here

  }
 
  public TokenSample read() throws IOException {
    NameSample nameSample = samples.read();
   
    TokenSample tokenSample = null;
   
    if (nameSample != null ) {
      tokenSample = new TokenSample(detokenizer, nameSample.getSentence());
    }
   
    return tokenSample;
  }
View Full Code Here

 
  public TokenSample read() throws IOException {
   
    POSSample posSample = samples.read();
   
    TokenSample tokenSample = null;
   
    if (posSample != null ) {
      tokenSample = new TokenSample(detokenizer, posSample.getSentence());
    }
   
    return tokenSample;
  }
View Full Code Here

      line = in.readLine();
    } catch (IOException e) {
      e.printStackTrace();
      line = null;
    }
    return new TokenSample(sb.toString(),spans.toArray(new Span[spans.size()]));
  }
View Full Code Here

TOP

Related Classes of opennlp.tools.tokenize.TokenSample

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.