0

所以我在eclipse中运行boilerpipe。我只是想让它工作,这是代码..

package de.l3s.boilerpipe.demo;

import java.net.URL;
import de.l3s.boilerpipe.extractors.DefaultExtractor;

public static void main(final String[] args) throws Exception {
URL url;
url = new URL("http://religion.blogs.cnn.com/2012/11/16/my-take-113th-congress-looks-like-old-america/?hpt=hp_c3");

final InputStream urlStream = url.openStream();
final InputSource is = new InputSource(urlStream);

final BoilerpipeSAXInput in = new BoilerpipeSAXInput(is);
final TextDocument doc = in.getTextDocument();
urlStream.close();


System.out.println(DefaultExtractor.INSTANCE.getText(doc));
//System.out.println(ArticleExtractor.INSTANCE.getText(doc));
}

我不确定我是否在 Eclipse 中正确设置它,但我的控制台只是说...

SAX features:
http://xml.org/sax/features/namespaces
http://xml.org/sax/features/namespace-prefixes
http://xml.org/sax/features/string-interning
http://xml.org/sax/features/validation
http://xml.org/sax/features/external-general-entities
http://xml.org/sax/features/external-parameter-entities
4

1 回答 1

1

我以前从未听说过 Boilerpipe,所以如果这不是它的工作原理,请原谅我,但您的代码是否还需要在类中?

您的主要方法(实际上是您的所有代码)不在一个类中 - 或者 Boilerplate 是否使 java 的工作方式非常不同?

于 2012-11-20T21:29:44.450 回答