Package org.carrot2.workbench.core

Examples of org.carrot2.workbench.core.WorkbenchCorePlugin


        // 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


          }
        },
       
        // 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

                  + carrot2ResourcesDir);
              final InputStream resourceStream = resourceLoader
                  .openResource(carrot2ResourcesDir + "/" + resource);
             
              log.info(resource + " loaded from " + carrot2ResourcesDir);
              final IResource foundResource = new IResource() {
                public InputStream open() throws IOException {
                  return resourceStream;
                }
              };
              return new IResource[] { foundResource };
View Full Code Here

    initAttributes.put("solrIndexSchema", core.getSchema());

    // Customize Carrot2's resource lookup to first look for resources
    // using Solr's resource loader. If that fails, try loading from the classpath.
    DefaultLexicalDataFactoryDescriptor.attributeBuilder(initAttributes)
        .resourceLookup(new ResourceLookup(new IResourceLocator() {
          public IResource[] getAll(final String resource) {
            final SolrResourceLoader resourceLoader = core.getResourceLoader();
            final String carrot2ResourcesDir = resourceLoader.getConfigDir()
                + initParams.get(CarrotParams.LEXICAL_RESOURCES_DIR, CARROT_RESOURCES_PREFIX);
            try {
View Full Code Here

    initAttributes.put("solrIndexSchema", core.getSchema());

    // Customize Carrot2's resource lookup to first look for resources
    // using Solr's resource loader. If that fails, try loading from the classpath.
    DefaultLexicalDataFactoryDescriptor.attributeBuilder(initAttributes)
        .resourceLookup(new ResourceLookup(new IResourceLocator() {
          public IResource[] getAll(final String resource) {
            final SolrResourceLoader resourceLoader = core.getResourceLoader();
            final String carrot2ResourcesDir = resourceLoader.getConfigDir()
                + initParams.get(CarrotParams.LEXICAL_RESOURCES_DIR, CARROT_RESOURCES_PREFIX);
            try {
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

     * Creates permanent GUI elements (source, algorithm combos, placeholder for the
     * editors).
     */
    private void createComponents(Composite parent)
    {
        final WorkbenchCorePlugin core = WorkbenchCorePlugin.getDefault();
        parent.setLayout(new FillLayout());

        this.scroller = new CScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
        scroller.setExpandHorizontal(true);
        scroller.setExpandVertical(false);

        final Composite innerComposite = GUIFactory.createSpacer(scroller);
        final GridLayout gridLayout = (GridLayout) innerComposite.getLayout();
        gridLayout.numColumns = 2;
        gridLayout.makeColumnsEqualWidth = false;

        scroller.setContent(innerComposite);

        // Initialize sources, descriptors and source combo.
        final ProcessingComponentSuite suite = core.getComponentSuite();

        sourceViewer = createComboViewer(innerComposite, "Source", suite.getSources());
        sourceViewer.addSelectionChangedListener(sourceSelectionListener);

        sources = Maps.newHashMap();
View Full Code Here

     * to only {@link Input} and {@link Processing} attributes.
     */
    @SuppressWarnings("unchecked")
    private void addFilteredDescriptor(ProcessingComponentDescriptor e)
    {
        final WorkbenchCorePlugin core = WorkbenchCorePlugin.getDefault();

        descriptors.put(e.getId(),
            core.getComponentDescriptor(e.getId()).only(
                Input.class, Processing.class));       
    }
View Full Code Here

        memento.createChild(SOURCE_ELEMENT).putString(ID_ATTRIBUTE, search.getSourceId());
        memento.createChild(ALGORITHM_ELEMENT).putString(ID_ATTRIBUTE,
            search.getAlgorithmId());
        try
        {
            final WorkbenchCorePlugin core = WorkbenchCorePlugin.getDefault();

            /*
             * Limit saved attributes to @Input and @Processing ones.
             */
            final Map<String, Object> actual = search.getAttributeValueSet()
                .getAttributeValues();
            final AttributeValueSet filtered = new AttributeValueSet("memento-saved");

            final BindableDescriptor input = core.getComponentDescriptor(
                search.getSourceId()).flatten().only(Input.class, Processing.class);
            for (String key : input.attributeDescriptors.keySet())
            {
                if (actual.containsKey(key))
                {
                    filtered.setAttributeValue(key, actual.get(key));
                }
            }

            final BindableDescriptor algorithm = core.getComponentDescriptor(
                search.getAlgorithmId()).flatten().only(Input.class, Processing.class);
            for (String key : algorithm.attributeDescriptors.keySet())
            {
                if (actual.containsKey(key))
                {
View Full Code Here

TOP

Related Classes of org.carrot2.workbench.core.WorkbenchCorePlugin

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.