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

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

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

origin: CogComp/cogcomp-nlp

public int getNumberOfSentences() {
  return this.sentences().size();
}
origin: edu.illinois.cs.cogcomp/illinois-core-utilities

public int getNumberOfSentences() {
  return this.sentences().size();
}
origin: CogComp/cogcomp-nlp

public Sentence getSentence(int sentenceId) {
  return this.sentences().get(sentenceId);
}
origin: edu.illinois.cs.cogcomp/illinois-core-utilities

public Sentence getSentence(int sentenceId) {
  return this.sentences().get(sentenceId);
}
origin: CogComp/cogcomp-nlp

@Override
public int hashCode() {
  int hashCode = this.corpusId.hashCode() * 13 + this.id.hashCode() * 17 + this.text.hashCode() * 19
      + (tokens == null ? 0 : Arrays.hashCode(tokens) * 43)
      + (this.sentences().hashCode() * 31);
  hashCode += (this.attributes == null ? 0 : this.attributes.hashCode() * 13);
  return hashCode;
}
origin: edu.illinois.cs.cogcomp/illinois-core-utilities

@Override
public int hashCode() {
  int hashCode = this.corpusId.hashCode() * 13 + this.id.hashCode() * 17 + this.text.hashCode() * 19
      + (tokens == null ? 0 : Arrays.hashCode(tokens) * 43)
      + (this.sentences().hashCode() * 31);
  hashCode += (this.attributes == null ? 0 : this.attributes.hashCode() * 13);
  return hashCode;
}
origin: CogComp/cogcomp-nlp

public static List<String> getSentenceList(TextAnnotation ta) {
  List<String> sentencesList = new ArrayList<>();
  for (Sentence sentence : ta.sentences()) {
    String sentenceString = sentence.getTokenizedText().trim();
    sentencesList.add(sentenceString);
  }
  return sentencesList;
}
origin: edu.illinois.cs.cogcomp/illinois-core-utilities

public static List<String> getSentenceList(TextAnnotation ta) {
  List<String> sentencesList = new ArrayList<>();
  for (Sentence sentence : ta.sentences()) {
    String sentenceString = sentence.getTokenizedText().trim();
    sentencesList.add(sentenceString);
  }
  return sentencesList;
}
origin: CogComp/cogcomp-nlp

@Override
public boolean equals(Object obj) {
  if (this == obj)
    return true;
  if (!(obj instanceof TextAnnotation))
    return false;
  TextAnnotation that = (TextAnnotation) obj;
  if (!this.corpusId.equals(that.corpusId) || !this.id.equals(that.id)
      || !this.text.equals(that.text))
    return false;
  if (this.attributes == null && that.attributes != null)
    return false;
  if (this.attributes != null && that.attributes == null)
    return false;
  if (this.attributes != null && !this.attributes.equals(that.attributes))
    return false;
  if (this.tokens == null && that.tokens == null)
    return true;
  else if (this.tokens == null)
    return false;
  else if (that.tokens == null)
    return false;
  if (this.tokens.length != that.tokens.length)
    return false;
  for (int i = 0; i < this.tokens.length; i++) {
    if (!this.tokens[i].equals(that.tokens[i]))
      return false;
  }
  return this.sentences().equals(that.sentences());
}
origin: CogComp/cogcomp-nlp

public List<Sentence> getSentenceFromTokens(Set<Integer> tokens) {
  List<Sentence> mySentences = new ArrayList<>();
  Set<Integer> sentencesSeen = new HashSet<>();
  for (Sentence s : sentences()) {
    for (int token : tokens) {
      if (s.getSentenceConstituent().doesConstituentCover(token)) {
        if (!sentencesSeen.contains(s.getStartSpan())) {
          mySentences.add(s);
          sentencesSeen.add(s.getStartSpan());
        }
        break;
      }
    }
  }
  return mySentences;
}
origin: edu.illinois.cs.cogcomp/illinois-core-utilities

public List<Sentence> getSentenceFromTokens(Set<Integer> tokens) {
  List<Sentence> mySentences = new ArrayList<>();
  Set<Integer> sentencesSeen = new HashSet<>();
  for (Sentence s : sentences()) {
    for (int token : tokens) {
      if (s.getSentenceConstituent().doesConstituentCover(token)) {
        if (!sentencesSeen.contains(s.getStartSpan())) {
          mySentences.add(s);
          sentencesSeen.add(s.getStartSpan());
        }
        break;
      }
    }
  }
  return mySentences;
}
origin: CogComp/cogcomp-nlp

