本文整理汇总了Java中de.l3s.boilerpipe.extractors.DefaultExtractor类的典型用法代码示例。如果您正苦于以下问题:Java DefaultExtractor类的具体用法?Java DefaultExtractor怎么用?Java DefaultExtractor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultExtractor类属于de.l3s.boilerpipe.extractors包,在下文中一共展示了DefaultExtractor类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TargetModelElasticSearch
import de.l3s.boilerpipe.extractors.DefaultExtractor; //导入依赖的package包/类
public TargetModelElasticSearch(Page page) {
this.url = page.getURL().toString();
this.retrieved = new Date();
this.domain = page.getDomainName();
this.html = page.getContentAsString();
this.responseHeaders = page.getResponseHeaders();
this.topPrivateDomain = LinkRelevance.getTopLevelDomain(page.getDomainName());
this.isRelevant = page.getTargetRelevance().isRelevant() ? "relevant" : "irrelevant";
if (page.isHtml()) {
this.words = page.getParsedData().getWords();
this.wordsMeta = page.getParsedData().getWordsMeta();
this.title = page.getParsedData().getTitle();
this.relevance = page.getTargetRelevance().getRelevance();
try {
this.text = DefaultExtractor.getInstance().getText(page.getContentAsString());
} catch (Exception e) {
this.text = "";
}
}
}
示例2: testBoilerpipe
import de.l3s.boilerpipe.extractors.DefaultExtractor; //导入依赖的package包/类
@Test
public void testBoilerpipe() throws IOException, BoilerpipeProcessingException{
String plain = ArticleExtractor.getInstance().getText(_html);
System.out.println("=== BEGIN BOILERPIPE OUTPUT 1 ===");
System.out.println(plain);
System.out.println("=== END BOILERPIPE OUTPUT 1 ===");
plain = DefaultExtractor.getInstance().getText(_html);
System.out.println("=== BEGIN BOILERPIPE OUTPUT 2 ===");
System.out.println(plain);
System.out.println("=== END BOILERPIPE OUTPUT 2 ===");
}
示例3: extractHtml
import de.l3s.boilerpipe.extractors.DefaultExtractor; //导入依赖的package包/类
private void extractHtml(InputStream record, Document doc) throws TextExtractionException {
try {
BoundedInputStream in = new BoundedInputStream(record, maxDocSize);
TextDocument textDoc = new BoilerpipeSAXInput(new InputSource(in)).getTextDocument();
doc.setTitle(textDoc.getTitle());
doc.setText(textDoc.getText(true, true).replace("\uFFFF", ""));
if (boilingEnabled) {
DefaultExtractor.INSTANCE.process(textDoc);
doc.setBoiled(textDoc.getContent().replace("\uFFFF", ""));
}
} catch (SAXException | BoilerpipeProcessingException | IllegalArgumentException | ArrayIndexOutOfBoundsException e) {
throw new TextExtractionException(e);
}
}
示例4: BoilerpipeContentHandler
import de.l3s.boilerpipe.extractors.DefaultExtractor; //导入依赖的package包/类
/**
* Creates a new boilerpipe-based content extractor, using the
* {@link DefaultExtractor} extraction rules and "delegate" as the content handler.
*
* @param delegate
* The {@link ContentHandler} object
*/
public BoilerpipeContentHandler(ContentHandler delegate) {
this(delegate, DefaultExtractor.INSTANCE);
}