use of org.apache.uima.collection.CollectionException in project dkpro-tc by dkpro.
the class MultiLabelOutcomeAnnotator method process.
@Override
public void process(JCas jcas) throws AnalysisEngineProcessException {
try {
for (String outcomeValue : getTextClassificationOutcomes(jcas)) {
TextClassificationOutcome outcome = new TextClassificationOutcome(jcas);
outcome.setOutcome(outcomeValue);
outcome.addToIndexes();
}
} catch (CollectionException e) {
throw new AnalysisEngineProcessException(e);
}
}
use of org.apache.uima.collection.CollectionException in project dkpro-tc by dkpro.
the class TestReaderSingleLabelUnitReader method getNext.
@Override
public void getNext(CAS aCAS) throws IOException, CollectionException {
super.getNext(aCAS);
JCas jcas;
try {
jcas = aCAS.getJCas();
JCasId id = new JCasId(jcas);
id.setId(jcasId++);
id.addToIndexes();
} catch (CASException e) {
throw new CollectionException();
}
String documentText = aCAS.getDocumentText();
int s = 0;
for (String t : documentText.split(" ")) {
int e = documentText.indexOf(t, s) + t.length();
new TextClassificationTarget(jcas, s, e).addToIndexes();
new TextClassificationOutcome(jcas, s, e).addToIndexes();
s += 1;
}
}
use of org.apache.uima.collection.CollectionException in project dkpro-tc by dkpro.
the class PairReader_ImplBase method getNext.
@Override
public void getNext(JCas jcas) throws IOException, CollectionException {
try {
createMetaData(jcas, getCollectionId1() + "_" + getCollectionId2(), getDocumentId1() + "_" + getDocumentId2(), getTitle1() + " " + getTitle2());
createView(PART_ONE, jcas, getLanguage1(), getText1(), getDocumentId1(), getTitle1());
createView(PART_TWO, jcas, getLanguage2(), getText2(), getDocumentId2(), getTitle2());
} catch (TextClassificationException e) {
throw new CollectionException(e);
} catch (CASException e) {
throw new CollectionException(e);
}
}
use of org.apache.uima.collection.CollectionException in project dkpro-tc by dkpro.
the class TestReaderSingleLabel method getNext.
@Override
public void getNext(CAS aCAS) throws IOException, CollectionException {
super.getNext(aCAS);
JCas jcas;
try {
jcas = aCAS.getJCas();
JCasId id = new JCasId(jcas);
id.setId(jcasId);
id.addToIndexes();
} catch (CASException e) {
throw new CollectionException();
}
TextClassificationOutcome outcome = new TextClassificationOutcome(jcas);
outcome.setOutcome(getTextClassificationOutcome(jcas));
outcome.addToIndexes();
}
use of org.apache.uima.collection.CollectionException in project dkpro-tc by dkpro.
the class TestReaderMultiLabel method getNext.
@Override
public void getNext(CAS aCAS) throws IOException, CollectionException {
super.getNext(aCAS);
JCas jcas;
try {
jcas = aCAS.getJCas();
JCasId id = new JCasId(jcas);
id.setId(jcasId);
id.addToIndexes();
} catch (CASException e) {
throw new CollectionException();
}
for (String outcomeValue : getTextClassificationOutcomes(jcas)) {
TextClassificationOutcome outcome = new TextClassificationOutcome(jcas);
outcome.setOutcome(outcomeValue);
outcome.addToIndexes();
}
}
Aggregations