Codota Logo
TextAnnotation.getTokensInSpan
Code IndexAdd Codota to your IDE (free)

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

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: edu.illinois.cs.cogcomp/illinois-core-utilities

private void initializeTokens() {
  if (tokens == null) {
    tokens = textAnnotation.getTokensInSpan(this.getStartSpan(), this.getEndSpan());
  }
}
origin: CogComp/cogcomp-nlp

private void initializeTokens() {
  if (tokens == null) {
    tokens = textAnnotation.getTokensInSpan(this.getStartSpan(), this.getEndSpan());
  }
}
origin: CogComp/cogcomp-nlp

logger.error("treebank text:");
StringBuffer sb = new StringBuffer();
for (String t : treeta.getTokensInSpan(start, end)) {
  sb.append(t);
  sb.append(" ");
origin: edu.illinois.cs.cogcomp/saul-examples

public String getText() {
  return getSpan() != null ?
      String.join("_", getTextAnnotation().getTokensInSpan(getSpan().getFirst(),
          getSpan().getSecond())).toLowerCase() :
      "[undefined]";
}
origin: edu.illinois.cs.cogcomp/illinois-corpusreaders

logger.error("treebank text:");
StringBuffer sb = new StringBuffer();
for (String t : treeta.getTokensInSpan(start, end)) {
  sb.append(t);
  sb.append(" ");
origin: CogComp/cogcomp-nlp

  @Override
  protected void addView(TextAnnotation ta) throws AnnotatorException {
    SpanLabelView datalessView = new SpanLabelView(getViewName(), getClassName(), ta, 1d, true);

    List<Constituent> tokens = ta.getView(ViewNames.TOKENS).getConstituents();

    int numTokens = tokens.size();

    int textStart = tokens.get(0).getSpan().getFirst();
    int textEnd = tokens.get(numTokens - 1).getSpan().getSecond();

    StringBuilder sb = new StringBuilder();

    for (String s : ta.getTokensInSpan(textStart, textEnd)) {
      sb.append(s);
      sb.append(" ");
    }

    SparseVector<Integer> docVector = embedding.getVector(sb.toString().trim());

    Set<String> labelIDs = classifier.getFlatPredictions(docVector, topK);

    for (String labelID : labelIDs) {
      datalessView.addSpanLabel(textStart, textEnd, labelID, 1d);
    }

    ta.addView(getViewName(), datalessView);
  }
}
origin: edu.illinois.cs.cogcomp/illinois-datalessclassification

  @Override
  protected void addView(TextAnnotation ta) throws AnnotatorException {
    SpanLabelView datalessView = new SpanLabelView(getViewName(), getClassName(), ta, 1d, true);

    List<Constituent> tokens = ta.getView(ViewNames.TOKENS).getConstituents();

    int numTokens = tokens.size();

    int textStart = tokens.get(0).getSpan().getFirst();
    int textEnd = tokens.get(numTokens - 1).getSpan().getSecond();

    StringBuilder sb = new StringBuilder();

    for (String s : ta.getTokensInSpan(textStart, textEnd)) {
      sb.append(s);
      sb.append(" ");
    }

    SparseVector<Integer> docVector = embedding.getVector(sb.toString().trim());

    Set<String> labelIDs = classifier.getFlatPredictions(docVector, topK);

    for (String labelID : labelIDs) {
      datalessView.addSpanLabel(textStart, textEnd, labelID, 1d);
    }

    ta.addView(getViewName(), datalessView);
  }
}
origin: CogComp/talen

String text = StringUtils.join(" ", ta.getTokensInSpan(starttokint, endtokint));
origin: CogComp/talen

String[] spantoks = ta.getTokensInSpan(tokspan.getFirst(), tokspan.getSecond());
String text = StringUtils.join(" ", spantoks);
edu.illinois.cs.cogcomp.core.datastructures.textannotationTextAnnotationgetTokensInSpan

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,
  • getCorpusId,
  • getSentenceFromToken,
  • sentences,
  • addAttribute

Popular in Java

  • Start an intent from android
  • runOnUiThread (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • KeyStore (java.security)
    This class represents an in-memory collection of keys and certificates. It manages two types of entr
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Runner (org.openjdk.jmh.runner)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now