removed global variable entirely
This commit is contained in:
parent
583324e4ca
commit
30bf0d059f
@ -27,7 +27,7 @@ public class DataMapper {
|
||||
ArrayList<String> arrayListStr = new ArrayList();
|
||||
try {
|
||||
l_cCon = DBCPDataSource.getConnection();
|
||||
String l_sSQL = "SELECT * FROM `Sentences`";
|
||||
String l_sSQL = "SELECT * FROM `Sentences` order by LENGTH(Strings) desc";
|
||||
l_pStatement = l_cCon.prepareStatement(l_sSQL);
|
||||
l_rsSearch = l_pStatement.executeQuery();
|
||||
while (l_rsSearch.next()) {
|
||||
|
@ -39,7 +39,6 @@ public class Datahandler {
|
||||
private var pipelineSentimentAnnotationCache = HashMap<String, Annotation>()
|
||||
private var coreDocumentAnnotationCache: HashMap<String, CoreDocument>
|
||||
private var jmweAnnotationCache = HashMap<String, Annotation>()
|
||||
private var stringCache = ArrayList<String>()
|
||||
|
||||
//private val nerModel = "edu/stanford/nlp/models/ner/english.all.3class.caseless.distsim.crf.ser.gz"
|
||||
private val nerModel = "edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz"
|
||||
@ -154,14 +153,6 @@ public class Datahandler {
|
||||
return StanfordCoreNLP(propsSentiment)
|
||||
}
|
||||
|
||||
fun updateStringCache() {
|
||||
stringCache = ArrayList<String>();
|
||||
for (str: String in DataMapper.getAllStrings()) {
|
||||
stringCache.add(str)
|
||||
}
|
||||
stringCache.sortWith(Comparator.comparingInt(String::length).reversed());
|
||||
}
|
||||
|
||||
private fun trimString(str: String): String {
|
||||
var message = str.trim { it <= ' ' }
|
||||
if (message.startsWith("<@")) {
|
||||
@ -204,7 +195,7 @@ public class Datahandler {
|
||||
stanfordCoreNLP.annotate(annotation)
|
||||
val coreDocument = CoreDocument(annotation)
|
||||
|
||||
val values_copy: List<String> = ArrayList(stringCache)
|
||||
val values_copy: List<String> = ArrayList(DataMapper.getAllStrings())
|
||||
var preRelationUserCounters = -155000.0
|
||||
val concurrentRelations: MutableList<String> = arrayListOf()
|
||||
val SB = StringBuilder()
|
||||
@ -541,8 +532,6 @@ public class Datahandler {
|
||||
if (preRelationUserCounters > cacheRequirement && !values_copy.contains(strF) && filterContent(strF)) {
|
||||
DataMapper.InsertMYSQLStrings(strF)
|
||||
DataMapper.checkStringsToDelete();
|
||||
stringCache.add(strF)
|
||||
stringCache.sortWith(Comparator.comparingInt(String::length).reversed());
|
||||
}
|
||||
val randomLenghtPermit = strF.length * (Math.random() * Math.random() * Math.random() * (Math.random() * 10))
|
||||
Collections.reverse(concurrentRelations)
|
||||
|
@ -72,7 +72,6 @@ public class DoStuff {
|
||||
}
|
||||
if (mentionedBot || channelName.contains("general-autism")) {
|
||||
String ResponseStr;
|
||||
System.out.println("reached datahandler.getResponseMsg");
|
||||
ResponseStr = datahandler.getResponseMsg(content, username, stanfordCoreNLP, stanfordCoreNLPSentiment,
|
||||
false);
|
||||
if (!ResponseStr.isEmpty()) {
|
||||
|
@ -80,14 +80,11 @@ public class DiscordHandler {
|
||||
//variables until the tests pass
|
||||
public static void main(String[] args) throws IOException, SQLException {
|
||||
Datahandler datahandler = new Datahandler();
|
||||
datahandler.updateStringCache();
|
||||
System.out.println("post updateStringCache");
|
||||
|
||||
PipelineJMWESingleton.getINSTANCE();
|
||||
StanfordCoreNLP stanfordCoreNLP = datahandler.pipeLineSetUp();
|
||||
StanfordCoreNLP stanfordCoreNLPSentiment = datahandler.shiftReduceParserInitiate();
|
||||
System.out.println("FINISHED ALL ANNOTATIONS");
|
||||
datahandler.updateStringCache();
|
||||
System.out.println("updatedstring cache");
|
||||
String token = new settings().getDiscordToken();
|
||||
final DiscordClient client = DiscordClient.create(token);
|
||||
|
Loading…
Reference in New Issue
Block a user