STCClusteringAlgorithm extends AttrComposite implements ClusteringAlgorithm { static int computeIntersection(int[] a, int aPos, int aLength, int[] b, int bPos, int bLength) { final int maxa = aPos + aLength; final int maxb = bPos + bLength; int ea; int eb; int common = 0; while (aPos < maxa && bPos < maxb) { ea = a[aPos]; eb = b[bPos]; if (ea >= eb) bPos++; if (ea <= eb) aPos++; if (ea == eb) common++; } return common; }  @Override Set<Class<?>> requiredLanguageComponents(); @Override List<Cluster<T>> cluster(
      Stream<? extends T> docStream, LanguageComponents languageComponents); static final String NAME; final AttrString queryHint; public AttrDouble ignoreWordIfInHigherDocsPercent; public AttrDouble minBaseClusterScore; public AttrInteger minBaseClusterSize; public AttrInteger maxBaseClusters; public AttrInteger maxClusters; public AttrDouble mergeThreshold; public AttrDouble maxPhraseOverlap; public AttrDouble mostGeneralPhraseCoverage; public AttrInteger maxWordsPerLabel; public AttrInteger maxPhrasesPerLabel; public AttrDouble singleTermBoost; public AttrInteger optimalPhraseLength; public AttrDouble optimalPhraseLengthDev; public AttrDouble documentCountBoost; public AttrDouble scoreWeight; public AttrBoolean mergeStemEquivalentBaseClusters; public BasicPreprocessingPipeline preprocessing; }
@Test public void testComputeIntersection() { int[] t1; t1 = new int[] {0, 1, 2, 1, 2, 3}; Assertions.assertThat(STCClusteringAlgorithm.computeIntersection(t1, 0, 3, t1, 3, 3)) .isEqualTo(2); t1 = new int[] {0, 1, 2, 3, 5, 6}; Assertions.assertThat(STCClusteringAlgorithm.computeIntersection(t1, 0, 3, t1, 3, 3)) .isEqualTo(0); t1 = new int[] {0, 1, 2, -1, 2, 6}; Assertions.assertThat(STCClusteringAlgorithm.computeIntersection(t1, 0, 3, t1, 3, 3)) .isEqualTo(1); t1 = new int[] {0, 1, 2, 0}; Assertions.assertThat(STCClusteringAlgorithm.computeIntersection(t1, 0, 3, t1, 3, 1)) .isEqualTo(1); }