Java Code Examples for org.carrot2.core.Cluster#getScore()
The following examples show how to use
org.carrot2.core.Cluster#getScore() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConsoleFormatter.java From scava with Eclipse Public License 2.0 | 4 votes |
public String formatClusterDetails(Cluster cluster) { final Double score = cluster.getScore(); return "(" + cluster.getAllDocuments().size() + " docs" + (score != null ? ", score: " + numberFormat.format(score) : "") + ")"; }
Example 2
Source File: CarrotClusteringEngine.java From lucene-solr with Apache License 2.0 | 4 votes |
private void clustersToNamedList(List<Cluster> outputClusters, List<NamedList<Object>> parent, boolean outputSubClusters, int maxLabels) { for (Cluster outCluster : outputClusters) { NamedList<Object> cluster = new SimpleOrderedMap<>(); parent.add(cluster); // Add labels List<String> labels = outCluster.getPhrases(); if (labels.size() > maxLabels) { labels = labels.subList(0, maxLabels); } cluster.add("labels", labels); // Add cluster score final Double score = outCluster.getScore(); if (score != null) { cluster.add("score", score); } // Add other topics marker if (outCluster.isOtherTopics()) { cluster.add("other-topics", outCluster.isOtherTopics()); } // Add documents List<Document> docs = outputSubClusters ? outCluster.getDocuments() : outCluster.getAllDocuments(); List<Object> docList = new ArrayList<>(); cluster.add("docs", docList); for (Document doc : docs) { docList.add(doc.getField(SOLR_DOCUMENT_ID)); } // Add subclusters if (outputSubClusters && !outCluster.getSubclusters().isEmpty()) { List<NamedList<Object>> subclusters = new ArrayList<>(); cluster.add("clusters", subclusters); clustersToNamedList(outCluster.getSubclusters(), subclusters, outputSubClusters, maxLabels); } } }
Example 3
Source File: ConsoleFormatter.java From DistributedCrawler with Apache License 2.0 | 4 votes |
public String formatClusterDetails(Cluster cluster)//显示当前分类的详细参数,包括文档数和打分 { final Double score = cluster.getScore(); return "(" + cluster.getAllDocuments().size() + " docs" + (score != null ? ", score: " + numberFormat.format(score) : "") + ")"; }