質問

So I'm running boilerpipe in eclipse. I'm just trying to get it to work, here is the code..

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));
}

I'm not sure if I set it up in Eclipse properly or not, but my console just says things like...

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
役に立ちましたか?

解決

I've never heard of Boilerpipe before, so please forgive me if this is not how it works, but doesn't your code still need to be inside a class?

You have your main method (and in fact all your code) not within a class - or does Boilerplate make the java work very differently?

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top