@Override public void process(JCas jCas) throws AnalysisEngineProcessException { int pmId = getHeaderIntDocId(jCas); try { for (Annotation a : select(jCas, annotationClass)) { preparedStatement.setInt(1, pmId); for (int i = 0; i < annotationFields.length; i++) { try { Object value = annotationMethods.get(i).invoke(a); preparedStatement.setObject(i + 2, value); } catch (Exception e) { throw new Exception( "Could not assign field " + (i + 2), e); } } preparedStatement.addBatch(); if (++inserted % 1000 == 0) preparedStatement.executeBatch(); } } catch (Exception e) { LOG.error("could not insert " + pmId, e); } }
public void process(JCas jCas) throws AnalysisEngineProcessException { try { for (DocumentBlock block : select(jCas, DocumentBlock.class)) { String label = classify(block.getCoveredText()); if (label.equals(LABEL_INSIDE)) { block.setLabel(SECTION_REFERENCES_ENTRY); } } } catch (Exception e) { int pmId = BlueCasUtil.getHeaderIntDocId(jCas); LOG.warn("could not perform inference on " + pmId, e); } }
@Override public void process(JCas jCas) throws AnalysisEngineProcessException { int pmId = getHeaderIntDocId(jCas); DocumentSpecies docSpecies = selectSingle(jCas, DocumentSpecies.class); String msg = pmId + "\t" + docSpecies.getFamilyName(); for (LinnaeusSpecies species : select(jCas, LinnaeusSpecies.class)) { msg += "\t" + species.getMostProbableSpeciesId() + "\t" + species.getCoveredText().replaceAll("\t", " "); } LOG.debug(msg); }
@Override public void process(JCas jCas) throws AnalysisEngineProcessException { int pmid = BlueCasUtil.getHeaderIntDocId(jCas); if (!BlueCasUtil.isEmptyText(jCas)) { // System.out.println("indexing:: " + pmid); Document doc = new Document(); doc.add(new IntField(PMID_FIELD, pmid, Store.YES)); doc.add(new TextField(CONTENT_FIELD, jCas.getDocumentText(), Store.YES)); doc.add(new TextField(TITLE_FIELD, getTitle(jCas), Store.YES)); try { indexWriter.addDocument(doc); } catch (IOException e) { throw new AnalysisEngineProcessException(e); } } }
public void process(JCas jCas) throws AnalysisEngineProcessException { int pmId = getHeaderIntDocId(jCas);
public void process(JCas jCas) throws AnalysisEngineProcessException { int pmId = getHeaderIntDocId(jCas);
getHeaderIntDocId(jCas) + ""); BasicDBObject updateCommands = new BasicDBObject(); updateCommands.put("$set", dbLists);
@Override public void process(JCas jCas) throws AnalysisEngineProcessException { int pmId = getHeaderIntDocId(jCas); try { if (PubmedArticleEntity.findFirst(PUBMED_ID + " = ?", pmId) == null) { PubmedArticleEntity a = new PubmedArticleEntity(); a.set(PUBMED_ID, pmId); a.set(ABSTRACT, jCas.getDocumentText()); try { Date date = JCasUtil.selectSingle(jCas, Date.class); a.set(PUBLISHED_DATE, date.getYear() + "-" + date.getMonth() + "-" + date.getDay()); } catch (Exception e) {// nope LOG.warn("could not add date to " + pmId, e); } a.set(TITLE, StringUtils.snippetizeAtSpace(getTitle(jCas), 510)); a.saveIt(); inserted++; if (processed++ % 10000 == 0) LOG.debug("processed {}\tinserted {}", processed, inserted); } } catch (Exception e) { LOG.error("could not insert " + pmId, e); } }
public void process(JCas jCas) throws AnalysisEngineProcessException { int pmId = BlueCasUtil.getHeaderIntDocId(jCas);