@Test
public void testCarrot1008() throws Exception {

  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  DocumentBuilder db = dbf.newDocumentBuilder();
  Element root;
  try (InputStream is = getClass().getResourceAsStream("CARROT-1008.xml")) {
    root = db.parse(is).getDocumentElement();
  }
  Stream<TestDocument> docStream =
      elementStream(root, "document")
          .map(
              docElement -> {
                String title =
                    elementStream(docElement, "title")
                        .map(e -> e.getTextContent())
                        .collect(Collectors.joining(" . "));
                String snippet =
                    elementStream(docElement, "snippet")
                        .map(e -> e.getTextContent())
                        .collect(Collectors.joining(" . "));
                return new TestDocument(title, snippet);
              });
  STCClusteringAlgorithm algorithm = algorithm();
  algorithm.maxClusters.set(30);
  List<Cluster<Document>> clusters =
      algorithm.cluster(docStream, CachedLangComponents.loadCached("English"));
  List<String> collect =
      clusters.stream().flatMap(c -> c.getLabels().stream()).collect(Collectors.toList());
  Assertions.assertThat(collect.contains("Guns") && collect.contains("Gun")).isFalse();
}