Package org.apache.nutch.parse.headings
Class HeadingsParseFilter
- java.lang.Object
-
- org.apache.nutch.parse.headings.HeadingsParseFilter
-
- All Implemented Interfaces:
Configurable,HtmlParseFilter,Pluggable
public class HeadingsParseFilter extends Object implements HtmlParseFilter
HtmlParseFilter to retrieve h1 and h2 values from the DOM.
-
-
Field Summary
Fields Modifier and Type Field Description protected static PatternwhitespacePatternPattern used to strip surpluss whitespace-
Fields inherited from interface org.apache.nutch.parse.HtmlParseFilter
X_POINT_ID
-
-
Constructor Summary
Constructors Constructor Description HeadingsParseFilter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ParseResultfilter(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.ConfigurationgetConf()protected List<String>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 Detail
-
whitespacePattern
protected static Pattern whitespacePattern
Pattern used to strip surpluss whitespace
-
-
Method Detail
-
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:
Parser.getParse(Content)
-
setConf
public void setConf(Configuration conf)
- Specified by:
setConfin interfaceConfigurable
-
getConf
public Configuration getConf()
- Specified by:
getConfin interfaceConfigurable
-
getElement
protected List<String> getElement(DocumentFragment doc, String element)
Finds the specified element and returns its value- Parameters:
doc- the inputDocumentFragmentto processelement- the element to find in the DocumentFragment- Returns:
- a
Listcontaining headings
-
-