congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
TextAnnotation.getText
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: edu.illinois.cs.cogcomp/illinois-core-utilities

public String toString() {
  return "TextAnnotation: " + this.getText();
}
origin: edu.illinois.cs.cogcomp/illinois-comparison

String getOriginalText() 
{
  return m_text.getText();
}

origin: edu.illinois.cs.cogcomp/illinois-comparison

String getOriginalHyp()
{
  return m_hyp.getText();
}

origin: CogComp/cogcomp-nlp

public String toString() {
  return "TextAnnotation: " + this.getText();
}
origin: CogComp/cogcomp-nlp

public static String printTextAnnotation(TextAnnotation ta ) throws IOException
{
  StringBuilder bldr = new StringBuilder();
  bldr.append( "TextAnnotation for text: " );
  bldr.append( ta.getText() );
  for ( String vName: ta.getAvailableViews() ) {
    bldr.append(printView( ta.getView( vName )));
  }
  return bldr.toString();
}
origin: edu.illinois.cs.cogcomp/illinois-core-utilities

public static String printTextAnnotation(TextAnnotation ta ) throws IOException
{
  StringBuilder bldr = new StringBuilder();
  bldr.append( "TextAnnotation for text: " );
  bldr.append( ta.getText() );
  for ( String vName: ta.getAvailableViews() ) {
    bldr.append(printView( ta.getView( vName )));
  }
  return bldr.toString();
}
origin: CogComp/cogcomp-nlp

@Override
public String getText() {
  int start = sentenceConstituent.getStartCharOffset();
  int end = sentenceConstituent.getEndCharOffset();
  return textAnnotation.getText().substring(start, end);
}
origin: edu.illinois.cs.cogcomp/illinois-core-utilities

@Override
public String getText() {
  int start = sentenceConstituent.getStartCharOffset();
  int end = sentenceConstituent.getEndCharOffset();
  return textAnnotation.getText().substring(start, end);
}
origin: CogComp/cogcomp-nlp

static public void printTextAnnotation(PrintStream out, TextAnnotation ta) {
  out.println("TextAnnotation with id: " + ta.getId());
  String rawText = ta.getText();
  out.println("Raw Text: " + rawText);
  out.println(getLineFill());
  out.println("TextAnnotation Views:");
  for (String name : ta.getAvailableViews()) {
    out.println("View Name: " + name);
    out.println(ta.getView(name).toString());
    out.println(getLineFill());
  }
}
origin: edu.illinois.cs.cogcomp/illinois-core-utilities

static public void printTextAnnotation(PrintStream out, TextAnnotation ta) {
  out.println("TextAnnotation with id: " + ta.getId());
  String rawText = ta.getText();
  out.println("Raw Text: " + rawText);
  out.println(getLineFill());
  out.println("TextAnnotation Views:");
  for (String name : ta.getAvailableViews()) {
    out.println("View Name: " + name);
    out.println(ta.getView(name).toString());
    out.println(getLineFill());
  }
}
origin: CogComp/cogcomp-nlp

  protected String getNERString() {
    List<Constituent> constituents = new ArrayList<>(view.getConstituents());
    Collections.sort(constituents, TextAnnotationUtilities.constituentStartComparator);
    StringBuilder sb = new StringBuilder();
    String text = textAnnotation.getText();
    int where = 0;
    for (Constituent c : constituents) {
      int start = c.getStartCharOffset();
      String startstring = text.substring(where, start);
      sb.append(startstring).append("[").append(c.getLabel()).append(" ")
          .append(c.getTokenizedSurfaceForm()).append(" ] ");
      where = c.getEndCharOffset();
    }
    return sb.toString();
  }
}
origin: CogComp/cogcomp-nlp

public void addView(TextAnnotation ta, boolean overwrite) {
  TextAnnotation newTA = null;
  try {
    newTA = annotate(ta.getText(), overwrite);
  } catch (Exception e) {
    e.printStackTrace();
  }
  for (String vu : viewsToAdd) {
    ta.addView(vu, newTA.getView(vu));
  }
}
origin: edu.illinois.cs.cogcomp/illinois-pipeline-client

public void addView(TextAnnotation ta, boolean overwrite) {
  TextAnnotation newTA = null;
  try {
    newTA = annotate(ta.getText(), overwrite);
  } catch (Exception e) {
    e.printStackTrace();
  }
  for (String vu : viewsToAdd) {
    ta.addView(vu, newTA.getView(vu));
  }
}
origin: CogComp/cogcomp-nlp

public VerbSenseLabeler() throws Exception {
  WordNetManager.loadConfigAsClasspathResource(true);
  log.info("Initializing pre-processor");
  TextPreProcessor.initialize();
  log.info("Creating manager");
  manager = VerbSenseClassifierMain.getManager(false);
  log.info("Loading models");
  loadModel();
  TextAnnotation ta = initializeDummySentenceVerb();
  log.info("Testing on sentence {}", ta.getText());
  TokenLabelView prediction = getPrediction(ta);
  log.info("Output: {}", prediction.toString());
}
origin: edu.illinois.cs.cogcomp/illinois-verbsense

