<commit_before>/**
 *
 */
package org.carrot2.examples.core;

import java.util.*;

import org.carrot2.examples.ExampleUtils;
import org.carrot2.source.yahoo.YahooDocumentSource;
import org.carrot2.source.yahoo.YahooNewsSearchService;

import carrot2.util.attribute.*;
import carrot2.util.attribute.constraint.ConstraintUtils;
import carrot2.util.attribute.metadata.*;

/**
 * An example showing how developers can use the low-level core utilities for processing
 * Carrot2 component attribute descriptors.
 */
public class WorkingWithAttributeDescriptors
{
    public static void main(String [] args) throws InstantiationException
    {
        // Here is the component instance that we will be working with. Notice
        // that the BindableDescriptorBuilder requires an initialized instance on input.
        final YahooDocumentSource yahooDocumentSource = new YahooDocumentSource();

        // Descriptors for a component with default initialization attribute values
        BindableDescriptor descriptor = BindableDescriptorBuilder
            .buildDescriptor(yahooDocumentSource);
        displayDescriptor(descriptor, 0);
        System.out.println("\n");

        // Notice that for some values of initialization attribute values,
        // you may get different attribute descriptors
        final Map<String, Object> initAttributes = new HashMap<String, Object>();
        initAttributes.put(YahooDocumentSource.class.getName() + ".service",
            YahooNewsSearchService.class);
        AttributeBinder<commit_msg>carrot2-examples: a comment added that explains problems described in: http://issues.carrot2.org/browse/CARROT-149<commit_after>/**
 *
 */
package org.carrot2.examples.core;

import java.util.*;

import org.carrot2.examples.ExampleUtils;
import org.carrot2.source.yahoo.YahooDocumentSource;
import org.carrot2.source.yahoo.YahooNewsSearchService;

import carrot2.util.attribute.*;
import carrot2.util.attribute.constraint.ConstraintUtils;
import carrot2.util.attribute.metadata.*;

/**
 * An example showing how developers can use the low-level core utilities for processing
 * Carrot2 component attribute descriptors.
 * <p>
 * For the time being, before you run this example, you need to run
 * {@link BindableMetadataXmlSerializer} giving source code locations of at least
 * <code>carrot2-core</code> and <code>carrot2-souce-yahoo</code> as parameters. There
 * is an Eclipse launch configuration that does just that in carrot2-util-attributes/ etc/
 * eclipse.
 */
public class WorkingWithAttributeDescriptors
{
    public static void main(String [] args) throws InstantiationException
    {
        // Here is the component instance that we will be working with. Notice
        // that the BindableDescriptorBuilder requires an initialized instance on input.
        final YahooDocumentSource yahooDocumentSource = new YahooDocumentSource();

        // Descriptors for a component with default initialization attribute values
        BindableDescriptor descriptor = BindableDescriptorBuilder
            .buildDescriptor(yahooDocumentSource);
        displayDescriptor(descriptor, 0);
        System.out.println("\n");

        // Notice that for some values of initialization attribute values,
        // you may get different attribute descriptors
        final Map<String, Object> initAttributes = new HashMap<String, Object>();
        initAttributes.put(YahooDocumentSource.class.getName() + ".service",
            YahooNewsSearchService.class);
        AttributeBinder
{'fraction_non_alphanumeric': 0.08048919226393629, 'fraction_numerical': 0.00739476678043231, 'mean_word_length': 3.8376891334250343, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5329802', 'n_tokens_mistral': 884, 'n_tokens_neox': 842, 'n_words': 274}