Package opennlp.model

Examples of opennlp.model.Event


  public Event next() {
    int split = line.indexOf(' ');
    String outcome = line.substring(0,split);
    String question = line.substring(split+1);
    Parse query = ParserTool.parseLine(question,parser,1)[0];
    return (new Event(outcome, atcg.getContext(query)));
  }
View Full Code Here


            for (int ti = firstTrainingToken; ti <= lastTrainingToken; ti++) {
              Span tSpan = tokens[ti];
              int cStart = cSpan.getStart();
              for (int i = tSpan.getStart() + 1; i < tSpan.getEnd(); i++) {
                String[] context = cg.getContext(ctok, i - cStart);
                events.add(new Event(TokenizerME.NO_SPLIT, context));
              }

              if (tSpan.getEnd() != cSpan.getEnd()) {
                String[] context = cg.getContext(ctok, tSpan.getEnd() - cStart);
                events.add(new Event(TokenizerME.SPLIT, context));
              }
            }
          }
        }
      }
View Full Code Here

    @Override
    protected Iterator<Event> createEvents(RESULT sample) {

      if (RESULT.EVENTS.equals(sample)) {
        List<Event> events = new ArrayList<Event>();
        events.add(new Event("test", new String[]{"f1", "f2"}));

        return events.iterator();
      }
      else if (RESULT.EMPTY.equals(sample)) {
        List<Event> emptyList = Collections.emptyList();
View Full Code Here

    @Override
    protected Iterator<Event> createEvents(RESULT sample) {

      if (RESULT.EVENTS.equals(sample)) {
        List<Event> events = new ArrayList<Event>();
        events.add(new Event("test", new String[]{"f1", "f2"}));

        return events.iterator();
      }
      else if (RESULT.EMPTY.equals(sample)) {
        List<Event> emptyList = Collections.emptyList();
View Full Code Here

    return eventStream.hasNext();
  }

  public Event next() throws IOException {
   
    Event event = eventStream.next();
   
    try {
      digest.update(event.toString().getBytes("UTF-8"));
    }
    catch (UnsupportedEncodingException e) {
      throw new IllegalStateException("UTF-8 encoding is not available!");
    }
   
View Full Code Here

            for (int ti = firstTrainingToken; ti <= lastTrainingToken; ti++) {
              Span tSpan = tokens[ti];
              int cStart = cSpan.getStart();
              for (int i = tSpan.getStart() + 1; i < tSpan.getEnd(); i++) {
                String[] context = cg.getContext(ctok, i - cStart);
                events.add(new Event(TokenizerME.NO_SPLIT, context));
              }

              if (tSpan.getEnd() != cSpan.getEnd()) {
                String[] context = cg.getContext(ctok, tSpan.getEnd() - cStart);
                events.add(new Event(TokenizerME.SPLIT, context));
              }
            }
          }
        }
      }
View Full Code Here

      public Event next() {

        isVirgin = false;

        return new Event(sample.getCategory(),
            mContextGenerator.getContext(sample.getText()));
      }

      public void remove() {
        throw new UnsupportedOperationException();
View Full Code Here

        String type = SentenceDetectorME.NO_SPLIT;
        if (!it.hasNext()) {
          type = SentenceDetectorME.SPLIT;
        }
       
        events.add(new Event(type, cg.getContext(sample.getDocument(),
            sentenceSpan.getStart() + candidate)));
      }
    }
   
View Full Code Here

   */
  public Event next () {
    while (next == null && this.ds.hasNext())
      next = createEvent((String)this.ds.nextToken());
   
    Event current = next;
    if (this.ds.hasNext()) {
      next = createEvent((String)this.ds.nextToken());
    }
    else {
      next = null;
View Full Code Here

  private Event createEvent(String obs) {
    int lastSpace = obs.lastIndexOf(separator);
    if (lastSpace == -1)
      return null;
    else
      return new Event(obs.substring(lastSpace+1),
          cg.getContext(obs.substring(0, lastSpace)));
  }
View Full Code Here

TOP

Related Classes of opennlp.model.Event

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.