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) { private String getResponseFutures(String strF) {
List<String> values_copy = new ArrayList<String>(stringCache.values()); List<String> values_copy = new ArrayList<String>(stringCache.values());
int maxsize = values_copy.size() > 500 ? 500 : values_copy.size();
Collections.shuffle(values_copy); Collections.shuffle(values_copy);
List<String> strCache = values_copy.subList(0, maxsize); double preRelationUserCounters = -155000.0;
double preRelationUserCounters = -150000.0; double zero = 0.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 positive_sentence_count = 0.0;
double positive_cap = 500.0;
List<String> concurrentRelations = new ArrayList(); List<String> concurrentRelations = new ArrayList();
List<Callable<SimilarityMatrix>> call_able_list = new ArrayList(); for (String str1 : values_copy) {
for (String str1 : strCache) {
if (!strF.equals(str1)) { if (!strF.equals(str1)) {
if (positive_sentence_count > positive_cap) {
break;
}
SentimentValueCache sentimentCacheStr1 = sentimentCachingMap.getOrDefault(str1, null); SentimentValueCache sentimentCacheStr1 = sentimentCachingMap.getOrDefault(str1, null);
Callable<SimilarityMatrix> worker = new SentimentAnalyzerTest(strF, str1, new SimilarityMatrix(strF, str1), Callable<SimilarityMatrix> worker = new SentimentAnalyzerTest(strF, str1, new SimilarityMatrix(strF, str1),
strAnnoJMWE, jmweAnnotationCache.get(str1), strAnno, strAnnoJMWE, jmweAnnotationCache.get(str1), strAnno,
pipelineAnnotationCache.get(str1), strAnnoSentiment, pipelineAnnotationCache.get(str1), strAnnoSentiment,
pipelineSentimentAnnotationCache.get(str1), coreDoc, coreDocumentAnnotationCache.get(str1), null, sentimentCacheStr1); pipelineSentimentAnnotationCache.get(str1), coreDoc, coreDocumentAnnotationCache.get(str1), null, sentimentCacheStr1);
call_able_list.add(worker); try {
} SimilarityMatrix getSMX = worker.call();
} if (getSMX != null) {
for (Callable<SimilarityMatrix> callSMX : call_able_list) { Double scoreRelationLastUserMsg = getSMX.getDistance();
try { if (scoreRelationLastUserMsg > preRelationUserCounters) {
SimilarityMatrix getSMX = callSMX.call(); preRelationUserCounters = scoreRelationLastUserMsg;
if (getSMX != null) { concurrentRelations.add(getSMX.getSecondaryString());
Double scoreRelationLastUserMsg = getSMX.getDistance(); positive_sentence_count += 0.1;
if (scoreRelationLastUserMsg > preRelationUserCounters) { //System.out.println("secondary: " + getSMX.getSecondaryString() + "\nDistance: " + getSMX.getDistance() + "\n");
preRelationUserCounters = scoreRelationLastUserMsg; //System.out.println("SUCESS concurrentRelationsMap size: " + concurrentRelations.size() + "\n");
concurrentRelations.add(getSMX.getSecondaryString()); }
//System.out.println("secondary: " + getSMX.getSecondaryString() + "\nDistance: " + getSMX.getDistance() + "\n"); if (scoreRelationLastUserMsg > zero) {
//System.out.println("SUCESS concurrentRelationsMap size: " + concurrentRelations.size() + "\n"); 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(); 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); Collections.reverse(concurrentRelations);
if (concurrentRelations.isEmpty()) { if (concurrentRelations.isEmpty()) {
return "failure, preventing stuckness"; return "failure, preventing stuckness";