Java Code Examples for org.apache.uima.jcas.JCas#getDocumentAnnotationFs()

The following examples show how to use org.apache.uima.jcas.JCas#getDocumentAnnotationFs() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DocumentAnnotationTest.java    From baleen with Apache License 2.0 5 votes vote down vote up
@Test
public void docHash() throws Exception {
  JCas jcas = JCasFactory.createJCas(TypeSystemSingleton.getTypeSystemDescriptionInstance());
  jcas.setDocumentText("There is the mention of some entity in this sentence.");

  DocumentAnnotation doc = (DocumentAnnotation) jcas.getDocumentAnnotationFs();
  assertEquals("87cebccde680225b7640878d334b4cbb1c048ba1c8e66763f72cca5396a37807", doc.getHash());
}
 
Example 2
Source File: FolderReaderTest.java    From baleen with Apache License 2.0 4 votes vote down vote up
private String getSource(JCas jCas) {
  DocumentAnnotation doc = (DocumentAnnotation) jCas.getDocumentAnnotationFs();
  return doc.getSourceUri();
}
 
Example 3
Source File: MucReaderTest.java    From baleen with Apache License 2.0 4 votes vote down vote up
private String getSource(JCas jCas) {
  DocumentAnnotation doc = (DocumentAnnotation) jCas.getDocumentAnnotationFs();
  return doc.getSourceUri();
}
 
Example 4
Source File: CsvFolderReaderTest.java    From baleen with Apache License 2.0 4 votes vote down vote up
private String getSource(JCas jCas) {
  DocumentAnnotation doc = (DocumentAnnotation) jCas.getDocumentAnnotationFs();
  return doc.getSourceUri();
}
 
Example 5
Source File: MboxReaderTest.java    From baleen with Apache License 2.0 4 votes vote down vote up
private String getSource(JCas jCas) {
  DocumentAnnotation doc = (DocumentAnnotation) jCas.getDocumentAnnotationFs();
  return doc.getSourceUri();
}
 
Example 6
Source File: LineReaderTest.java    From baleen with Apache License 2.0 4 votes vote down vote up
private String getSource(JCas jCas) {
  DocumentAnnotation doc = (DocumentAnnotation) jCas.getDocumentAnnotationFs();
  return doc.getSourceUri();
}
 
Example 7
Source File: JCasTestGraphUtil.java    From baleen with Apache License 2.0 4 votes vote down vote up
public static void populateJcas(final JCas jCas) {

    jCas.setDocumentText(CONTENT);
    final DocumentAnnotation da = (DocumentAnnotation) jCas.getDocumentAnnotationFs();
    da.setDocumentClassification("CLASS");
    da.setDocType("MANUAL");
    da.setSourceUri("http://test.com");
    da.setLanguage("en");
    da.setTimestamp(new Date().getTime());
    da.setDocumentCaveats(new StringArray(jCas, 2));
    da.setDocumentCaveats(0, "GITHUB");
    da.setDocumentCaveats(1, "CAVEAT");

    final Metadata m1 = new Metadata(jCas);
    m1.setKey("test");
    m1.setValue("1");
    m1.addToIndexes(jCas);

    final Metadata m2 = new Metadata(jCas);
    m2.setKey("test");
    m2.setValue("2");
    m2.addToIndexes(jCas);

    final PublishedId pId = new PublishedId(jCas);
    pId.setPublishedIdType("test");
    pId.setValue("12");
    pId.addToIndexes(jCas);

    ReferenceTarget target = new ReferenceTarget(jCas);
    target.setLinking("testLinking");
    target.addToIndexes(jCas);

    final Person js = new Person(jCas);
    js.setBegin(25);
    js.setEnd(35);
    js.setGender("Male");
    js.setValue("John Smith");
    js.setConfidence(0.9d);
    js.setReferent(target);
    js.addToIndexes(jCas);

    final Person jd = new Person(jCas);
    jd.setBegin(50);
    jd.setEnd(58);
    jd.setGender("Female");
    jd.setValue("Jane Doe");
    jd.setConfidence(0.8d);
    jd.addToIndexes(jCas);

    final Person he = new Person(jCas);
    he.setBegin(60);
    he.setEnd(62);
    he.setGender("Male");
    he.setValue("He");
    he.setConfidence(0.9d);
    he.setReferent(target);
    he.addToIndexes(jCas);

    final Location l = new Location(jCas);
    l.setBegin(72);
    l.setEnd(87);
    l.setGeoJson(GEO_JSON);
    l.setValue("Dinagat Islands");
    l.setConfidence(0.9d);
    l.addToIndexes(jCas);

    final Relation related = new Relation(jCas);
    related.setBegin(36);
    related.setEnd(49);
    related.setValue("is related to");
    related.setRelationshipType(RELATED_TYPE);
    related.setSource(js);
    related.setTarget(jd);
    related.addToIndexes(jCas);

    final Relation lives = new Relation(jCas);
    lives.setBegin(63);
    lives.setEnd(71);
    lives.setValue("lives at");
    lives.setRelationshipType(LIVES_TYPE);
    lives.setSource(js);
    lives.setTarget(l);
    lives.addToIndexes(jCas);

    final Event event = new Event(jCas);
    event.setBegin(0);
    event.setEnd(10);
    event.setValue("test event");
    event.setEventType(new StringArray(jCas, 1));
    event.setEventType(0, "MEETING");
    event.setEntities(new FSArray(jCas, 2));
    event.setEntities(0, js);
    event.setEntities(1, jd);
    event.setArguments(new StringArray(jCas, 2));
    event.setArguments(0, "argument");
    event.setArguments(1, "Other");
    event.addToIndexes(jCas);
  }
 
Example 8
Source File: ConsumerTestBase.java    From baleen with Apache License 2.0 4 votes vote down vote up
protected DocumentAnnotation getDocumentAnnotation(JCas jCas) {
  return (DocumentAnnotation) jCas.getDocumentAnnotationFs();
}
 
Example 9
Source File: ElasticsearchTestBase.java    From baleen with Apache License 2.0 4 votes vote down vote up
protected DocumentAnnotation getDocumentAnnotation(JCas jCas) {
  return (DocumentAnnotation) jCas.getDocumentAnnotationFs();
}
 
Example 10
Source File: AnnotatorTestBase.java    From baleen with Apache License 2.0 2 votes vote down vote up
/**
 * Get the document annotation from a jCas.
 *
 * @param jCas
 * @return documentation annotation
 */
protected DocumentAnnotation getDocumentAnnotation(JCas jCas) {
  return (DocumentAnnotation) jCas.getDocumentAnnotationFs();
}
 
Example 11
Source File: AbstractAnnotatorTest.java    From baleen with Apache License 2.0 2 votes vote down vote up
/**
 * Get the document annotation from a jCas.
 *
 * @param jCas
 * @return documentation annotation
 */
@Override
protected DocumentAnnotation getDocumentAnnotation(JCas jCas) {
  return (DocumentAnnotation) jCas.getDocumentAnnotationFs();
}
 
Example 12
Source File: UimaSupport.java    From baleen with Apache License 2.0 2 votes vote down vote up
/**
 * Return the document annotation.
 *
 * @param jCas
 * @return the document annotation
 */
public static DocumentAnnotation getDocumentAnnotation(JCas jCas) {
  return (DocumentAnnotation) jCas.getDocumentAnnotationFs();
}