Package org.apache.nutch.parse.headings
Class HeadingsParseFilter
java.lang.Object
org.apache.nutch.parse.headings.HeadingsParseFilter
- All Implemented Interfaces:
Configurable,HtmlParseFilter,Pluggable
HtmlParseFilter to retrieve h1 and h2 values from the DOM.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static PatternPattern used to strip surpluss whitespaceFields inherited from interface org.apache.nutch.parse.HtmlParseFilter
X_POINT_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfilter(Content content, ParseResult parseResult, HTMLMetaTags metaTags, DocumentFragment doc) Adds metadata or otherwise modifies a parse of HTML content, given the DOM tree of a page.getConf()getElement(DocumentFragment doc, String element) Finds the specified element and returns its valueprotected static StringgetNodeValue(Node node) Returns the text value of the specified Node and child nodesvoidsetConf(Configuration conf)
-
Field Details
-
whitespacePattern
Pattern used to strip surpluss whitespace
-
-
Constructor Details
-
HeadingsParseFilter
public HeadingsParseFilter()
-
-
Method Details
-
filter
public ParseResult filter(Content content, ParseResult parseResult, HTMLMetaTags metaTags, DocumentFragment doc) Description copied from interface:HtmlParseFilterAdds metadata or otherwise modifies a parse of HTML content, given the DOM tree of a page.- Specified by:
filterin interfaceHtmlParseFilter- Parameters:
content- theContentfor a given responseparseResult- the result of running on or moreParser's on the content.metaTags- a populatedHTMLMetaTagsobjectdoc- aDocumentFragment(DOM) which can be processed in the filtering process.- Returns:
- a filtered
ParseResult - See Also:
-
setConf
- Specified by:
setConfin interfaceConfigurable
-
getConf
- Specified by:
getConfin interfaceConfigurable
-
getElement
Finds the specified element and returns its value- Parameters:
doc- the inputDocumentFragmentto processelement- the element to find in the DocumentFragment- Returns:
- a
Listcontaining headings
-
getNodeValue
Returns the text value of the specified Node and child nodes- Parameters:
node- the inputNodeto extract a value(s) for- Returns:
- the whitespace-stripped String node value(s)
-