this should add a bit more variety when people repeat sentences
This commit is contained in:
parent
e234ce0109
commit
da92210753
@ -104,6 +104,8 @@ public class Datahandler {
|
|||||||
|
|
||||||
private HashMap<String, Integer> PairCounterHashMap = new HashMap();
|
private HashMap<String, Integer> PairCounterHashMap = new HashMap();
|
||||||
|
|
||||||
|
private HashMap<String, ArrayList<String>> strResponses = new HashMap<>();
|
||||||
|
|
||||||
public Datahandler() {
|
public Datahandler() {
|
||||||
jmweAnnotationCache = new HashMap<String, Annotation>();
|
jmweAnnotationCache = new HashMap<String, Annotation>();
|
||||||
pipelineAnnotationCache = new HashMap<String, Annotation>();
|
pipelineAnnotationCache = new HashMap<String, Annotation>();
|
||||||
@ -404,6 +406,9 @@ public class Datahandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getResponseFutures(String strF, StanfordCoreNLP stanfordCoreNLP, StanfordCoreNLP stanfordCoreNLPSentiment) {
|
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);
|
Annotation strAnno = new Annotation(strF);
|
||||||
strAnno.compact();
|
strAnno.compact();
|
||||||
@ -595,6 +600,24 @@ public class Datahandler {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ArrayList<String> 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()) {
|
if (passedFirst && lastIter < concurrentRelations.size()) {
|
||||||
String testSTR = SB.toString() + " " + secondaryRelation;
|
String testSTR = SB.toString() + " " + secondaryRelation;
|
||||||
SentimentAnalyzerTest SMX = getReponseFuturesHelper(strF, testSTR, stanfordCoreNLP, stanfordCoreNLPSentiment,
|
SentimentAnalyzerTest SMX = getReponseFuturesHelper(strF, testSTR, stanfordCoreNLP, stanfordCoreNLPSentiment,
|
||||||
@ -616,6 +639,8 @@ public class Datahandler {
|
|||||||
|
|
||||||
SB.append(secondaryRelation).append(" ");
|
SB.append(secondaryRelation).append(" ");
|
||||||
mysqlUpdateLastUsed.add(secondaryRelation);
|
mysqlUpdateLastUsed.add(secondaryRelation);
|
||||||
|
orDefault.add(secondaryRelation);
|
||||||
|
strResponses.put(strF, orDefault);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (SB.toString().isEmpty()) {
|
if (SB.toString().isEmpty()) {
|
||||||
|
@ -90,7 +90,7 @@ public class DiscordHandler extends ListenerAdapter {
|
|||||||
private static Datahandler datahandler;
|
private static Datahandler datahandler;
|
||||||
private static StanfordCoreNLP stanfordCoreNLPSentiment;
|
private static StanfordCoreNLP stanfordCoreNLPSentiment;
|
||||||
private static ExecutorService executorService = Executors.newFixedThreadPool(1);
|
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
|
//TODO add python program that edits the java code. python program just adds test if statements on
|
||||||
//variables until the tests pass
|
//variables until the tests pass
|
||||||
|
Loading…
Reference in New Issue
Block a user