Package edu.stanford.nlp.pipeline

Examples of edu.stanford.nlp.pipeline.Annotator$Requirement


    return sents.get(0).get(TreeCoreAnnotations.TreeAnnotation.class);
  }

  private Annotator getParser() {
    if(parserProcessor == null){
      Annotator parser = StanfordCoreNLP.getExistingAnnotator("parse");
      if (parser == null) {
        // TODO: these assertions rule out the possibility of alternately named parse/pos annotators
        throw new AssertionError("Failed to get parser - this should not be possible");
      }
      if (parser.requires().contains(Annotator.POS_REQUIREMENT)) {
        Annotator tagger = StanfordCoreNLP.getExistingAnnotator("pos");
        if (tagger == null) {
          throw new AssertionError("Parser required tagger, but failed to find the pos annotator");
        }
        List<Annotator> annotators = Generics.newArrayList();
        annotators.add(tagger);
View Full Code Here


      Properties props = getTimeAnnotatorProperties(request);
      String annotatorType = request.getParameter("annotator");
      if (annotatorType == null) {
        annotatorType = "sutime";
      }
      Annotator timeAnnotator = pipeline.getTimeAnnotator(annotatorType, props);
      if (timeAnnotator != null) {
        Annotation anno = pipeline.process(query, dateString, timeAnnotator);
        out.println("<h3>Annotated Text</h3> <em>(tagged using " + annotatorType + "</em>)");
        displayAnnotation(out, query, anno, includeOffsets);
      } else {
View Full Code Here

    return anno;
  }

  static public void main(String[] args) throws IOException {
    SUTimePipeline pipeline = new SUTimePipeline();
    Annotator timeAnnotator = pipeline.getTimeAnnotator("sutime", new Properties());
    BufferedReader is = new BufferedReader(new InputStreamReader(System.in));
    System.out.print("> ");
    for(String line; (line = is.readLine()) != null; ){
      Annotation ann = pipeline.process(line, null, timeAnnotator);
      System.out.println(ann.get(TimeAnnotations.TimexAnnotations.class));
View Full Code Here

TOP

Related Classes of edu.stanford.nlp.pipeline.Annotator$Requirement

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.