0

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
Ostap Hnatyuk
  • 1,116
  • 2
  • 14
  • 20

1 Answers1

1

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?

Penelope The Duck
  • 656
  • 1
  • 7
  • 16
  • LOL, my god. I haven't programmed in java in ages(have been doing C, and javascript lately), and wow. I am an idiot for not noticing that. Although now Ecplise is spitting out the error "Editor does not contain a main type". – Ostap Hnatyuk Nov 20 '12 at 21:35
  • ah haha. I do stuff like that all the time. ;-) Glad to help. – Penelope The Duck Nov 21 '12 at 09:43