Java - 在Eclipse中运行的Boilerpipe无法正常运行演示程序

时间:2012-11-20 21:16:39

标签: java eclipse boilerpipe

所以我在eclipse中运行样机管。我只是想让它发挥作用,这是代码..

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

1 个答案:

答案 0 :(得分:1)

我之前从未听说过Boilerpipe,所以请原谅我,如果这不是它的工作方式,但是你的代码是不是仍然需要在课堂上?

你的主要方法(事实上你所有的代码)都不在一个类中 - 或者Boilerplate是否使java的工作方式大不相同?