예제 #1
0
 /*
  * Recursive descent into subclusters.
  */
 private static void flatten(ArrayList<Cluster> flattened, Collection<Cluster> clusters) {
   for (Cluster c : clusters) {
     flattened.add(c);
     final List<Cluster> subclusters = c.getSubclusters();
     if (!subclusters.isEmpty()) {
       flatten(flattened, subclusters);
     }
   }
 }
예제 #2
0
 /**
  * If there are unclustered documents, appends the "Other Topics" group to the <code>clusters
  * </code>.
  *
  * @see #buildOtherTopics(List, List, String)
  */
 public static void appendOtherTopics(
     List<Document> allDocuments, List<Cluster> clusters, String label) {
   final Cluster otherTopics = buildOtherTopics(allDocuments, clusters, label);
   if (!otherTopics.getDocuments().isEmpty()) {
     clusters.add(otherTopics);
   }
 }
예제 #3
0
 /** For JSON serialization only. */
 @JsonProperty("clusters")
 @SuppressWarnings("unused")
 private List<Cluster> getSubclustersForSerialization() {
   return subclustersView.isEmpty() ? null : subclustersView;
 }