示例#1
0
 private IAnnotator GetParser()
 {
     if (parserProcessor == null)
     {
         IAnnotator parser = StanfordCoreNLP.GetExistingAnnotator("parse");
         if (parser == null)
         {
             Properties emptyProperties = new Properties();
             parser = new ParserAnnotator("coref.parse.md", emptyProperties);
         }
         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(typeof(CoreAnnotations.PartOfSpeechAnnotation)))
         {
             IAnnotator tagger = StanfordCoreNLP.GetExistingAnnotator("pos");
             if (tagger == null)
             {
                 throw new AssertionError("Parser required tagger, but failed to find the pos annotator");
             }
             IList <IAnnotator> annotators = Generics.NewArrayList();
             annotators.Add(tagger);
             annotators.Add(parser);
             parserProcessor = new AnnotationPipeline(annotators);
         }
         else
         {
             parserProcessor = parser;
         }
     }
     return(parserProcessor);
 }
示例#2
0
 public virtual IAnnotator GetParser()
 {
     if (parserProcessor == null)
     {
         parserProcessor = StanfordCoreNLP.GetExistingAnnotator("parse");
         System.Diagnostics.Debug.Assert((parserProcessor != null));
     }
     return(parserProcessor);
 }
示例#3
0
 private IAnnotator GetParser()
 {
     if (parserProcessor == null)
     {
         parserProcessor = StanfordCoreNLP.GetExistingAnnotator("parse");
         if (parserProcessor == null)
         {
             Properties emptyProperties = new Properties();
             parserProcessor = new ParserAnnotator("coref.parse.md", emptyProperties);
         }
         System.Diagnostics.Debug.Assert((parserProcessor != null));
     }
     return(parserProcessor);
 }