public TextBlock(final String text, final BitSet containedTextElements, final int numWords, final int numWordsInAnchorText, final int numWordsInWrappedLines, final int numWrappedLines, final int offsetBlocks) { this.text = text; this.containedTextElements = containedTextElements; this.numWords = numWords; this.numWordsInAnchorText = numWordsInAnchorText; this.numWordsInWrappedLines = numWordsInWrappedLines; this.numWrappedLines = numWrappedLines; this.offsetBlocksStart = offsetBlocks; this.offsetBlocksEnd = offsetBlocks; initDensities(); }
public TextBlock(final String text, final BitSet containedTextElements, final int numWords, final int numWordsInAnchorText, final int numWordsInWrappedLines, final int numWrappedLines, final int offsetBlocks) { this.text = text; this.containedTextElements = containedTextElements; this.numWords = numWords; this.numWordsInAnchorText = numWordsInAnchorText; this.numWordsInWrappedLines = numWordsInWrappedLines; this.numWrappedLines = numWrappedLines; this.offsetBlocksStart = offsetBlocks; this.offsetBlocksEnd = offsetBlocks; initDensities(); }
public TextBlock(final String text, final BitSet containedTextElements, final int numWords, final int numWordsInAnchorText, final int numWordsInWrappedLines, final int numWrappedLines, final int offsetBlocks) { this.text = text; this.containedTextElements = containedTextElements; this.numWords = numWords; this.numWordsInAnchorText = numWordsInAnchorText; this.numWordsInWrappedLines = numWordsInWrappedLines; this.numWrappedLines = numWrappedLines; this.offsetBlocksStart = offsetBlocks; this.offsetBlocksEnd = offsetBlocks; initDensities(); }
public TextBlock(final String text, final BitSet containedTextElements, final int numWords, final int numWordsInAnchorText, final int numWordsInWrappedLines, final int numWrappedLines, final int offsetBlocks) { this.text = text; this.containedTextElements = containedTextElements; this.numWords = numWords; this.numWordsInAnchorText = numWordsInAnchorText; this.numWordsInWrappedLines = numWordsInWrappedLines; this.numWrappedLines = numWrappedLines; this.offsetBlocksStart = offsetBlocks; this.offsetBlocksEnd = offsetBlocks; initDensities(); }
public void mergeNext(final TextBlock other) { if (!(text instanceof StringBuilder)) { text = new StringBuilder(text); } StringBuilder sb = (StringBuilder) text; sb.append('\n'); sb.append(other.text); numWords += other.numWords; numWordsInAnchorText += other.numWordsInAnchorText; numWordsInWrappedLines += other.numWordsInWrappedLines; numWrappedLines += other.numWrappedLines; offsetBlocksStart = Math .min(offsetBlocksStart, other.offsetBlocksStart); offsetBlocksEnd = Math.max(offsetBlocksEnd, other.offsetBlocksEnd); initDensities(); this.isContent |= other.isContent; if(containedTextElements == null) { containedTextElements = (BitSet)other.containedTextElements.clone(); } else { containedTextElements.or(other.containedTextElements); } numFullTextWords += other.numFullTextWords; if (other.labels != null) { if (labels == null) { labels = new HashSet<String>(other.labels); } else { labels.addAll(other.labels); } } }
offsetBlocksEnd = Math.max(offsetBlocksEnd, other.offsetBlocksEnd); initDensities();
offsetBlocksEnd = Math.max(offsetBlocksEnd, other.offsetBlocksEnd); initDensities();
offsetBlocksEnd = Math.max(offsetBlocksEnd, other.offsetBlocksEnd); initDensities();