diff --git a/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java b/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java index 3f6e821c..30098f07 100644 --- a/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java +++ b/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java @@ -456,41 +456,45 @@ public class Datahandler { private String getResponseFutures(String strF) { List values_copy = new ArrayList(stringCache.values()); - int maxsize = values_copy.size() > 500 ? 500 : values_copy.size(); Collections.shuffle(values_copy); - List 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 concurrentRelations = new ArrayList(); - List> 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 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 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";