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

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

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

origin: CogComp/cogcomp-nlp

/**
 * Gets the sentence containing the specified token
 */
public Sentence getSentenceFromToken(int tokenId) {
  return this.getSentence(this.getSentenceId(tokenId));
}
origin: edu.illinois.cs.cogcomp/illinois-core-utilities

/**
 * Gets the sentence containing the specified token
 */
public Sentence getSentenceFromToken(int tokenId) {
  return this.getSentence(this.getSentenceId(tokenId));
}
origin: edu.illinois.cs.cogcomp/illinois-core-utilities

public int getSentenceId(Constituent constituent) {
  return getSentenceId(constituent.getStartSpan());
}
origin: CogComp/cogcomp-nlp

public int getSentenceId(Constituent constituent) {
  return getSentenceId(constituent.getStartSpan());
}
origin: CogComp/cogcomp-nlp

public int getSentenceId() {
  return this.textAnnotation.getSentenceId(this.getStartSpan());
}
origin: edu.illinois.cs.cogcomp/illinois-core-utilities

public int getSentenceId() {
  return this.textAnnotation.getSentenceId(this.getStartSpan());
}
origin: edu.illinois.cs.cogcomp/illinois-core-utilities

/**
 * Return the identifier of the sentence that contains this constituent. No sentence contains
 * this constituent (that is, if this constituent is an implicit one), then return -1.
 */
public int getSentenceId() {
  try {
    return this.getTextAnnotation().getSentenceId(this.getStartSpan());
  } catch (Exception e) {
    return -1;
  }
}
origin: CogComp/cogcomp-nlp

/**
 * Return the identifier of the sentence that contains this constituent. No sentence contains
 * this constituent (that is, if this constituent is an implicit one), then return -1.
 */
public int getSentenceId() {
  try {
    return this.getTextAnnotation().getSentenceId(this.getStartSpan());
  } catch (Exception e) {
    return -1;
  }
}
origin: CogComp/cogcomp-nlp

/**
 * Gets the root constituent of the tree for the given sentence
 */
public Constituent getRootConstituent(Sentence sentence) {
  if (this.roots == null) {
    findRoots();
  }
  return this.roots.get(this.getTextAnnotation().getSentenceId(
      sentence.getSentenceConstituent()));
}
origin: edu.illinois.cs.cogcomp/illinois-core-utilities

/**
 * Gets the root constituent of the tree for the given sentence
 */
public Constituent getRootConstituent(Sentence sentence) {
  if (this.roots == null) {
    findRoots();
  }
  return this.roots.get(this.getTextAnnotation().getSentenceId(
      sentence.getSentenceConstituent()));
}
origin: CogComp/cogcomp-nlp

private static Tree<Pair<String, IntPair>> getTokenIndexedTreeCovering(Constituent predicate,
    String parseViewName) {
  TextAnnotation ta = predicate.getTextAnnotation();
  int sentenceId = ta.getSentenceId(predicate);
  Tree<String> tree = getParseTree(parseViewName, ta, sentenceId);
  int sentenceStartSpan = ta.getSentence(sentenceId).getStartSpan();
  int start = predicate.getStartSpan() - sentenceStartSpan;
  int end = predicate.getEndSpan() - sentenceStartSpan;
  return getTokenIndexedTreeCovering(tree, start, end);
}
origin: CogComp/cogcomp-nlp

private static Tree<Pair<String, IntPair>> getTokenIndexedTreeCovering(Constituent predicate,
    String parseViewName) {
  TextAnnotation ta = predicate.getTextAnnotation();
  int sentenceId = ta.getSentenceId(predicate);
  Tree<String> tree = ParseHelper.getParseTree(parseViewName, ta, sentenceId);
  int sentenceStartSpan = ta.getSentence(sentenceId).getStartSpan();
  int start = predicate.getStartSpan() - sentenceStartSpan;
  int end = predicate.getEndSpan() - sentenceStartSpan;
  return ParseHelper.getTokenIndexedTreeCovering(tree, start, end);
}
origin: edu.illinois.cs.cogcomp/illinois-edison

private static Tree<Pair<String, IntPair>> getTokenIndexedTreeCovering(Constituent predicate,
    String parseViewName) {
  TextAnnotation ta = predicate.getTextAnnotation();
  int sentenceId = ta.getSentenceId(predicate);
  Tree<String> tree = ParseHelper.getParseTree(parseViewName, ta, sentenceId);
  int sentenceStartSpan = ta.getSentence(sentenceId).getStartSpan();
  int start = predicate.getStartSpan() - sentenceStartSpan;
  int end = predicate.getEndSpan() - sentenceStartSpan;
  return ParseHelper.getTokenIndexedTreeCovering(tree, start, end);
}
origin: edu.illinois.cs.cogcomp/illinois-core-utilities

private static Tree<Pair<String, IntPair>> getTokenIndexedTreeCovering(Constituent predicate,
    String parseViewName) {
  TextAnnotation ta = predicate.getTextAnnotation();
  int sentenceId = ta.getSentenceId(predicate);
  Tree<String> tree = getParseTree(parseViewName, ta, sentenceId);
  int sentenceStartSpan = ta.getSentence(sentenceId).getStartSpan();
  int start = predicate.getStartSpan() - sentenceStartSpan;
  int end = predicate.getEndSpan() - sentenceStartSpan;
  return getTokenIndexedTreeCovering(tree, start, end);
}
origin: edu.illinois.cs.cogcomp/illinois-edison

