use of de.tudarmstadt.ukp.dkpro.core.api.metadata.type.DocumentMetaData in project dkpro-tc by dkpro.
the class TestReaderSentenceToDocument method getNext.
@Override
public void getNext(JCas aJCas) throws IOException, CollectionException {
// setting the document text
aJCas.setDocumentText(texts.get(offset));
aJCas.setDocumentLanguage(LANGUAGE_CODE);
// as we are creating more than one CAS out of a single file, we need to have different
// document titles and URIs for each CAS
// otherwise, serialized CASes will be overwritten
DocumentMetaData dmd = DocumentMetaData.create(aJCas);
dmd.setDocumentTitle("Sentence" + offset);
dmd.setDocumentUri("Sentence" + offset);
dmd.setDocumentId(String.valueOf(offset));
JCasId id = new JCasId(aJCas);
id.setId(jcasId);
id.addToIndexes();
// setting the outcome / label for this document
TextClassificationOutcome outcome = new TextClassificationOutcome(aJCas);
outcome.setOutcome(getTextClassificationOutcome(aJCas));
outcome.addToIndexes();
new TextClassificationTarget(aJCas, 0, aJCas.getDocumentText().length()).addToIndexes();
offset++;
}
use of de.tudarmstadt.ukp.dkpro.core.api.metadata.type.DocumentMetaData in project dkpro-tc by dkpro.
the class LinewiseTextOutcomeReader method initializeJCas.
protected void initializeJCas(JCas aJCas) {
DocumentMetaData data = new DocumentMetaData(aJCas);
data.setDocumentId(runningId + "");
data.setDocumentTitle("Title_" + runningId);
data.addToIndexes();
runningId++;
}
use of de.tudarmstadt.ukp.dkpro.core.api.metadata.type.DocumentMetaData in project dkpro-tc by dkpro.
the class TcuLookUpTable method isTheSameDocument.
private boolean isTheSameDocument(JCas aView) {
DocumentMetaData meta = JCasUtil.selectSingle(aView, DocumentMetaData.class);
String currentId = meta.getDocumentId();
boolean isSame = currentId.equals(lastSeenDocumentId);
lastSeenDocumentId = currentId;
return isSame;
}
use of de.tudarmstadt.ukp.dkpro.core.api.metadata.type.DocumentMetaData in project dkpro-tc by dkpro.
the class ExtractFeaturesConnector method recordDocumentMetaLog.
private void recordDocumentMetaLog(JCas aJCas) throws AnalysisEngineProcessException {
DocumentMetaData dmd = null;
try {
dmd = JCasUtil.selectSingle(aJCas, DocumentMetaData.class);
documentMetaLogger.write(dmd.getDocumentId() + "\t" + dmd.getDocumentTitle());
} catch (IllegalArgumentException e) {
// annotation missing
} catch (IOException e) {
throw new AnalysisEngineProcessException(e);
}
}
use of de.tudarmstadt.ukp.dkpro.core.api.metadata.type.DocumentMetaData in project dkpro-tc by dkpro.
the class PairReader_ImplBase method createView.
protected void createView(String part, JCas jCas, String language, String text, String docId, String docTitle) throws CASException {
JCas view = jCas.createView(part.toString());
view.setDocumentText(text);
view.setDocumentLanguage(language);
TextClassificationTarget aTarget = new TextClassificationTarget(view, 0, text.length());
aTarget.addToIndexes();
DocumentMetaData baseMetaData = DocumentMetaData.get(jCas);
createMetaData(view, baseMetaData.getCollectionId(), docId, docTitle);
}
Aggregations