public class TextBlock extends Object implements Cloneable
| Modifier and Type | Field and Description |
|---|---|
static TextBlock |
EMPTY_END |
static TextBlock |
EMPTY_START |
| Constructor and Description |
|---|
TextBlock(String text) |
TextBlock(String text,
BitSet containedTextElements,
int numWords,
int numWordsInAnchorText,
int numWordsInWrappedLines,
int numWrappedLines,
int offsetBlocks) |
| Modifier and Type | Method and Description |
|---|---|
void |
addLabel(String label)
Adds an arbitrary String label to this
TextBlock. |
void |
addLabels(Set<String> l)
Adds a set of labels to this
TextBlock. |
void |
addLabels(String... l)
Adds a set of labels to this
TextBlock. |
protected TextBlock |
clone() |
BitSet |
getContainedTextElements()
Returns the containedTextElements BitSet, or
null. |
Set<String> |
getLabels()
Returns the labels associated to this TextBlock, or
null if no such labels
exist. |
float |
getLinkDensity() |
int |
getNumWords() |
int |
getNumWordsInAnchorText() |
int |
getOffsetBlocksEnd() |
int |
getOffsetBlocksStart() |
int |
getTagLevel() |
String |
getText() |
float |
getTextDensity() |
boolean |
hasLabel(String label)
Checks whether this TextBlock has the given label.
|
boolean |
isContent() |
void |
mergeNext(TextBlock other) |
boolean |
removeLabel(String label) |
boolean |
setIsContent(boolean isContent) |
void |
setTagLevel(int tagLevel) |
String |
toString() |
public static final TextBlock EMPTY_START
public static final TextBlock EMPTY_END
public TextBlock(String text)
public boolean isContent()
public boolean setIsContent(boolean isContent)
public String getText()
public int getNumWords()
public int getNumWordsInAnchorText()
public float getTextDensity()
public float getLinkDensity()
public void mergeNext(TextBlock other)
public int getOffsetBlocksStart()
public int getOffsetBlocksEnd()
public void addLabel(String label)
TextBlock.label - The labelDefaultLabelspublic boolean hasLabel(String label)
label - The labeltrue if this block is marked by the given label.public boolean removeLabel(String label)
public Set<String> getLabels()
null if no such labels
exist.
NOTE: The returned instance is the one used directly in TextBlock. You have full access
to the data structure. However it is recommended to use the label-specific methods in TextBlock
whenever possible.null if no labels was added yet.public void addLabels(Set<String> l)
TextBlock.
null-references are silently ignored.l - The labels to be added.public void addLabels(String... l)
TextBlock.
null-references are silently ignored.l - The labels to be added.public BitSet getContainedTextElements()
null.null.public int getTagLevel()
public void setTagLevel(int tagLevel)
Copyright © 2013-2014. All Rights Reserved.