public static void main(String[] args) throws IOException, PageNotFoundException {
    if (args.length != 1) {
      System.out.println("Usage: " + WikipediaQuickCheck.class.getName() + " <url>");
      System.exit(1);
    }
    WikipediaQuickCheck check = new WikipediaQuickCheck();
    // URL examples:
    //String urlString = "http://de.wikipedia.org/wiki/Angela_Merkel";
    //String urlString = "https://de.wikipedia.org/wiki/Benutzer_Diskussion:Dnaber";
    //String urlString = "https://secure.wikimedia.org/wikipedia/de/wiki/Gütersloh";
    String urlString = args[0];
    MarkupAwareWikipediaResult result = check.checkPage(new URL(urlString), new ErrorMarker("***", "***"));
    int errorCount = 0;
    for (AppliedRuleMatch match : result.getAppliedRuleMatches()) {
      RuleMatchApplication matchApplication = match.getRuleMatchApplications().get(0);
      RuleMatch ruleMatch = match.getRuleMatch();
      Rule rule = ruleMatch.getRule();
      System.out.println("");
      String message = ruleMatch.getMessage().replace("<suggestion>", "'").replace("</suggestion>", "'");
      errorCount++;
      System.out.print(errorCount + ". " + message);
      if (rule instanceof AbstractPatternRule) {
        System.out.println(" (" + ((AbstractPatternRule) rule).getFullId() + ")");
      } else {
        System.out.println(" (" + rule.getId() + ")");
      }
      System.out.println("    ..." + matchApplication.getOriginalErrorContext(50).replace("\n", "\\n") + "...");
    }
  }
public static void main ( String [ ] args ) throws IOException , PageNotFoundException { if ( args . length != 1 ) { System . out . println ( "Usage: " + WikipediaQuickCheck . class . getName ( ) + " <url>" ) ; System . exit ( 1 ) ; } WikipediaQuickCheck check = new WikipediaQuickCheck ( ) ; String urlString = args [ 0 ] ; MarkupAwareWikipediaResult result = check . checkPage ( new URL ( urlString ) , new ErrorMarker ( "***" , "***" ) ) ; int errorCount = 0 ; for ( AppliedRuleMatch match : result . getAppliedRuleMatches ( ) ) { RuleMatchApplication matchApplication = match . getRuleMatchApplications ( ) . get ( 0 ) ; RuleMatch ruleMatch = match . getRuleMatch ( ) ; Rule rule = ruleMatch . getRule ( ) ; System . out . println ( "" ) ; String message = ruleMatch . getMessage ( ) . replace ( "<suggestion>" , "'" ) . replace ( "</suggestion>" , "'" ) ; errorCount ++ ; System . out . print ( errorCount + ". " + message ) ; if ( rule instanceof AbstractPatternRule ) { System . out . println ( " (" + ( ( AbstractPatternRule ) rule ) . getFullId ( ) + ")" ) ; } else { System . out . println ( " (" + rule . getId ( ) + ")" ) ; } System . out . println ( "    ..." + matchApplication . getOriginalErrorContext ( 50 ) . replace ( "\n" , "\\n" ) + "..." ) ; } }
/*public static void mainTest(String[] args) throws IOException {
TextFilter filter = new SwebleWikipediaTextFilter();
String plainText = filter.filter("hallo\n* eins\n* zwei");
System.out.println(plainText);
}