Examples of AttributeValueSet


Examples of org.carrot2.util.attribute.AttributeValueSet

public class SavingAttributeValuesToXml
{
    public static void main(String [] args) throws Exception
    {
        // The label passed to the constructor does not affect the webapp
        final AttributeValueSet attributeValueSet = new AttributeValueSet("Example set");

        // Add all the attributes you want to change to a non-default value.
        // You can use attribute keys from Workbench Attribute Info view or the manuals.
        Map<String, Object> attributes = new HashMap<String, Object>();

        LingoClusteringAlgorithmDescriptor
            .attributeBuilder(attributes)
            .desiredClusterCountBase(20)
            .matrixReducer()
                .factorizationQuality(FactorizationQuality.MEDIUM)
                .factorizationFactory(LocalNonnegativeMatrixFactorizationFactory.class);

        CompletePreprocessingPipelineDescriptor.attributeBuilder(attributes)
            .documentAssigner()
                .exactPhraseAssignment(true);

        TermDocumentMatrixBuilderDescriptor
            .attributeBuilder(attributes)
            .titleWordsBoost(2.5);

        attributeValueSet.setAttributeValues(attributes);
       
        // We'll need to wrap the exported attribute values in a AttributeValueSets,
        // even if we want to export just one set.
        final AttributeValueSets attributeValueSets = new AttributeValueSets();
        attributeValueSets.addAttributeValueSet("example-id", attributeValueSet);
View Full Code Here

Examples of org.carrot2.util.attribute.AttributeValueSet

    private IProcessingComponent newInitializedInstance()
        throws InstantiationException, IllegalAccessException
    {
        final IProcessingComponent instance = getComponentClass().newInstance();
        final Map<String, Object> initAttributes = Maps.newHashMap();
        final AttributeValueSet defaultAttributeValueSet = attributeSets
            .getDefaultAttributeValueSet();
        if (defaultAttributeValueSet != null)
        {
            initAttributes.putAll(defaultAttributeValueSet.getAttributeValues());
        }

        final ControllerContextImpl context = new ControllerContextImpl();
        try
        {
View Full Code Here

Examples of org.carrot2.util.attribute.AttributeValueSet

        Map<String, Object> overrides)
    {
        final String componentId = getComponentId();
        assert componentId != null;

        final AttributeValueSet defaults = getDefaultAttributeValueSet(componentId);

        /*
         * Create an AVS for the default values and a based-on AVS with overridden values.
         */
        final AttributeValueSet overridenAvs = new AttributeValueSet(
            "overridden-attributes", defaults);
        removeSpecialKeys(overrides);
        removeInternalNonConfigurationAttributes(overrides, componentId);
        removeKeysWithDefaultValues(overrides, defaults);
        overrides.keySet().retainAll(defaults.getAttributeValues().keySet());
        overridenAvs.setAttributeValues(overrides);

        // Flatten and save.
        final AttributeValueSets merged = new AttributeValueSets();
        merged.addAttributeValueSet(overridenAvs.label, overridenAvs);
        merged.addAttributeValueSet(defaults.label, defaults);
View Full Code Here

Examples of org.carrot2.util.attribute.AttributeValueSet

            defaults.put(e.getKey(), e.getValue().defaultValue);
        }
        removeSpecialKeys(defaults);
        removeInternalNonConfigurationAttributes(defaults, componentId);

        AttributeValueSet result = new AttributeValueSet("defaults");
        result.setAttributeValues(defaults);
        return result;
    }
View Full Code Here

Examples of org.carrot2.util.attribute.AttributeValueSet

    }

    @Override
    public void runWithEvent(Event event)
    {
        final AttributeValueSet avs = SaveAttributesAction
            .getDefaultAttributeValueSet(input.getAlgorithmId());

        for (Map.Entry<String, Object> e : avs.getAttributeValues().entrySet())
        {
            input.setAttribute(e.getKey(), e.getValue());
        }
    }
View Full Code Here

Examples of org.carrot2.util.attribute.AttributeValueSet

    @Override
    public void runWithEvent(Event event)
    {
        // Collect all default @Input attributes.
        final AttributeValueSet defaults =
            SaveAttributesAction.getDefaultAttributeValueSet(searchInput.getAlgorithmId());

        final Map<String, Object> overrides =
            searchInput.getAttributeValueSet().getAttributeValues();

        SaveAttributesAction.removeSpecialKeys(overrides);
        overrides.keySet().retainAll(defaults.getAttributeValues().keySet());

        // Find the SearchInputView and set the editor's attribute values as defaults.
        final SearchInputView searchView = SearchInputView.getView();
        for (Map.Entry<String, Object> e : overrides.entrySet())
        {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.