public boolean process(TextDocument doc) throws BoilerpipeProcessingException { List<TextBlock> textBlocks = doc.getTextBlocks(); if (textBlocks.size() < 2) { return false; } boolean changes = false; TextBlock prevBlock = textBlocks.get(0); int offset = 1; for (Iterator<TextBlock> it = textBlocks.listIterator(offset); it .hasNext();) { TextBlock block = it.next(); if(equalLabels(prevBlock.getLabels(), block.getLabels())) { prevBlock.mergeNext(block); it.remove(); changes = true; } else { prevBlock = block; } } return changes; }
public boolean process(TextDocument doc) throws BoilerpipeProcessingException { List<TextBlock> textBlocks = doc.getTextBlocks(); if (textBlocks.size() < 2) { return false; } boolean changes = false; TextBlock prevBlock = textBlocks.get(0); int offset = 1; for (Iterator<TextBlock> it = textBlocks.listIterator(offset); it .hasNext();) { TextBlock block = it.next(); if(equalLabels(prevBlock.getLabels(), block.getLabels())) { prevBlock.mergeNext(block); it.remove(); changes = true; } else { prevBlock = block; } } return changes; }
public boolean process(TextDocument doc) throws BoilerpipeProcessingException { List<TextBlock> textBlocks = doc.getTextBlocks(); if (textBlocks.size() < 2) { return false; } boolean changes = false; TextBlock prevBlock = textBlocks.get(0); int offset = 1; for (Iterator<TextBlock> it = textBlocks.listIterator(offset); it .hasNext();) { TextBlock block = it.next(); if(equalLabels(prevBlock.getLabels(), block.getLabels())) { prevBlock.mergeNext(block); it.remove(); changes = true; } else { prevBlock = block; } } return changes; }
Set<String> labels = block.getLabels(); if(labels != null && !labels.isEmpty()) { for(String l : labels) {
Set<String> labels = block.getLabels(); if(labels != null && !labels.isEmpty()) { for(String l : labels) {
Set<String> labels = block.getLabels(); if(labels != null && !labels.isEmpty()) { for(String l : labels) {
public boolean process(TextDocument doc) throws BoilerpipeProcessingException { boolean changes = false; final List<TextBlock> blocks = doc.getTextBlocks(); final List<TextBlock> blocksNew = new ArrayList<TextBlock>(); for (TextBlock tb : blocks) { final String text = tb.getText(); final String[] paragraphs = text.split("[\n\r]+"); if (paragraphs.length < 2) { blocksNew.add(tb); continue; } final boolean isContent = tb.isContent(); final Set<String> labels = tb.getLabels(); for (String p : paragraphs) { final TextBlock tbP = new TextBlock(p); tbP.setIsContent(isContent); tbP.addLabels(labels); blocksNew.add(tbP); changes = true; } } if (changes) { blocks.clear(); blocks.addAll(blocksNew); } return changes; }
public boolean process(TextDocument doc) throws BoilerpipeProcessingException { boolean changes = false; final List<TextBlock> blocks = doc.getTextBlocks(); final List<TextBlock> blocksNew = new ArrayList<TextBlock>(); for (TextBlock tb : blocks) { final String text = tb.getText(); final String[] paragraphs = text.split("[\n\r]+"); if (paragraphs.length < 2) { blocksNew.add(tb); continue; } final boolean isContent = tb.isContent(); final Set<String> labels = tb.getLabels(); for (String p : paragraphs) { final TextBlock tbP = new TextBlock(p); tbP.setIsContent(isContent); tbP.addLabels(labels); blocksNew.add(tbP); changes = true; } } if (changes) { blocks.clear(); blocks.addAll(blocksNew); } return changes; }
public boolean process(TextDocument doc) throws BoilerpipeProcessingException { boolean changes = false; final List<TextBlock> blocks = doc.getTextBlocks(); final List<TextBlock> blocksNew = new ArrayList<TextBlock>(); for (TextBlock tb : blocks) { final String text = tb.getText(); final String[] paragraphs = text.split("[\n\r]+"); if (paragraphs.length < 2) { blocksNew.add(tb); continue; } final boolean isContent = tb.isContent(); final Set<String> labels = tb.getLabels(); for (String p : paragraphs) { final TextBlock tbP = new TextBlock(p); tbP.setIsContent(isContent); tbP.addLabels(labels); blocksNew.add(tbP); changes = true; } } if (changes) { blocks.clear(); blocks.addAll(blocksNew); } return changes; }
public boolean process(TextDocument doc) throws BoilerpipeProcessingException { boolean changes = false; final List<TextBlock> blocks = doc.getTextBlocks(); final List<TextBlock> blocksNew = new ArrayList<TextBlock>(); for (TextBlock tb : blocks) { final String text = tb.getText(); final String[] paragraphs = text.split("[\n\r]+"); if (paragraphs.length < 2) { blocksNew.add(tb); continue; } final boolean isContent = tb.isContent(); final Set<String> labels = tb.getLabels(); for (String p : paragraphs) { final TextBlock tbP = new TextBlock(p); tbP.setIsContent(isContent); tbP.addLabels(labels); blocksNew.add(tbP); changes = true; } } if (changes) { blocks.clear(); blocks.addAll(blocksNew); } return changes; }