Package org.carrot2.core

Examples of org.carrot2.core.ProcessingResult


        /*
         * If we have a processing result...
         */
        if (searchResult.hasProcessingResult())
        {
            final ProcessingResult result = searchResult.getProcessingResult();

            /*
             * Check if there is a query in the output attributes (may be different from
             * the one set on input).
             */

            title = ObjectUtils.toString(
                result.getAttributes().get(AttributeNames.QUERY), null);

            /*
             * Override with custom title, if present.
             */

            title = ObjectUtils.toString(result.getAttributes().get(
                AttributeNames.PROCESSING_RESULT_TITLE), title);
        }

        if (StringUtils.isEmpty(title))
        {
View Full Code Here


    /**
     *
     */
    private void doSave(SaveOptions options)
    {
        final ProcessingResult result = getSearchResult().getProcessingResult();
        if (result == null)
        {
            Utils.showError(new Status(Status.ERROR, WorkbenchCorePlugin.PLUGIN_ID,
                "No search result yet."));
            return;
View Full Code Here

    }

    @Test
    public void testClusteringDataMining()
    {
        final ProcessingResult processingResult = cluster(DOCUMENTS_DATA_MINING);
        final Collection<Cluster> clusters = processingResult.getClusters();

        assertThat(clusters.size()).isGreaterThan(0);
    }
View Full Code Here

            Multimap<Integer, List<Cluster>> clusterings = ArrayListMultimap.create();

            // Group results by query
            for (Future<ProcessingResult> future : results)
            {
                final ProcessingResult processingResult = future.get();
                final Integer dataSetIndex = (Integer) processingResult.getAttributes().get("dataSetIndex");
                clusterings.put(dataSetIndex, processingResult.getClusters());
            }

            // Make sure results are the same within each data set
            for (Integer dataSetIndex : clusterings.keySet())
            {
View Full Code Here

    public ProcessingResult cluster(Collection<Document> documents)
    {
        processingAttributes.put(AttributeNames.DOCUMENTS, documents);
        Controller controller = getSimpleController(initAttributes);
        try {
            ProcessingResult process = controller.process(processingAttributes, getComponentClass());
            return process;
        } finally {
            controller.dispose();
            super.simpleController = null;
        }
View Full Code Here

   
            List<Document> documents = null;
            int index = 0;
            for (Future<ProcessingResult> future : results)
            {
                ProcessingResult processingResult = future.get();
                final List<Document> documentsLocal = (List<Document>) processingResult
                    .getAttributes().get(AttributeNames.DOCUMENTS);
                assertThat(documentsLocal).as("documents at " + index).isNotNull();
                if (!canReturnMoreResultsThanRequested())
                {
                    assertThat(documentsLocal.size()).as("documents.size() at " + index)
View Full Code Here

    /*
     *
     */
    private void showProcessingResult()
    {
        final ProcessingResult current = this.editor.getSearchResult()
            .getProcessingResult();

        if (current != null)
        {
            this.documentList.show(current);
View Full Code Here

    /**
     * Display current processing result associated with our editor.
     */
    private void showProcessingResult()
    {
        final ProcessingResult current = this.editor.getSearchResult()
            .getProcessingResult();

        if (current != null)
        {
            clusterTree.show(current);
View Full Code Here

    protected SearchEngineResponse fetchSearchResponse() throws Exception
    {
        final String serviceURL = buildServiceUrl();
        final SearchEngineResponse response = new SearchEngineResponse();

        final ProcessingResult processingResult = loadProcessingResult(
                serviceURL,
                toCarrot2Xslt,
                getXsltParameters(),
                response.metadata,
                getUser(),
                getPassword(),
                redirectStrategy);

        final List<Document> documents = processingResult.getDocuments();
        if (documents != null)
        {
            response.results.addAll(documents);
            final Map<String, Object> resultAttributes = processingResult.getAttributes();
            response.metadata
                .put(SearchEngineResponse.RESULTS_TOTAL_KEY, resultAttributes
                    .containsKey(AttributeNames.RESULTS_TOTAL) ? resultAttributes
                    .get(AttributeNames.RESULTS_TOTAL) : (long) documents.size());
        }
View Full Code Here

                        CommonAttributesDescriptor.attributeBuilder(processingAttrs)
                            .documents(prepareDocumentsForClustering(clusteringRequest, response))
                            .query(clusteringRequest.getQueryHint());
       
                        final long tsClusteringStart = System.nanoTime();
                        final ProcessingResult result = controller.process(processingAttrs, algorithmId);
                        final DocumentGroup[] groups = adapt(result.getClusters());
                        final long tsClusteringEnd = System.nanoTime();

                        final Map<String,String> info = ImmutableMap.<String,String> builder()
                                .put(ClusteringActionResponse.Fields.Info.ALGORITHM, algorithmId)
                                .put(ClusteringActionResponse.Fields.Info.SEARCH_MILLIS, Long.toString(TimeUnit.NANOSECONDS.toMillis(tsSearchEnd - tsSearchStart)))
View Full Code Here

TOP

Related Classes of org.carrot2.core.ProcessingResult

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.