Tabnine Logo
TextAnnotation.getCorpusId
Code IndexAdd Tabnine to your IDE (free)

How to use
getCorpusId
method
in
edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation

Best Java code snippets using edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation.getCorpusId (Showing top 20 results out of 315)

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());
edu.illinois.cs.cogcomp.core.datastructures.textannotationTextAnnotationgetCorpusId

Popular methods of TextAnnotation

  • addView
  • getView
  • hasView
  • getText
  • getId
  • getSentence
  • getTokens
  • getToken
  • getNumberOfSentences
  • size
  • getTokenIdFromCharacterOffset
    Get the position of token that corresponds to the character offset that is passed as a parameter. Th
  • getAvailableViews
  • getTokenIdFromCharacterOffset,
  • getAvailableViews,
  • <init>,
  • getSentenceId,
  • getTokenizedText,
  • getSentenceFromToken,
  • getTokensInSpan,
  • sentences,
  • addAttribute

Popular in Java

  • Start an intent from android
  • getApplicationContext (Context)
  • getSupportFragmentManager (FragmentActivity)
  • getContentResolver (Context)
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now