edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation.getCorpusId()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(65)

本文整理了Java中edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation.getCorpusId()方法的一些代码示例,展示了TextAnnotation.getCorpusId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextAnnotation.getCorpusId()方法的具体详情如下:
包路径:edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation
类名称:TextAnnotation
方法名:getCorpusId

TextAnnotation.getCorpusId介绍

暂无

代码示例

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-nlp-readers

/**
 * append a single row of column format NE corpus from TextAnnotation ta corresponding to token index
 *   tokenIndex to columnOutput
 * for now, assume only token info is present
 *
 * @param columnOutput
 * @param ta
 * @param tokenIndex
 */
private static void printRow(StringBuilder columnOutput, String label, TextAnnotation ta, int tokenIndex, int inSentenceOffset ) {
  // B-LOC	0	0	O	O	WASHINGTON	x	x	0
  // O	0	1	O	O	--	x	x	0
  if ( tokenIndex < ta.size() ) {
    String token = ta.getToken(tokenIndex);
    columnOutput.append(label).append("\t").append("0").append( "\t" ).append(inSentenceOffset).append( "\t" );
    columnOutput.append(OUT_TAG).append( "\t" ).append(OUT_TAG).append( "\t" );
    columnOutput.append( token ).append("\t").append("x").append("\t").append("x");
    columnOutput.append("\t").append("0").append(System.lineSeparator());
  }
  else
    logger.warn( "out of range of token indexes: " + ta.getCorpusId() + " index " + tokenIndex );
}

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-comparison

/**
 * display a TextAnnotation object. 
 * 
 * @param ta_
 * @return
 */
public String textAnnotationToString( TextAnnotation ta_ )
{
  String taString = "ID: " + ta_.getId() + "\n" + "Corpus ID: " + ta_.getCorpusId() + "\n";
  taString += "Text: " + ta_.getText() + "\n";

  Set< String > viewNames = ta_.getAvailableViews();
  Iterator< String > it_viewName = viewNames.iterator();
  
  while( it_viewName.hasNext() ) 
  {
    String viewName = it_viewName.next();
    View currentView = ta_.getView( viewName );
    taString += "View " + viewName + ":\n";	
    taString += currentView.toString();
  }
  
  taString += "\n\n----end " + ta_.getId() + "----\n\n";
  
  return taString;
}

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-core-utilities

