/**
 * 
 */
package org.carrot2.examples;

import java.util.*;

import org.carrot2.clustering.synthetic.ByUrlClusteringAlgorithm;
import org.carrot2.core.*;
import org.carrot2.core.controller.SimpleController;
import org.carrot2.source.yahoo.YahooDocumentSource;

/**
 * An example showing how to query Yahoo! for search results
 * and cluster them dynamically.
 */
public class ClusteringWithYahooAPI
{
    @SuppressWarnings("unchecked")
    public static void main(String [] args)
    {
        final SimpleController controller = new SimpleController();

        // Initialization parameters for components.
        final Map<String, Object> parameters = new HashMap<String, Object>();

        parameters.put("query", "data mining");
        parameters.put("results", 200);

        // Runtime attributes passed between components.
        final Map<String, Object> attributes = new HashMap<String, Object>();

        ProcessingResult result = controller.process(parameters, attributes, 
                YahooDocumentSource.class, ByUrlClusteringAlgorithm.class);

        ExampleUtils.displayResults(result);
    }
}

@@ -58,17 +58,46 @@
 va.util.
-*
+HashMap;%0D%0Aimport java.util.Map
 ;%0D%0A%0D%0Aimp
@@ -184,17 +184,32 @@
 t2.core.
-*
+ProcessingResult
 ;%0D%0Aimpor
@@ -257,16 +257,16 @@
 oller;%0D%0A
-
 import o
@@ -310,16 +310,73 @@
 Source;%0D
+%0Aimport org.carrot2.source.yahoo.YahooNewsSearchService;%0D
 %0A%0D%0A/**%0D%0A
@@ -1195,24 +1195,481 @@
 .class);%0D%0A%0D%0A
+        ExampleUtils.displayResults(result);%0D%0A        %0D%0A        //%0D%0A        // Fetching from Yahoo! News.%0D%0A        //%0D%0A        parameters.put(YahooDocumentSource.class.getName() + %22.service%22, %0D%0A            YahooNewsSearchService.class);%0D%0A        parameters.put(%22query%22, %22iraq%22);%0D%0A        parameters.put(%22results%22, 50);%0D%0A%0D%0A        result = controller.process(parameters, attributes, %0D%0A            YahooDocumentSource.class, ByUrlClusteringAlgorithm.class);%0D%0A
         Exam

Example of querying the news source.