public VerbSenseLabeler() throws Exception {
  WordNetManager.loadConfigAsClasspathResource(true);
  log.info("Initializing pre-processor");
  TextPreProcessor.initialize();
  log.info("Creating manager");
  manager = VerbSenseClassifierMain.getManager(false);
  log.info("Loading models");
  loadModel();
  TextAnnotation ta = initializeDummySentenceVerb();
  log.info("Testing on sentence {}", ta.getText());
  TokenLabelView prediction = getPrediction(ta);
  log.info("Output: {}", prediction.toString());
}
origin: CogComp/cogcomp-nlp

  public TokenLabelView getPrediction(TextAnnotation ta) throws Exception {
    log.debug("Input: {}", ta.getText());
    List<Constituent> predicates = manager.getPredicateDetector().getPredicates(ta);
    // If there are no verb identified, return an empty TokenLabelView
    if (predicates.isEmpty())
      return new TokenLabelView(SenseManager.getPredictedViewName(),
          VerbSenseConstants.systemIdentifier, ta, 1.0);

    ILPSolverFactory solver =
        new ILPSolverFactory(ILPSolverFactory.SolverType.JLISCuttingPlaneGurobi);
    ILPInference inference = manager.getInference(solver, predicates);
    return inference.getOutputView();
  }
}
origin: edu.illinois.cs.cogcomp/illinois-verbsense

  public TokenLabelView getPrediction(TextAnnotation ta) throws Exception {
    log.debug("Input: {}", ta.getText());
    List<Constituent> predicates = manager.getPredicateDetector().getPredicates(ta);
    // If there are no verb identified, return an empty TokenLabelView
    if (predicates.isEmpty())
      return new TokenLabelView(SenseManager.getPredictedViewName(),
          VerbSenseConstants.systemIdentifier, ta, 1.0);

    ILPSolverFactory solver =
        new ILPSolverFactory(ILPSolverFactory.SolverType.JLISCuttingPlaneGurobi);
    ILPInference inference = manager.getInference(solver, predicates);
    return inference.getOutputView();
  }
}
origin: edu.illinois.cs.cogcomp/illinois-srl

public PredicateArgumentView getSRL(TextAnnotation ta) throws Exception {
  log.debug("Input: {}", ta.getText());
  List<Constituent> predicates;
  if (manager.getSRLType() == SRLType.Verb)
    predicates = manager.getHeuristicPredicateDetector().getPredicates(ta);
  else
    predicates = manager.getLearnedPredicateDetector().getPredicates(ta);
  if (predicates.isEmpty())
    return null;
  ILPSolverFactory s = new ILPSolverFactory(properties.getILPSolverType(false));
  SRLILPInference inference = new SRLILPInference(s, manager, predicates);
  return inference.getOutputView();
}
origin: edu.illinois.cs.cogcomp/illinois-core-utilities

/**
 * given a {@link TextAnnotation} for a sentence with annotations, map its annotations into a
 * TextAnnotation object for a longer text containing that sentence.
 * @param sentenceTa annotated TextAnnotation for sentence
 * @param textTa TextAnnotation for longer text containing sentence, without annotations for that sentence
 * @param sentenceId index of the sentence in the longer text
 */
static public void mapSentenceAnnotationsToText(TextAnnotation sentenceTa, TextAnnotation textTa, int sentenceId ) {
  assert(sentenceId < textTa.getNumberOfSentences());
  assert(sentenceTa.getText().equals(textTa.getSentence(sentenceId).getText()));
  int start = textTa.getSentence(sentenceId).getStartSpan();
  int end = textTa.getSentence(sentenceId).getEndSpan();
  copyViewsFromTo(sentenceTa, textTa, start, end, start);
}
origin: CogComp/cogcomp-nlp

/**
 * given a {@link TextAnnotation} for a sentence with annotations, map its annotations into a
 * TextAnnotation object for a longer text containing that sentence.
 * @param sentenceTa annotated TextAnnotation for sentence
 * @param textTa TextAnnotation for longer text containing sentence, without annotations for that sentence
 * @param sentenceId index of the sentence in the longer text
 */
static public void mapSentenceAnnotationsToText(TextAnnotation sentenceTa, TextAnnotation textTa, int sentenceId ) {
  assert(sentenceId < textTa.getNumberOfSentences());
  assert(sentenceTa.getText().equals(textTa.getSentence(sentenceId).getText()));
  int start = textTa.getSentence(sentenceId).getStartSpan();
  int end = textTa.getSentence(sentenceId).getEndSpan();
  copyViewsFromTo(sentenceTa, textTa, start, end, start);
}
edu.illinois.cs.cogcomp.core.datastructures.textannotationTextAnnotationgetText

Popular methods of TextAnnotation

  • addView
  • getView
  • hasView
  • 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
  • <init>
  • getAvailableViews,
  • <init>,
  • getSentenceId,
  • getTokenizedText,
  • getCorpusId,
  • getSentenceFromToken,
  • getTokensInSpan,
  • sentences,
  • addAttribute

Popular in Java

  • Finding current android device location
  • setContentView (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • addToBackStack (FragmentTransaction)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • JFileChooser (javax.swing)
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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