congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ProcessingResult.getClusters
Code IndexAdd Tabnine to your IDE (free)

How to use
getClusters
method
in
org.carrot2.core.ProcessingResult

Best Java code snippets using org.carrot2.core.ProcessingResult.getClusters (Showing top 7 results out of 315)

origin: org.carrot2/carrot2-core

tempAttributes.put(AttributeNames.CLUSTERS, getClusters());
origin: org.dspace.dependencies.solr/dspace-solr-clustering

public Object cluster(Query query, DocList docList, SolrQueryRequest sreq) {
 try {
  // Prepare attributes for Carrot2 clustering call
  Map<String, Object> attributes = new HashMap<String, Object>();
  List<Document> documents = getDocuments(docList, query, sreq);
  attributes.put(AttributeNames.DOCUMENTS, documents);
  attributes.put(AttributeNames.QUERY, query.toString());
  // Pass extra overriding attributes from the request, if any
  extractCarrotAttributes(sreq.getParams(), attributes);
  // Perform clustering and convert to named list
  return clustersToNamedList(controller.process(attributes,
      clusteringAlgorithmClass).getClusters(), sreq.getParams());
 } catch (Exception e) {
  log.error("Carrot2 clustering failed", e);
  throw new RuntimeException(e);
 }
}
origin: org.carrot2/carrot2-core

@Override
protected void afterFetch(SearchEngineResponse response,
  ProcessingResult processingResult)
{
  if (readClusters) {
    final Set<String> ids = Sets.newHashSet();
    List<Document> documents = processingResult.getDocuments();
    if (documents == null) documents = Collections.emptyList();
    List<Cluster> clusters = processingResult.getClusters();
    if (documents != null && clusters != null) {
      for (Document doc : documents) {
        ids.add(doc.getStringId());
      }

      Predicate<Document> docFilter = new Predicate<Document>()
      {
        @Override
        public boolean apply(Document input)
        {
          return input != null && ids.contains(input.getStringId());
        }
      };
      this.clusters = sanityCheck(clusters, docFilter);
    }
  }
}
origin: org.carrot2/carrot2-core

if (getClusters() != null)
  clusters = Lists.newArrayList(getClusters());
origin: org.carrot2/carrot2-core

this.clusters = processingResult.getClusters();
origin: org.apache.solr/solr-clustering

@Override
public Object cluster(Query query, SolrDocumentList solrDocList,
  Map<SolrDocument, Integer> docIds, SolrQueryRequest sreq) {
 try {
  // Prepare attributes for Carrot2 clustering call
  Map<String, Object> attributes = new HashMap<>();
  List<Document> documents = getDocuments(solrDocList, docIds, query, sreq);
  attributes.put(AttributeNames.DOCUMENTS, documents);
  attributes.put(AttributeNames.QUERY, query.toString());

  // Pass the fields on which clustering runs.
  attributes.put("solrFieldNames", getFieldsForClustering(sreq));

  // Pass extra overriding attributes from the request, if any
  extractCarrotAttributes(sreq.getParams(), attributes);

  // Perform clustering and convert to an output structure of clusters.
  //
  // Carrot2 uses current thread's context class loader to get
  // certain classes (e.g. custom tokenizer/stemmer) at runtime.
  // To make sure classes from contrib JARs are available,
  // we swap the context class loader for the time of clustering.
  return withContextClassLoader(core.getResourceLoader().getClassLoader(),
    () -> clustersToNamedList(controller.process(attributes,
      clusteringAlgorithmClass).getClusters(), sreq.getParams()));
 } catch (Exception e) {
  log.error("Carrot2 clustering failed", e);
  throw new SolrException(ErrorCode.SERVER_ERROR, "Carrot2 clustering failed", e);
 }
}
origin: medcl/elasticsearch-carrot2

{response.toXContent(builder, request);}
if (processingResult != null && processingResult.getClusters() != null) {
  final Collection<Cluster> clusters = processingResult.getClusters();
  final Map<String, Object> attributes = processingResult.getAttributes();
org.carrot2.coreProcessingResultgetClusters

Javadoc

Returns the clusters that have been created during processing. The returned list is unmodifiable.

Popular methods of ProcessingResult

  • getAttributes
    Returns attributes fed-in and collected during processing. The returned map is unmodifiable.
  • <init>
    Creates a ProcessingResult with the provided attributes. Assigns unique document identifiers if docu
  • deserialize
    Deserialize from an input stream of characters.
  • documentIdToReference
    Replace document refids with the actual references upon deserialization.
  • getDocuments
    Returns the documents that have been processed. The returned collection is unmodifiable.
  • prepareAttributesForSerialization
    Prepares a temporary attributes map for serialization purposes. Includes only the requested elements
  • serialize
    Serializes this ProcessingResult to a byte stream. Documents, clusters and other attributes can be i
  • serializeJson
    Serializes this processing result as JSON to the provided writer. Documents, clusters and other attr

Popular in Java

  • Updating database using SQL prepared statement
  • putExtra (Intent)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • requestLocationUpdates (LocationManager)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now