added some small requirements again

This commit is contained in:
christian 2021-04-22 20:46:17 +02:00
parent 71e4be6bd4
commit ea6f79222b

View File

@ -317,7 +317,6 @@ public class Datahandler {
int prefix_size = 150; int prefix_size = 150;
SentimentValueCache sentimentCacheStr = sentimentCachingMap.getOrDefault(strCollection, null); SentimentValueCache sentimentCacheStr = sentimentCachingMap.getOrDefault(strCollection, null);
List<SimilarityMatrix> smxReturnList = new ArrayList(); List<SimilarityMatrix> smxReturnList = new ArrayList();
List<String> randomIterationComparision = new ArrayList();
if (strCacheLocal.size() < prefix_size) if (strCacheLocal.size() < prefix_size)
{ {
for (String colStr : strCollection) for (String colStr : strCollection)
@ -325,20 +324,10 @@ public class Datahandler {
strCacheLocal.put(strCacheLocal.size(), colStr); strCacheLocal.put(strCacheLocal.size(), colStr);
} }
} }
int iteratecap = strCacheLocal.size() > prefix_size ? strCacheLocal.size() - prefix_size : strCacheLocal.size() - 1;
int iterator = ThreadLocalRandom.current().nextInt(0, iteratecap);
int iterated = 0;
for (String str1 : strCacheLocal.values()) { for (String str1 : strCollection) {
if (iterated >= iterator && iterated < iterator + prefix_size) {
randomIterationComparision.add(str1);
}
if (iterated > iterator + prefix_size) {
break;
}
iterated++;
}
for (String str1 : randomIterationComparision) {
for (String str : strCollection) { for (String str : strCollection) {
if (!str.equals(str1)) { if (!str.equals(str1)) {
SimilarityMatrix SMXInit = new SimilarityMatrix(str, str1); SimilarityMatrix SMXInit = new SimilarityMatrix(str, str1);
@ -379,7 +368,8 @@ public class Datahandler {
try { try {
Future<SimilarityMatrix> take = ecs.take(); Future<SimilarityMatrix> take = ecs.take();
SimilarityMatrix smx = take.get(); SimilarityMatrix smx = take.get();
if (smx != null) { double distance_requirement = 1500.0;
if (smx != null && smx.getDistance() > distance_requirement) {
smxReturnList.add(smx); smxReturnList.add(smx);
} }
} catch (InterruptedException | ExecutionException ex) { } catch (InterruptedException | ExecutionException ex) {