Class Headline
java.lang.Object
com.iqser.red.service.redaction.v1.server.model.document.nodes.AbstractSemanticNode
com.iqser.red.service.redaction.v1.server.model.document.nodes.Headline
- All Implemented Interfaces:
com.iqser.red.service.redaction.v1.server.model.document.nodes.GenericSemanticNode
,SemanticNode
public class Headline
extends com.iqser.red.service.redaction.v1.server.model.document.nodes.AbstractSemanticNode
Represents a headline in a document.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Headline.HeadlineBuilder<C extends Headline,
B extends Headline.HeadlineBuilder<C, B>> Nested classes/interfaces inherited from class com.iqser.red.service.redaction.v1.server.model.document.nodes.AbstractSemanticNode
com.iqser.red.service.redaction.v1.server.model.document.nodes.AbstractSemanticNode.AbstractSemanticNodeBuilder<C extends com.iqser.red.service.redaction.v1.server.model.document.nodes.AbstractSemanticNode,
B extends com.iqser.red.service.redaction.v1.server.model.document.nodes.AbstractSemanticNode.AbstractSemanticNodeBuilder<C, B>> -
Constructor Summary
ConstructorsConstructorDescriptionHeadline()
Headline
(com.iqser.red.service.redaction.v1.server.model.document.textblock.TextBlock leafTextBlock, SectionIdentifier sectionIdentifier) -
Method Summary
Modifier and TypeMethodDescriptionstatic Headline.HeadlineBuilder<?,
?> builder()
static Headline
empty()
Creates an empty headline with no text content.boolean
Traverses the Tree up, until it hits a Headline or hits a Section which will then return the first Headline from its children.com.iqser.red.service.redaction.v1.server.model.document.textblock.TextBlock
Leaf means a SemanticNode has direct access to a TextBlock, by default this is false and must be overridden.Extracts the SectionIdentifier from the text of this headline.com.iqser.red.service.redaction.v1.server.model.document.textblock.TextBlock
Searches all Nodes located underneath this Node in the DocumentTree and concatenates their AtomicTextBlocks into a single TextBlock.getType()
Returns the type of this node, such as Section, Paragraph, etc.int
hashCode()
boolean
Checks if this headline is associated with any paragraphs within its parent section or node.boolean
isLeaf()
Leaf means a SemanticNode has direct access to a TextBlock, by default this is false and must be overridden.void
setLeafTextBlock
(com.iqser.red.service.redaction.v1.server.model.document.textblock.TextBlock leafTextBlock) Should only be used during construction of the Graph.void
setSectionIdentifier
(SectionIdentifier sectionIdentifier) toString()
Methods inherited from class com.iqser.red.service.redaction.v1.server.model.document.nodes.AbstractSemanticNode
getBBox, getBBoxCache, getDocumentTree, getEngines, getEntities, getTreeId, setBBoxCache, setDocumentTree, setEngines, setEntities, setTextBlock, setTreeId
Methods inherited from interface com.iqser.red.service.redaction.v1.server.model.document.nodes.SemanticNode
accept, addEngine, addThisToEntityIfIntersects, containsAllStrings, containsAllStringsIgnoreCase, containsAllWords, containsAllWordsIgnoreCase, containsAnyString, containsAnyString, containsAnyStringIgnoreCase, containsAnyWord, containsAnyWordIgnoreCase, containsRectangle, containsString, containsStringIgnoreCase, containsWord, containsWordIgnoreCase, getEntitiesOfType, getEntitiesOfType, getEntitiesOfType, getFirstPage, getHighestParent, getNextSibling, getNumberOnPage, getPages, getPages, getParent, getPositionsPerPage, getPreviousSibling, getTextBlocksByPageNumbers, getTextRange, hasEntitiesOfAllTypes, hasEntitiesOfAnyType, hasEntitiesOfType, hasParent, hasText, intersectsRectangle, length, matchesRegex, matchesRegexIgnoreCase, onlyOnPage, onPage, streamAllSubNodes, streamAllSubNodesOfType, streamChildren, streamChildrenOfType, streamValidEntities
-
Constructor Details
-
Headline
public Headline(com.iqser.red.service.redaction.v1.server.model.document.textblock.TextBlock leafTextBlock, SectionIdentifier sectionIdentifier) -
Headline
public Headline()
-
-
Method Details
-
getType
Description copied from interface:SemanticNode
Returns the type of this node, such as Section, Paragraph, etc.- Returns:
- NodeType of this node
-
isLeaf
public boolean isLeaf()Description copied from interface:SemanticNode
Leaf means a SemanticNode has direct access to a TextBlock, by default this is false and must be overridden. Currently only Sections, Images, and Tables are not leaves. A TableCell might be a leaf depending on its area compared to the page.- Returns:
- boolean, indicating if a Node has direct access to a TextBlock
-
getTextBlock
public com.iqser.red.service.redaction.v1.server.model.document.textblock.TextBlock getTextBlock()Description copied from interface:SemanticNode
Searches all Nodes located underneath this Node in the DocumentTree and concatenates their AtomicTextBlocks into a single TextBlock. So, for a Section all TextBlocks of Subsections, Paragraphs, and Tables are concatenated into a single TextBlock If the Node is a Leaf, the LeafTextBlock will be returned instead.- Specified by:
getTextBlock
in interfaceSemanticNode
- Overrides:
getTextBlock
in classcom.iqser.red.service.redaction.v1.server.model.document.nodes.AbstractSemanticNode
- Returns:
- TextBlock containing all AtomicTextBlocks that are located under this Node.
-
toString
- Overrides:
toString
in classcom.iqser.red.service.redaction.v1.server.model.document.nodes.AbstractSemanticNode
-
getHeadline
Description copied from interface:SemanticNode
Traverses the Tree up, until it hits a Headline or hits a Section which will then return the first Headline from its children. If no Headline is found this way, it will recursively traverse the tree up and try again until it hits the root, where it will perform a BFS. If no Headline exists anywhere in the Document a dummy Headline is returned.- Returns:
- First Headline found.
-
getSectionIdentifier
Extracts the SectionIdentifier from the text of this headline.- Returns:
- The SectionIdentifier, with which the headline starts.
-
empty
Creates an empty headline with no text content.- Returns:
- An empty
Headline
instance.
-
hasParagraphs
public boolean hasParagraphs()Checks if this headline is associated with any paragraphs within its parent section or node.- Returns:
- True if there are paragraphs associated with this headline, false otherwise.
-
builder
-
getLeafTextBlock
public com.iqser.red.service.redaction.v1.server.model.document.textblock.TextBlock getLeafTextBlock()Description copied from interface:SemanticNode
Leaf means a SemanticNode has direct access to a TextBlock, by default this is false and must be overridden. Currently only Sections and Tables are no leaves.- Returns:
- AtomicTextBlock
-
setLeafTextBlock
public void setLeafTextBlock(com.iqser.red.service.redaction.v1.server.model.document.textblock.TextBlock leafTextBlock) Description copied from interface:SemanticNode
Should only be used during construction of the Graph. Sets the LeafTextBlock of this SemanticNode.- Parameters:
leafTextBlock
- the TextBlock to set as the LeafTextBlock of this SemanticNode
-
setSectionIdentifier
-
equals
- Overrides:
equals
in classcom.iqser.red.service.redaction.v1.server.model.document.nodes.AbstractSemanticNode
-
hashCode
public int hashCode()- Overrides:
hashCode
in classcom.iqser.red.service.redaction.v1.server.model.document.nodes.AbstractSemanticNode
-