use of org.dkpro.tc.api.type.TextClassificationTarget in project dkpro-tc by dkpro.
the class SequenceOutcomeAnnotator method process.
@Override
public void process(JCas aJCas) throws AnalysisEngineProcessException {
for (Sentence sent : JCasUtil.select(aJCas, Sentence.class)) {
TextClassificationSequence sequence = new TextClassificationSequence(aJCas, sent.getBegin(), sent.getEnd());
sequence.addToIndexes();
List<Token> tokens = JCasUtil.selectCovered(aJCas, Token.class, sent);
for (Token token : tokens) {
TextClassificationTarget unit = new TextClassificationTarget(aJCas, token.getBegin(), token.getEnd());
unit.setId(tcId++);
unit.setSuffix(token.getCoveredText());
unit.addToIndexes();
TextClassificationOutcome outcome = new TextClassificationOutcome(aJCas, token.getBegin(), token.getEnd());
outcome.setOutcome(getTextClassificationOutcome(aJCas, unit));
outcome.addToIndexes();
}
}
}
use of org.dkpro.tc.api.type.TextClassificationTarget in project dkpro-tc by dkpro.
the class UnitOutcomeAnnotator method process.
@Override
public void process(JCas aJCas) throws AnalysisEngineProcessException {
List<Token> tokens = new ArrayList<Token>(JCasUtil.select(aJCas, Token.class));
for (Token token : tokens) {
TextClassificationTarget aTarget = new TextClassificationTarget(aJCas, token.getBegin(), token.getEnd());
aTarget.setId(tcId++);
aTarget.setSuffix(token.getCoveredText());
aTarget.addToIndexes();
TextClassificationOutcome outcome = new TextClassificationOutcome(aJCas, token.getBegin(), token.getEnd());
outcome.setOutcome(getTextClassificationOutcome(aJCas, aTarget));
outcome.addToIndexes();
}
}
use of org.dkpro.tc.api.type.TextClassificationTarget in project dkpro-tc by dkpro.
the class WekaUnitAnnotator method process.
@Override
public void process(JCas aJCas) throws AnalysisEngineProcessException {
Collection<Token> tokens = JCasUtil.select(aJCas, Token.class);
for (Token token : tokens) {
TextClassificationTarget unit = new TextClassificationTarget(aJCas, token.getBegin(), token.getEnd());
unit.setId(tcId++);
unit.setSuffix(token.getCoveredText());
unit.addToIndexes();
TextClassificationOutcome outcome = new TextClassificationOutcome(aJCas, token.getBegin(), token.getEnd());
outcome.setOutcome(getTextClassificationOutcome(aJCas, unit));
outcome.addToIndexes();
}
}
use of org.dkpro.tc.api.type.TextClassificationTarget in project dkpro-tc by dkpro.
the class EachTokenAsUnitAnnotator method process.
@Override
public void process(JCas aJCas) throws AnalysisEngineProcessException {
List<Token> tokens = new ArrayList<Token>(JCasUtil.select(aJCas, Token.class));
for (Token token : tokens) {
TextClassificationTarget unit = new TextClassificationTarget(aJCas, token.getBegin(), token.getEnd());
unit.setId(tcId++);
unit.setSuffix(token.getCoveredText());
unit.addToIndexes();
TextClassificationOutcome outcome = new TextClassificationOutcome(aJCas, token.getBegin(), token.getEnd());
outcome.setOutcome("X");
outcome.addToIndexes();
}
}
use of org.dkpro.tc.api.type.TextClassificationTarget in project dkpro-tc by dkpro.
the class TestReaderSingleLabelDocumentReader 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();
if (!suppress) {
new TextClassificationTarget(jcas, 0, jcas.getDocumentText().length()).addToIndexes();
}
}
Aggregations