Package opennlp.tools.namefind

Examples of opennlp.tools.namefind.NameSample


   
    this.detokenizer = detokenizer;
  }
 
  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


        .getResourceAsStream("/opennlp/tools/formats/ad.sample");

    ADNameSampleStream stream = new ADNameSampleStream(
        new PlainTextByLineStream(in, "UTF-8"));

    NameSample sample = stream.read();

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

      Node root = paragraph.getRoot();
      List<String> sentence = new ArrayList<String>();
      List<Span> names = new ArrayList<Span>();
      process(root, sentence, names);

      return new NameSample(sentence.toArray(new String[sentence.size()]),
          names.toArray(new Span[names.size()]), true);
    }
    return null;
  }
View Full Code Here

   
    this.detokenizer = detokenizer;
  }
 
  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

        .getResourceAsStream("/opennlp/tools/formats/ad.sample");

    ADNameSampleStream stream = new ADNameSampleStream(
        new PlainTextByLineStream(in, "UTF-8"), true);

    NameSample sample = stream.read();

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

          // Simple way to drop intersecting spans, otherwise the
          // NameSample is invalid
          Span reducedNames[] = NameFinderME.dropOverlappingSpans(
              names.toArray(new Span[names.size()]));

          NameSample nameSample = new NameSample(whitespaceTokenizerLine,
              reducedNames, false);

          System.out.println(nameSample.toString());

          perfMon.incrementCounter();
        }
      }
      catch (IOException e) {
View Full Code Here

      nameSpan = new Span(nameSpan.getStart(), text.size(), nameSpan.getType());
      names.add(nameSpan);
    }

    if (MucElementNames.CONTENT_ELEMENTS.contains(name)) {
      storedSamples.add(new NameSample(text.toArray(new String[text.size()]),
          names.toArray(new Span[names.size()]), isClearAdaptiveData));
     
      if (isClearAdaptiveData) {
        isClearAdaptiveData = false;
      }
View Full Code Here

     
      // if one span remains, create it here
      if (beginIndex != -1)
        names.add(new Span(beginIndex, endIndex, tags.get(beginIndex).substring(2)));
     
      return new NameSample(sentence.toArray(new String[sentence.size()]), names.toArray(new Span[names.size()]), isClearAdaptiveData);
    }
    else if (line != null) {
      // Just filter out empty events, if two lines in a row are empty
      return read();
    }
View Full Code Here

     
      // if one span remains, create it here
      if (beginIndex != -1)
        names.add(extract(beginIndex, endIndex, tags.get(beginIndex)));
     
      return new NameSample(sentence.toArray(new String[sentence.size()]), names.toArray(new Span[names.size()]), isClearAdaptiveData);
    }
    else if (line != null) {
      // Just filter out empty events, if two lines in a row are empty
      return read();
    }
View Full Code Here

      // if one span remains, create it here
      if (beginIndex != -1)
        names.add(extract(beginIndex, endIndex, tags.get(beginIndex)));

      return new NameSample(sentence.toArray(new String[sentence.size()]), names.toArray(new Span[names.size()]), isClearAdaptiveData);
    }
    else if (line != null) {
      // Just filter out empty events, if two lines in a row are empty
      return read();
    }
View Full Code Here

TOP

Related Classes of opennlp.tools.namefind.NameSample

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.