Package org.carrot2.util.attribute

Examples of org.carrot2.util.attribute.AttributeValueSets


    // is not affected by the test stopwords and stoplabels.
    ILexicalData lexicalData = preprocessing.lexicalDataFactory
        .getLexicalData(LanguageCode.MALTESE);

    for (String word : wordsToCheck.split(",")) {
      if (!lexicalData.isCommonWord(new MutableCharArray(word))
          && !lexicalData.isStopLabel(word)) {
        clusters.add(new Cluster(word));
      }
    }
  }
View Full Code Here


        if (context.hasLabels())
        {
            // Term-document matrix building and reduction
            final VectorSpaceModelContext vsmContext = new VectorSpaceModelContext(
                context);
            final ReducedVectorSpaceModelContext reducedVsmContext = new ReducedVectorSpaceModelContext(
                vsmContext);
            LingoProcessingContext lingoContext = new LingoProcessingContext(
                reducedVsmContext);

            matrixBuilder.buildTermDocumentMatrix(vsmContext);
View Full Code Here

        // Further processing only if there are words to process
        clusters = Lists.newArrayList();
        if (context.hasLabels())
        {
            // Term-document matrix building and reduction
            final VectorSpaceModelContext vsmContext = new VectorSpaceModelContext(
                context);
            final ReducedVectorSpaceModelContext reducedVsmContext = new ReducedVectorSpaceModelContext(
                vsmContext);
            LingoProcessingContext lingoContext = new LingoProcessingContext(
                reducedVsmContext);
View Full Code Here

        {
            xmlStream = LoadingAttributeValuesFromXml.class
                .getResourceAsStream("algorithm-lingo-attributes.xml");

            // Load attribute value sets from the XML stream
            final AttributeValueSets attributeValueSets = AttributeValueSets
                .deserialize(xmlStream);

            // Get the desired set of attribute values for use with further processing
            final Map<String, Object> defaultAttributes = attributeValueSets
                .getDefaultAttributeValueSet().getAttributeValues();

            final Map<String, Object> fasterClusteringAttributes = attributeValueSets
                .getAttributeValueSet("faster-clustering").getAttributeValues();

            // Perform processing using the attribute values
            final Controller controller = ControllerFactory.createSimple();
View Full Code Here

        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);

        attributeValueSets.serialize(System.out);
    }
View Full Code Here

    /**
     * Invoked by the XML loading framework when the object is deserialized.
     */
    private void loadAttributeSets(ResourceLookup resourceLookup) throws Exception
    {
        attributeSets = new AttributeValueSets();

        IResource resource = null;
        if (!StringUtils.isBlank(attributeSetsResource))
        {
            // Try to load from the directly provided resource name
            resource = resourceLookup.getFirst(attributeSetsResource);

            if (resource == null)
            {
                throw new IOException("Attribute set resource not found: "
                    + attributeSetsResource);
            }
        }

        if (resource != null)
        {
            final InputStream inputStream = resource.open();
            try
            {
                attributeSets = AttributeValueSets.deserialize(inputStream);
            }
            finally
            {
                CloseableUtils.close(inputStream);
            }
        }

        if (getAttributeSets() == null)
        {
            attributeSets = new AttributeValueSets();
        }
    }
View Full Code Here

        {
            FileDialogs.rememberDirectory(REMEMBER_DIRECTORY, readLocation);
            try
            {
                final Persister persister = new Persister();
                final AttributeValueSets avs = persister.read(AttributeValueSets.class,
                    readLocation.toFile());

                return avs;
            }
            catch (Exception e)
            {
                Utils.showError(new Status(IStatus.ERROR, WorkbenchCorePlugin.PLUGIN_ID,
                    "Failed to read attributes from: " + readLocation.toOSString(), e));
            }
        }

        return new AttributeValueSets();
    }
View Full Code Here

        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);
        merged.setDefaultAttributeValueSetId(overridenAvs.label);
        return merged;
    }
View Full Code Here

          }
        },
       
        // Using the class loader directly because this time we want to omit the prefix
        new ClassLoaderLocator(core.getResourceLoader().getClassLoader())));
   
    this.controller.init(initAttributes);
    this.idFieldName = core.getSchema().getUniqueKeyField().getName();

    // Make sure the requested Carrot2 clustering algorithm class is available
View Full Code Here

                    .defaultLanguage(LanguageCode.ENGLISH);


                    File resourcesDir = new File(environment.configFile(), "carrot2/resources");

                    ResourceLookup resourceLookup = new ResourceLookup(new DirLocator(resourcesDir));

                    DefaultLexicalDataFactoryDescriptor.attributeBuilder(attributes)
                    .mergeResources(true);
                    LexicalDataLoaderDescriptor.attributeBuilder(attributes)
                    .resourceLookup(resourceLookup);
View Full Code Here

TOP

Related Classes of org.carrot2.util.attribute.AttributeValueSets

Copyright © 2018 www.massapicom. 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.