diff --git a/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java b/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java index bfb8c644..70f34124 100644 --- a/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java +++ b/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java @@ -220,7 +220,7 @@ public class Datahandler { hlStatsMessages.put(str, hlStatsMessages.size()); } } - int capacity = 1250; + int capacity = 250; hlStatsMessages.keySet().forEach(str -> { if (!str.startsWith("!") && MessageResponseHandler.getStr().values().size() < capacity) { String orElse = strCacheLocal.values().parallelStream().filter(e -> e.equals(str)).findAny().orElse(null); @@ -305,11 +305,11 @@ public class Datahandler { } private List StrComparringNoSentenceRelationMap( - ConcurrentMap strCacheLocal, Collection str, ConcurrentMap localJMWEMap, + ConcurrentMap strCacheLocal, Collection strCollection, ConcurrentMap localJMWEMap, ConcurrentMap localPipelineAnnotation, ConcurrentMap localPipelineSentimentAnnotation, ConcurrentMap localCoreDocumentMap, CompletionService ecs, int index) { int prefix_size = 125; - SentimentValueCache sentimentCacheStr = sentimentCachingMap.getOrDefault(str, null); + SentimentValueCache sentimentCacheStr = sentimentCachingMap.getOrDefault(strCollection, null); List smxReturnList = new ArrayList(); List randomIterationComparision = new ArrayList(); int iteratecap = strCacheLocal.size() > prefix_size ? strCacheLocal.size() - prefix_size : strCacheLocal.size(); @@ -325,18 +325,18 @@ public class Datahandler { iterated++; } for (String str1 : randomIterationComparision) { - for (String str2 : str) { - if (!str2.equals(str1)) { - SimilarityMatrix SMXInit = new SimilarityMatrix(str2, str1); + for (String str : strCollection) { + if (!str.equals(str1)) { + SimilarityMatrix SMXInit = new SimilarityMatrix(str, str1); SentimentValueCache sentimentCacheStr1 = sentimentCachingMap.getOrDefault(str1, null); Callable worker; if (stringCache.size() < prefix_size) { - worker = new SentimentAnalyzerTest(str2, str1, SMXInit, + worker = new SentimentAnalyzerTest(str, str1, SMXInit, localJMWEMap.get(str), localJMWEMap.get(str1), localPipelineAnnotation.get(str), localPipelineAnnotation.get(str1), localPipelineSentimentAnnotation.get(str), localPipelineSentimentAnnotation.get(str1), localCoreDocumentMap.get(str), localCoreDocumentMap.get(str1), sentimentCacheStr, sentimentCacheStr1); } else { - worker = new SentimentAnalyzerTest(str2, str1, SMXInit, + worker = new SentimentAnalyzerTest(str, str1, SMXInit, localJMWEMap.get(str), jmweAnnotationCache.get(str1), localPipelineAnnotation.get(str), pipelineAnnotationCache.get(str1), localPipelineSentimentAnnotation.get(str), pipelineSentimentAnnotationCache.get(str1), localCoreDocumentMap.get(str), coreDocumentAnnotationCache.get(str1), sentimentCacheStr, sentimentCacheStr1); @@ -350,8 +350,17 @@ public class Datahandler { try { Future take = ecs.take(); SimilarityMatrix smx = take.get(); - if (smx != null && !smxReturnList.contains(smx)) { - smxReturnList.add(smx); + if (smx != null) { + boolean present = false; + for (SimilarityMatrix str_smx : smxReturnList) { + if (str_smx.getPrimaryString().equals(smx.getPrimaryString())) { + present = true; + break; + } + } + if (!present) { + smxReturnList.add(smx); + } } } catch (InterruptedException | ExecutionException ex) { // @@ -376,7 +385,7 @@ public class Datahandler { //System.out.println("StrComparringNoSentenceRelationMap size: " + StrComparringNoSentenceRelationMap.size()); Collections.sort(StrComparringNoSentenceRelationMap, (e1, e2) -> e1.getPrimaryString().compareTo(e2.getPrimaryString())); ConcurrentMap strmapreturn = futuresReturnOverallEvaluation(StrComparringNoSentenceRelationMap); - //System.out.println("strmapreturn size: " + strmapreturn.size()); + System.out.println("strmapreturn size: " + strmapreturn.size()); return strmapreturn; }