public static void main(String[] args) {
  String text = "สตาร์คราฟต์   เป็นวิดีโอเกมประเภทวางแผนเรียลไทม์และบันเทิงคดีวิทยาศาสตร์การทหาร พัฒนาและจัดจำหน่ายโดยบลิซซาร์ด เอ็นเตอร์เทนเมนต์ ออกบนระบบปฏิบัติการไมโครซอฟท์ วินโดวส์เมื่อวันที่ 31 มีนาคม 2541 ต่อมา เกมขยายเป็นแฟรนไชส์ และเป็นเกมแรกของซีรีส์สตาร์คราฟต์ รุ่นแมคโอเอสออกในเดือนมีนาคม 2542 และรุ่นดัดแปลงนินเทนโด 64 ซึ่งพัฒนาร่วมกับแมสมีเดีย ออกในวันที่ 13 มิถุนายน 2543 การพัฒนาเกมนี้เริ่มขึ้นไม่นานหลังวอร์คราฟต์ 2: ไทด์สออฟดาร์กเนส ออกในปี 2538 สตาร์คราฟต์เปิดตัวในงานอี3 ปี 2539 ซึ่งเป็นที่ชื่นชอบน้อยกว่าวอร์คราฟต์ 2 ฉะนั้น โครงการจึงถูกพลิกโฉมทั้งหมดแล้วแสดงต่อสาธารณะในต้นปี 2540 ซึ่งได้รับการตอบรับดีกว่ามาก";
  text = "    2507  การสืบสวนของคณะกรรมการสมาชิกผู้แทนราษฎรสหรัฐว่าด้วยการลอบสังหารประธานาธิบดี (hsca) ระหว่าง - พศ 2522  และการสืบสวนของรัฐบาล สรุปว่าประธานาธิบดีถูกลอบสังหารโดยลี ฮาร์วีย์ ออสวอลด์ ซึ่งในเวล\n";
  ThaiTokenizer token = new ThaiTokenizer();
  TextAnnotation ta = token.getTextAnnotation(text);
  for(Sentence sen: ta.sentences()){
    System.out.println(sen.getTokenizedText());
  }
}
origin: edu.illinois.cs.cogcomp/wikipediaAPI-multilingual

public static void main(String[] args) {
  String text = "สตาร์คราฟต์   เป็นวิดีโอเกมประเภทวางแผนเรียลไทม์และบันเทิงคดีวิทยาศาสตร์การทหาร พัฒนาและจัดจำหน่ายโดยบลิซซาร์ด เอ็นเตอร์เทนเมนต์ ออกบนระบบปฏิบัติการไมโครซอฟท์ วินโดวส์เมื่อวันที่ 31 มีนาคม 2541 ต่อมา เกมขยายเป็นแฟรนไชส์ และเป็นเกมแรกของซีรีส์สตาร์คราฟต์ รุ่นแมคโอเอสออกในเดือนมีนาคม 2542 และรุ่นดัดแปลงนินเทนโด 64 ซึ่งพัฒนาร่วมกับแมสมีเดีย ออกในวันที่ 13 มิถุนายน 2543 การพัฒนาเกมนี้เริ่มขึ้นไม่นานหลังวอร์คราฟต์ 2: ไทด์สออฟดาร์กเนส ออกในปี 2538 สตาร์คราฟต์เปิดตัวในงานอี3 ปี 2539 ซึ่งเป็นที่ชื่นชอบน้อยกว่าวอร์คราฟต์ 2 ฉะนั้น โครงการจึงถูกพลิกโฉมทั้งหมดแล้วแสดงต่อสาธารณะในต้นปี 2540 ซึ่งได้รับการตอบรับดีกว่ามาก";
  text = "    2507  การสืบสวนของคณะกรรมการสมาชิกผู้แทนราษฎรสหรัฐว่าด้วยการลอบสังหารประธานาธิบดี (hsca) ระหว่าง - พศ 2522  และการสืบสวนของรัฐบาล สรุปว่าประธานาธิบดีถูกลอบสังหารโดยลี ฮาร์วีย์ ออสวอลด์ ซึ่งในเวล\n";
  ThaiTokenizer token = new ThaiTokenizer();
  TextAnnotation ta = token.getTextAnnotation(text);
  for(Sentence sen: ta.sentences()){
    System.out.println(sen.getTokenizedText());
  }
}
origin: CogComp/cogcomp-nlp

private void findRoots() {
  if (roots == null)
    roots = new TIntObjectHashMap<>();
  for (int i = 0; i < this.textAnnotation.sentences().size(); ++i)
    if(null == roots.get(i))
      roots.put(i, getTreeRoot(this.textAnnotation.getSentence(i)));
}
origin: edu.illinois.cs.cogcomp/illinois-core-utilities