annotationCache.addTextAnnotation(ta.getCorpusId(), ta);
} catch (Exception e) {
  e.printStackTrace();

代码示例来源:origin: CogComp/cogcomp-nlp

@Override
public boolean addView(TextAnnotation textAnnotation, String viewName, ResourceManager runtimeAttributes) throws AnnotatorException {
  boolean isUpdated = false;
  if (ViewNames.SENTENCE.equals(viewName) || ViewNames.TOKENS.equals(viewName))
    return false;
  if ( !textAnnotation.hasView( viewName )  || forceUpdate ) {
    isUpdated = true;
    if ( !viewProviders.containsKey(viewName) )
      throw new AnnotatorException( "View '" + viewName + "' cannot be provided by this AnnotatorService." );
    Annotator annotator = viewProviders.get( viewName );
    for ( String prereqView : annotator.getRequiredViews() ) {
      addView( textAnnotation, prereqView, runtimeAttributes);
    }
    View v = annotator.getView(textAnnotation, runtimeAttributes);
    textAnnotation.addView( annotator.getViewName(), v );
  }
  if (isUpdated && throwExceptionIfNotCached)
    throwNotCachedException(textAnnotation.getCorpusId(), textAnnotation.getId(), textAnnotation.getText());
  return isUpdated;
}

代码示例来源:origin: CogComp/cogcomp-nlp

annotationCache.addTextAnnotation(ta.getCorpusId(), ta);
} catch (Exception e) {
  e.printStackTrace();

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-core-utilities

@Override
public boolean addView(TextAnnotation textAnnotation, String viewName, ResourceManager runtimeAttributes) throws AnnotatorException {
  boolean isUpdated = false;
  if (ViewNames.SENTENCE.equals(viewName) || ViewNames.TOKENS.equals(viewName))
    return false;
  if ( !textAnnotation.hasView( viewName )  || forceUpdate ) {
    isUpdated = true;
    if ( !viewProviders.containsKey(viewName) )
      throw new AnnotatorException( "View '" + viewName + "' cannot be provided by this AnnotatorService." );
    Annotator annotator = viewProviders.get( viewName );
    for ( String prereqView : annotator.getRequiredViews() ) {
      addView( textAnnotation, prereqView, runtimeAttributes);
    }
    View v = annotator.getView(textAnnotation, runtimeAttributes);
    textAnnotation.addView( annotator.getViewName(), v );
  }
  if (isUpdated && throwExceptionIfNotCached)
    throwNotCachedException(textAnnotation.getCorpusId(), textAnnotation.getId(), textAnnotation.getText());
  return isUpdated;
}

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-core-utilities

writeString("corpusId", ta.getCorpusId(), json);
writeString("id", ta.getId(), json);
writeString("text", ta.getText(), json);

代码示例来源:origin: CogComp/cogcomp-nlp

/**
 * DOES NOT CACHE THE ADDED VIEW!!!
 *
 * @param textAnnotation textAnnotation to be modified
 * @param viewName       name of view to be added
 * @return 'true' if textAnnotation was modified
 * @throws AnnotatorException
 */
@Override
public boolean addView(TextAnnotation textAnnotation, String viewName) throws AnnotatorException {
  boolean isUpdated = false;
  if (ViewNames.SENTENCE.equals(viewName) || ViewNames.TOKENS.equals(viewName))
    return false;
  if ( !textAnnotation.hasView( viewName )  || forceUpdate ) {
    isUpdated = true;
    if ( !viewProviders.containsKey(viewName) )
      throw new AnnotatorException( "View '" + viewName + "' cannot be provided by this AnnotatorService." );
    Annotator annotator = viewProviders.get( viewName );
    for ( String prereqView : annotator.getRequiredViews() ) {
      addView( textAnnotation, prereqView );
    }
    View v = annotator.getView(textAnnotation);
    textAnnotation.addView( annotator.getViewName(), v );
  }
  if (isUpdated && throwExceptionIfNotCached)
    throwNotCachedException(textAnnotation.getCorpusId(), textAnnotation.getId(), textAnnotation.getText());
  return isUpdated;
}

代码示例来源:origin: CogComp/cogcomp-nlp

View nerView = ta.getView(reader.getMentionViewName());
CoNLL2002Writer.writeViewInCoNLL2003Format(nerView, ta,
    conllDir + "/" + ta.getCorpusId() + ".txt");

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-core-utilities

/**
 * DOES NOT CACHE THE ADDED VIEW!!!
 *
 * @param textAnnotation textAnnotation to be modified
 * @param viewName       name of view to be added
 * @return 'true' if textAnnotation was modified
 * @throws AnnotatorException
 */
@Override
public boolean addView(TextAnnotation textAnnotation, String viewName) throws AnnotatorException {
  boolean isUpdated = false;
  if (ViewNames.SENTENCE.equals(viewName) || ViewNames.TOKENS.equals(viewName))
    return false;
  if ( !textAnnotation.hasView( viewName )  || forceUpdate ) {
    isUpdated = true;
    if ( !viewProviders.containsKey(viewName) )
      throw new AnnotatorException( "View '" + viewName + "' cannot be provided by this AnnotatorService." );
    Annotator annotator = viewProviders.get( viewName );
    for ( String prereqView : annotator.getRequiredViews() ) {
      addView( textAnnotation, prereqView );
    }
    View v = annotator.getView(textAnnotation);
    textAnnotation.addView( annotator.getViewName(), v );
  }
  if (isUpdated && throwExceptionIfNotCached)
    throwNotCachedException(textAnnotation.getCorpusId(), textAnnotation.getId(), textAnnotation.getText());
  return isUpdated;
}

代码示例来源:origin: CogComp/cogcomp-nlp

writeString("corpusId", ta.getCorpusId(), json);
writeString("id", ta.getId(), json);
writeString("text", ta.getText(), json);

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-corpusreaders

View nerView = ta.getView(reader.getMentionViewName());
CoNLL2002Writer.writeViewInCoNLL2003Format(nerView, ta,
    conllDir + "/" + ta.getCorpusId() + ".txt");

代码示例来源:origin: CogComp/cogcomp-nlp

@Override
public boolean addView(TextAnnotation ta, String viewName) throws AnnotatorException {
  if (ViewNames.SENTENCE.equals(viewName) || ViewNames.TOKENS.equals(viewName))
    return false;
  if (!viewProviders.containsKey(viewName))
    throw new AnnotatorException("View " + viewName + " is not supported.");
  boolean isUpdated = false;
  if (ta.hasView(viewName))
    return false;
  if (annotationCache != null && annotationCache.contains(ta)) {
    TextAnnotation taFromCache = annotationCache.getTextAnnotation(ta);
    if(taFromCache.getAvailableViews().contains(viewName)) {
      ta.addView(viewName, taFromCache.getView(viewName));
      return false;
    }
  }
  Annotator annotator = viewProviders.get(viewName);
  for (String prereqView : annotator.getRequiredViews())
    isUpdated = addView(ta, prereqView);
  ta.addView(annotator);
  if (annotationCache != null ) {
    if(annotationCache.contains(ta))
      annotationCache.updateTextAnnotation(ta);
    else
      annotationCache.addTextAnnotation(ta.getCorpusId(), ta);
  }
  return isUpdated;
}

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-corpusreaders

String text = goldTa.getText();
TextAnnotation predTa = taBldr.createTextAnnotation(goldTa.getCorpusId() + "_PREDICTED", goldTa.getId(), text);

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-curator

@Override
public boolean addView(TextAnnotation ta, String viewName) throws AnnotatorException {
  if (ViewNames.SENTENCE.equals(viewName) || ViewNames.TOKENS.equals(viewName))
    return false;
  if (!viewProviders.containsKey(viewName))
    throw new AnnotatorException("View " + viewName + " is not supported.");
  boolean isUpdated = false;
  if (ta.hasView(viewName))
    return false;
  if (annotationCache != null && annotationCache.contains(ta)) {
    TextAnnotation taFromCache = annotationCache.getTextAnnotation(ta);
    if(taFromCache.getAvailableViews().contains(viewName)) {
      ta.addView(viewName, taFromCache.getView(viewName));
      return false;
    }
  }
  Annotator annotator = viewProviders.get(viewName);
  for (String prereqView : annotator.getRequiredViews())
    isUpdated = addView(ta, prereqView);
  ta.addView(annotator);
  if (annotationCache != null ) {
    if(annotationCache.contains(ta))
      annotationCache.updateTextAnnotation(ta);
    else
      annotationCache.addTextAnnotation(ta.getCorpusId(), ta);
  }
  return isUpdated;
}

代码示例来源:origin: CogComp/cogcomp-nlp

String text = goldTa.getText();
TextAnnotation predTa = taBldr.createTextAnnotation(goldTa.getCorpusId() + "_PREDICTED", goldTa.getId(), text);

代码示例来源:origin: CogComp/cogcomp-nlp

throwNotCachedException(textAnnotation.getCorpusId(), textAnnotation.getId(),
      textAnnotation.getText());
return isUpdated;

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-nlp-pipeline

throwNotCachedException(textAnnotation.getCorpusId(), textAnnotation.getId(),
      textAnnotation.getText());
return isUpdated;

代码示例来源:origin: CogComp/cogcomp-nlp

taBuilder.setCorpusId(ta.getCorpusId());
taBuilder.setId(ta.getId());
taBuilder.setText(ta.getText());

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-core-utilities

taBuilder.setCorpusId(ta.getCorpusId());
taBuilder.setId(ta.getId());
taBuilder.setText(ta.getText());

相关文章