public static Tree<Pair<String, IntPair>> getTokenIndexedCleanedParseTreeNodeCovering(
    Constituent c, String parseViewName) {
  TextAnnotation ta = c.getTextAnnotation();
  Tree<String> tree = getParseTree(parseViewName, ta, ta.getSentenceId(c));
  int start = c.getStartSpan();
  int end = c.getEndSpan();
  tree = ParseUtils.snipNullNodes(tree);
  tree = ParseUtils.stripFunctionTags(tree);
  tree = ParseUtils.stripIndexReferences(tree);
  return getTokenIndexedTreeCovering(tree, start, end);
}
origin: CogComp/cogcomp-nlp

public static Tree<Pair<String, IntPair>> getTokenIndexedCleanedParseTreeNodeCovering(
    Constituent c, String parseViewName) {
  TextAnnotation ta = c.getTextAnnotation();
  Tree<String> tree = getParseTree(parseViewName, ta, ta.getSentenceId(c));
  int start = c.getStartSpan();
  int end = c.getEndSpan();
  tree = ParseUtils.snipNullNodes(tree);
  tree = ParseUtils.stripFunctionTags(tree);
  tree = ParseUtils.stripIndexReferences(tree);
  return getTokenIndexedTreeCovering(tree, start, end);
}
origin: CogComp/cogcomp-nlp

public static Tree<Pair<String, IntPair>> getTokenIndexedCleanedParseTreeNodeCovering(
    Constituent c, String parseViewName) {
  TextAnnotation ta = c.getTextAnnotation();
  Tree<String> tree = getParseTree(parseViewName, ta, ta.getSentenceId(c));
  int start = c.getStartSpan();
  int end = c.getEndSpan();
  tree = ParseUtils.snipNullNodes(tree);
  tree = ParseUtils.stripFunctionTags(tree);
  tree = ParseUtils.stripIndexReferences(tree);
  return getTokenIndexedTreeCovering(tree, start, end);
}
origin: edu.illinois.cs.cogcomp/illinois-core-utilities

public static Tree<Pair<String, IntPair>> getTokenIndexedCleanedParseTreeNodeCovering(
    Constituent c, String parseViewName) {
  TextAnnotation ta = c.getTextAnnotation();
  Tree<String> tree = getParseTree(parseViewName, ta, ta.getSentenceId(c));
  int start = c.getStartSpan();
  int end = c.getEndSpan();
  tree = ParseUtils.snipNullNodes(tree);
  tree = ParseUtils.stripFunctionTags(tree);
  tree = ParseUtils.stripIndexReferences(tree);
  return getTokenIndexedTreeCovering(tree, start, end);
}
origin: edu.illinois.cs.cogcomp/illinois-caching-curator

public static TreeView alignForestToDependencyView(String viewName, TextAnnotation ta, Forest dep) {
  TreeView view = new TreeView(viewName, dep.getSource(), ta, 0.0d);
  for (edu.illinois.cs.cogcomp.thrift.base.Tree tree : dep.getTrees()) {
    int topId = tree.getTop();
    List<Node> nodes = tree.getNodes();
    int topTokenStart = nodes.get(topId).getSpan().getStart();
    int topTokenId = ta.getTokenIdFromCharacterOffset(topTokenStart);
    int sentenceId = ta.getSentenceId(topTokenId);
    Tree<Pair<String, Integer>> dependencyTree = makeDependencyTree(ta, tree);
    double score = tree.getScore();
    view.setDependencyTree(sentenceId, dependencyTree, score);
  }
  return view;
}
origin: CogComp/cogcomp-nlp

public static TreeView alignForestToDependencyView(String viewName, TextAnnotation ta,
    Forest dep) {
  TreeView view = new TreeView(viewName, dep.getSource(), ta, 0.0d);
  for (edu.illinois.cs.cogcomp.thrift.base.Tree tree : dep.getTrees()) {
    int topId = tree.getTop();
    List<Node> nodes = tree.getNodes();
    int topTokenStart = nodes.get(topId).getSpan().getStart();
    int topTokenId = ta.getTokenIdFromCharacterOffset(topTokenStart);
    int sentenceId = ta.getSentenceId(topTokenId);
    Tree<Pair<String, Integer>> dependencyTree = makeDependencyTree(ta, tree);
    double score = tree.getScore();
    view.setDependencyTree(sentenceId, dependencyTree, score);
  }
  return view;
}
edu.illinois.cs.cogcomp.core.datastructures.textannotationTextAnnotationgetSentenceId

Javadoc

Gets the index of the sentence that contains the token, indexed by tokenPosition. If no sentence contains the token, then this function throws an IllegalArgumentException. The sentence index can further be used to get the Sentence itself by calling edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation#getSentence(int).

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

Popular in Java

  • Reactive rest calls using spring rest template
  • getContentResolver (Context)
  • getSharedPreferences (Context)
  • startActivity (Activity)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top PhpStorm plugins
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