public class TextBlock
extends java.lang.Object
implements java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
static TextBlock |
EMPTY_END |
static TextBlock |
EMPTY_START |
Constructor and Description |
---|
TextBlock(java.lang.String text) |
TextBlock(java.lang.String text,
java.util.BitSet containedTextElements,
int numWords,
int numWordsInAnchorText,
int numWordsInWrappedLines,
int numWrappedLines,
int offsetBlocks) |
Modifier and Type | Method and Description |
---|---|
void |
addLabel(java.lang.String label)
Adds an arbitrary String label to this
TextBlock . |
void |
addLabels(java.util.Set<java.lang.String> l)
Adds a set of labels to this
TextBlock . |
void |
addLabels(java.lang.String... l)
Adds a set of labels to this
TextBlock . |
protected java.lang.Object |
clone() |
java.util.BitSet |
getContainedTextElements()
Returns the containedTextElements BitSet, or
null . |
java.util.Set<java.lang.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() |
java.lang.String |
getText() |
float |
getTextDensity() |
boolean |
hasLabel(java.lang.String label)
Checks whether this TextBlock has the given label.
|
boolean |
isContent() |
void |
mergeNext(TextBlock other) |
boolean |
removeLabel(java.lang.String label) |
boolean |
setIsContent(boolean isContent) |
void |
setTagLevel(int tagLevel) |
java.lang.String |
toString() |
public static final TextBlock EMPTY_START
public static final TextBlock EMPTY_END
public TextBlock(java.lang.String text)
public TextBlock(java.lang.String text, java.util.BitSet containedTextElements, int numWords, int numWordsInAnchorText, int numWordsInWrappedLines, int numWrappedLines, int offsetBlocks)
public boolean isContent()
public boolean setIsContent(boolean isContent)
public java.lang.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 java.lang.String toString()
toString
in class java.lang.Object
public void addLabel(java.lang.String label)
TextBlock
.label
- The labelDefaultLabels
public boolean hasLabel(java.lang.String label)
label
- The labeltrue
if this block is marked by the given label.public boolean removeLabel(java.lang.String label)
public java.util.Set<java.lang.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(java.util.Set<java.lang.String> l)
TextBlock
.
null
-references are silently ignored.l
- The labels to be added.public void addLabels(java.lang.String... l)
TextBlock
.
null
-references are silently ignored.l
- The labels to be added.public java.util.BitSet getContainedTextElements()
null
.protected java.lang.Object clone()
clone
in class java.lang.Object
public int getTagLevel()
public void setTagLevel(int tagLevel)