private void findRoots() {
  if (roots == null)
    roots = new TIntObjectHashMap<>();
  for (int i = 0; i < this.textAnnotation.sentences().size(); ++i)
    if(null == roots.get(i))
      roots.put(i, getTreeRoot(this.textAnnotation.getSentence(i)));
}
origin: edu.illinois.cs.cogcomp/illinois-core-utilities

private static void writeSentences(TextAnnotation ta, JsonObject json) {
  JsonObject object = new JsonObject();
  SpanLabelView sentenceView = (SpanLabelView) ta.getView(ViewNames.SENTENCE);
  writeString("generator", sentenceView.getViewGenerator(), object);
  writeDouble("score", sentenceView.getScore(), object);
  int numSentences = sentenceView.getNumberOfConstituents();
  int[] sentenceEndPositions = new int[numSentences];
  int id = 0;
  for (Sentence sentence : ta.sentences()) {
    sentenceEndPositions[id++] = sentence.getEndSpan();
  }
  writeIntArray("sentenceEndPositions", sentenceEndPositions, object);
  json.add("sentences", object);
}
origin: CogComp/cogcomp-nlp

private static void writeSentences(TextAnnotation ta, JsonObject json) {
  JsonObject object = new JsonObject();
  SpanLabelView sentenceView = (SpanLabelView) ta.getView(ViewNames.SENTENCE);
  writeString("generator", sentenceView.getViewGenerator(), object);
  writeDouble("score", sentenceView.getScore(), object);
  int numSentences = sentenceView.getNumberOfConstituents();
  int[] sentenceEndPositions = new int[numSentences];
  int id = 0;
  for (Sentence sentence : ta.sentences()) {
    sentenceEndPositions[id++] = sentence.getEndSpan();
  }
  writeIntArray("sentenceEndPositions", sentenceEndPositions, object);
  json.add("sentences", object);
}
origin: CogComp/cogcomp-nlp

/**
 * Process each sentence individually. This potentially allows for failure at an individual
 * sentence level, without failing for the whole text. THIS REQUIRES THAT ALL RELATIONS ARE
 * INTRA-SENTENCE. Any that are *not* will be omitted for the sentence-level processing.
 *
 * @param annotator Annotator to apply
 * @param textAnnotation TextAnnotation to augment
 * @return
 */
public void processBySentence(Annotator annotator, TextAnnotation textAnnotation) {
  logger.debug("in processBySentence()...");
  for (int sentenceId = 0; sentenceId < textAnnotation.sentences().size(); ++sentenceId) {
    TextAnnotation sentTa =
        TextAnnotationUtilities.getSubTextAnnotation(textAnnotation, sentenceId);
    try {
      annotator.getView(sentTa);
      int start = textAnnotation.getSentence(sentenceId).getStartSpan();
      int end = textAnnotation.getSentence(sentenceId).getEndSpan();
      TextAnnotationUtilities.copyViewFromTo(annotator.getViewName(), sentTa,
          textAnnotation, start, end, start);
    } catch (AnnotatorException e) {
      e.printStackTrace();
    }
  }
  return;
}
origin: edu.illinois.cs.cogcomp/illinois-core-utilities

private static void writeSentences(TextAnnotation ta, TextAnnotationProto.Builder taBuilder) {
  SentenceProto.Builder sentenceBuilder = SentenceProto.newBuilder();
  SpanLabelView sentenceView = (SpanLabelView) ta.getView(ViewNames.SENTENCE);
  sentenceBuilder.setGenerator(sentenceView.getViewGenerator());
  sentenceBuilder.setScore(sentenceView.getScore());
  for (Sentence sentence: ta.sentences()) {
    sentenceBuilder.addSentenceEndPositions(sentence.getEndSpan());
  }
  taBuilder.setSentences(sentenceBuilder);
}
origin: CogComp/cogcomp-nlp

private static void writeSentences(TextAnnotation ta, TextAnnotationProto.Builder taBuilder) {
  SentenceProto.Builder sentenceBuilder = SentenceProto.newBuilder();
  SpanLabelView sentenceView = (SpanLabelView) ta.getView(ViewNames.SENTENCE);
  sentenceBuilder.setGenerator(sentenceView.getViewGenerator());
  sentenceBuilder.setScore(sentenceView.getScore());
  for (Sentence sentence: ta.sentences()) {
    sentenceBuilder.addSentenceEndPositions(sentence.getEndSpan());
  }
  taBuilder.setSentences(sentenceBuilder);
}
edu.illinois.cs.cogcomp.core.datastructures.textannotationTextAnnotationsentences

Javadoc

The list of sentences contained in this text

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,
  • getTokensInSpan,
  • addAttribute

Popular in Java

  • Parsing JSON documents to java classes using gson
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • putExtra (Intent)
  • startActivity (Activity)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • JTextField (javax.swing)
  • Top Sublime Text 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