Class NaiveBayesParseFilter
java.lang.Object
org.apache.nutch.parsefilter.naivebayes.NaiveBayesParseFilter
- All Implemented Interfaces:
Configurable,HtmlParseFilter,Pluggable
Html Parse filter that classifies the outlinks from the parseresult as
relevant or irrelevant based on the parseText's relevancy (using a training
file where you can give positive and negative example texts see the
description of parsefilter.naivebayes.trainfile) and if found irrelevant it
gives the link a second chance if it contains any of the words from the list
given in parsefilter.naivebayes.wordlist. CAUTION: Set the parser.timeout to
-1 or a bigger value than 30, when using this classifier.
-
Field Summary
FieldsFields inherited from interface org.apache.nutch.parse.HtmlParseFilter
X_POINT_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleancontainsWord(String url, ArrayList<String> wordlist) filter(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.booleanfilterParse(String text) booleangetConf()voidsetConf(Configuration conf) voidtrain()
-
Field Details
-
TRAINFILE_MODELFILTER
- See Also:
-
DICTFILE_MODELFILTER
- See Also:
-
-
Constructor Details
-
NaiveBayesParseFilter
public NaiveBayesParseFilter()
-
-
Method Details
-
filterParse
-
filterUrl
-
classify
- Throws:
IOException
-
train
- Throws:
Exception
-
containsWord
-
setConf
- Specified by:
setConfin interfaceConfigurable
-
getConf
- Specified by:
getConfin interfaceConfigurable
-
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:
-