diff --git a/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java b/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java index 1fb010ee..4ac5e1c1 100644 --- a/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java +++ b/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java @@ -104,6 +104,8 @@ public class Datahandler { private HashMap PairCounterHashMap = new HashMap(); + private HashMap> strResponses = new HashMap<>(); + public Datahandler() { jmweAnnotationCache = new HashMap(); pipelineAnnotationCache = new HashMap(); @@ -404,6 +406,9 @@ public class Datahandler { } public String getResponseFutures(String strF, StanfordCoreNLP stanfordCoreNLP, StanfordCoreNLP stanfordCoreNLPSentiment) { + if (strResponses.getOrDefault(strF, null) == null) { + strResponses.put(strF, new ArrayList<>()); + } Annotation strAnno = new Annotation(strF); strAnno.compact(); @@ -595,6 +600,24 @@ public class Datahandler { break; } + ArrayList orDefault = strResponses.getOrDefault(strF, null); + boolean skip = false; + for (String strItr : orDefault) { + if (secondaryRelation.equalsIgnoreCase(strItr)) { + skip = true; + if (orDefault.size() >= concurrentRelations.size()) { + orDefault = new ArrayList<>(); + } else if (orDefault.size() > 3) { + double v = Math.random() * 10; + if (v > 8.6) { + orDefault = new ArrayList<>(); + } + } + break; + } + } + if (skip) continue; + if (passedFirst && lastIter < concurrentRelations.size()) { String testSTR = SB.toString() + " " + secondaryRelation; SentimentAnalyzerTest SMX = getReponseFuturesHelper(strF, testSTR, stanfordCoreNLP, stanfordCoreNLPSentiment, @@ -616,6 +639,8 @@ public class Datahandler { SB.append(secondaryRelation).append(" "); mysqlUpdateLastUsed.add(secondaryRelation); + orDefault.add(secondaryRelation); + strResponses.put(strF, orDefault); } } if (SB.toString().isEmpty()) { diff --git a/ArtificialAutism/src/main/java/PresentationLayer/DiscordHandler.java b/ArtificialAutism/src/main/java/PresentationLayer/DiscordHandler.java index fb932b0a..85786ed6 100644 --- a/ArtificialAutism/src/main/java/PresentationLayer/DiscordHandler.java +++ b/ArtificialAutism/src/main/java/PresentationLayer/DiscordHandler.java @@ -90,7 +90,7 @@ public class DiscordHandler extends ListenerAdapter { private static Datahandler datahandler; private static StanfordCoreNLP stanfordCoreNLPSentiment; private static ExecutorService executorService = Executors.newFixedThreadPool(1); - private static ExecutorService executorServiceIngame = Executors.newFixedThreadPool(1); + private static ExecutorService executorServiceIngame = Executors.newFixedThreadPool(2); //TODO add python program that edits the java code. python program just adds test if statements on //variables until the tests pass