Package de.l3s.boilerpipe.document
Class TextBlock
java.lang.Object
de.l3s.boilerpipe.document.TextBlock
- All Implemented Interfaces:
Cloneable
Describes a block of text.
A block can be an "atomic" text element (i.e., a sequence of text that is not
interrupted by any HTML markup) or a compound of such atomic elements.
- Author:
- Christian Kohlschütter
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an arbitrary String label to thisTextBlock.voidAdds a set of labels to thisTextBlock.voidAdds a set of labels to thisTextBlock.protected Objectclone()Returns the containedTextElements BitSet, ornull.Returns the labels associated to this TextBlock, ornullif no such labels exist.floatintintintintintgetText()floatbooleanChecks whether this TextBlock has the given label.booleanvoidbooleanremoveLabel(String label) booleansetIsContent(boolean isContent) voidsetTagLevel(int tagLevel) toString()
-
Field Details
-
EMPTY_START
-
EMPTY_END
-
-
Constructor Details
-
TextBlock
-
TextBlock
-
-
Method Details
-
isContent
public boolean isContent() -
setIsContent
public boolean setIsContent(boolean isContent) -
getText
-
getNumWords
public int getNumWords() -
getNumWordsInAnchorText
public int getNumWordsInAnchorText() -
getTextDensity
public float getTextDensity() -
getLinkDensity
public float getLinkDensity() -
mergeNext
-
getOffsetBlocksStart
public int getOffsetBlocksStart() -
getOffsetBlocksEnd
public int getOffsetBlocksEnd() -
toString
-
addLabel
Adds an arbitrary String label to thisTextBlock.- Parameters:
label- The label- See Also:
-
hasLabel
Checks whether this TextBlock has the given label.- Parameters:
label- The label- Returns:
trueif this block is marked by the given label.
-
removeLabel
-
getLabels
Returns the labels associated to this TextBlock, ornullif 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 inTextBlockwhenever possible.- Returns:
- Returns the set of labels, or
nullif no labels was added yet.
-
addLabels
Adds a set of labels to thisTextBlock.null-references are silently ignored.- Parameters:
l- The labels to be added.
-
addLabels
Adds a set of labels to thisTextBlock.null-references are silently ignored.- Parameters:
l- The labels to be added.
-
getContainedTextElements
Returns the containedTextElements BitSet, ornull.- Returns:
-
clone
-
getTagLevel
public int getTagLevel() -
setTagLevel
public void setTagLevel(int tagLevel)
-