Exemplo n.º 1
0
  /** Load Stanford Processor: skip unnecessary annotator */
  protected StanfordCoreNLP loadStanfordProcessor(Properties props) {

    Properties pipelineProps = new Properties(props);
    StringBuilder annoSb = new StringBuilder("");
    if (!CorefProperties.useGoldPOS(props)) {
      annoSb.append("pos, lemma");
    } else {
      annoSb.append("lemma");
    }
    if (CorefProperties.USE_TRUECASE) {
      annoSb.append(", truecase");
    }
    if (!CorefProperties.useGoldNE(props) || CorefProperties.getLanguage(props) == Locale.CHINESE) {
      annoSb.append(", ner");
    }
    if (!CorefProperties.useGoldParse(props)) {
      if (CorefProperties.useConstituencyTree(props)) annoSb.append(", parse");
      else annoSb.append(", depparse");
    }
    String annoStr = annoSb.toString();
    Redwood.log("MentionExtractor ignores specified annotators, using annotators=" + annoStr);
    pipelineProps.put("annotators", annoStr);
    return new StanfordCoreNLP(pipelineProps, false);
  }