public void process(JCas jCas) throws AnalysisEngineProcessException { for (DocumentBlock block : select(jCas, DocumentBlock.class)) { String label = block.getLabel(); if (label == null) label = "NOSECTIONN"; label = StringUtils.rightPad(label, 20) + " "; System.out.println(label + block.getCoveredText().replaceAll("\n", "")); } System.out.println("\n\n\n\n"); }
public FeatureStructure createFS(int addr, CASImpl cas) { if (DocumentBlock_Type.this.useExistingInstance) { // Return eq fs instance if already created FeatureStructure fs = DocumentBlock_Type.this.jcas.getJfsFromCaddr(addr); if (null == fs) { fs = new DocumentBlock(addr, DocumentBlock_Type.this); DocumentBlock_Type.this.jcas.putJfsFromCaddr(addr, fs); return fs; } return fs; } else return new DocumentBlock(addr, DocumentBlock_Type.this); } };
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); } }
DocumentBlock annBlock = new DocumentBlock(jcas, currBegin, currBegin + text.length()); currBegin += text.length(); sb.append(text); annBlock.setElementId(block.getId()); annBlock.setX(block.getRegion().x); annBlock.setY(block.getRegion().y); annBlock.setHeight(block.getRegion().height); annBlock.setWidth(block.getRegion().width); annBlock.setHasBold(block.isHasBold()); annBlock.setHasManyFontsizes(block.isHasManyFontsizes()); annBlock.setMedianFontsize(block.getMedianFontsize()); annBlock.setPageId(block.getPageId()); annBlock.addToIndexes();
int maxY = (int) (b.getY() + b.getHeight()); Map<String, String> attrs = newHashMap(); double top = (b.getPageId() + 1) * 800 - maxY; attrs.put("style", "font-size: 10px;position:absolute;top:" + (int) top + ";left:" + (int) b.getX() + ";height:" + (int) b.getHeight() + ";width:" + (int) b.getWidth() + ";border:1px solid " + color); htmlElt.appendChild(buildTextElt(dom, "span", b.getCoveredText(), attrs));
if (block.getPageId() < 2) { txt += block.getCoveredText() + " ";
String labelForSection = section.getLabel(); materialsAndMethodsBegin = section.getBegin(); } else if (RESULTS_LABEL.equals(labelForSection)) { resultsBegins.add(section.getBegin()); int sectionAfterRes = -1; for (DocumentBlock section : select(jCas, DocumentBlock.class)) { int sectionBegin = section.getBegin(); String label = section.getLabel();
public void process2(JCas jCas) throws AnalysisEngineProcessException { LOG.debug(getHeaderSource(jCas) + "**************************************"); String states = ""; for (DocumentBlock block : select(jCas, DocumentBlock.class)) { if (block.getLabel() == null) { states += LABEL_OUTSIDE; LOG.debug(LABEL_OUTSIDE + "\t" + block.getCoveredText().replaceAll("\n", "")); } else if (block.getLabel().equals(SECTION_REFERENCES_ENTRY)) { states += LABEL_INSIDE; LOG.debug(LABEL_INSIDE + "\t" + block.getCoveredText().replaceAll("\n", "")); } } LOG.debug(getHeaderSource(jCas) + " " + states); LOG.debug("\n\n\n"); } }