minor update to selecting randomly strings

This commit is contained in:
jenzur 2020-09-13 20:58:29 +02:00
parent ff48940485
commit bc813e7ba0

View File

@ -456,41 +456,45 @@ public class Datahandler {
private String getResponseFutures(String strF) {
List<String> values_copy = new ArrayList<String>(stringCache.values());
int maxsize = values_copy.size() > 500 ? 500 : values_copy.size();
Collections.shuffle(values_copy);
List<String> strCache = values_copy.subList(0, maxsize);
double preRelationUserCounters = -150000.0;
//WHY THE FUCK CANT YOU JUST TRANSFER A SimilarityMatrix OBJECT LIST LIKE ANY OTHER NORMAL COLLECTION, WHY DOES IT HAVE TO BE A FUCKING STRING LIST
double preRelationUserCounters = -155000.0;
double zero = 0.0;
double positive_sentence_count = 0.0;
double positive_cap = 500.0;
List<String> concurrentRelations = new ArrayList();
List<Callable<SimilarityMatrix>> call_able_list = new ArrayList();
for (String str1 : strCache) {
for (String str1 : values_copy) {
if (!strF.equals(str1)) {
if (positive_sentence_count > positive_cap) {
break;
}
SentimentValueCache sentimentCacheStr1 = sentimentCachingMap.getOrDefault(str1, null);
Callable<SimilarityMatrix> worker = new SentimentAnalyzerTest(strF, str1, new SimilarityMatrix(strF, str1),
strAnnoJMWE, jmweAnnotationCache.get(str1), strAnno,
pipelineAnnotationCache.get(str1), strAnnoSentiment,
pipelineSentimentAnnotationCache.get(str1), coreDoc, coreDocumentAnnotationCache.get(str1), null, sentimentCacheStr1);
call_able_list.add(worker);
}
}
for (Callable<SimilarityMatrix> callSMX : call_able_list) {
try {
SimilarityMatrix getSMX = callSMX.call();
if (getSMX != null) {
Double scoreRelationLastUserMsg = getSMX.getDistance();
if (scoreRelationLastUserMsg > preRelationUserCounters) {
preRelationUserCounters = scoreRelationLastUserMsg;
concurrentRelations.add(getSMX.getSecondaryString());
//System.out.println("secondary: " + getSMX.getSecondaryString() + "\nDistance: " + getSMX.getDistance() + "\n");
//System.out.println("SUCESS concurrentRelationsMap size: " + concurrentRelations.size() + "\n");
try {
SimilarityMatrix getSMX = worker.call();
if (getSMX != null) {
Double scoreRelationLastUserMsg = getSMX.getDistance();
if (scoreRelationLastUserMsg > preRelationUserCounters) {
preRelationUserCounters = scoreRelationLastUserMsg;
concurrentRelations.add(getSMX.getSecondaryString());
positive_sentence_count += 0.1;
//System.out.println("secondary: " + getSMX.getSecondaryString() + "\nDistance: " + getSMX.getDistance() + "\n");
//System.out.println("SUCESS concurrentRelationsMap size: " + concurrentRelations.size() + "\n");
}
if (scoreRelationLastUserMsg > zero) {
positive_sentence_count += 155;
}
}
} catch (Exception ex) {
Logger.getLogger(Datahandler.class.getName()).log(Level.SEVERE, null, ex);
}
} catch (Exception ex) {
Logger.getLogger(Datahandler.class.getName()).log(Level.SEVERE, null, ex);
}
}
StringBuilder SB = new StringBuilder();
double randomLenghtPermit = strF.length() * (Math.random() * Math.random() * Math.random());
double randomLenghtPermit = strF.length() * ((Math.random() * Math.random() * Math.random()) * 100);
Collections.reverse(concurrentRelations);
if (concurrentRelations.isEmpty()) {
return "failure, preventing stuckness";