removed levenhstein callable implementation, simplified sentence fetching from DB, moved from unloze db to a small vps db, instead of iterating 1 in updatematrix is 25 now, updated sentiment analyzing, also reduced get time of results to 5 seconds, a bunch of trivial things also got changed
This commit is contained in:
@@ -20,9 +20,9 @@ public class DBCPDataSource {
|
||||
static {
|
||||
try {
|
||||
ds.setDriver(new com.mysql.cj.jdbc.Driver());
|
||||
ds.setUrl("jdbc:mysql://151.80.230.149:3306/ArtificialAutism?useLegacyDatetimeCode=false&serverTimezone=UTC");
|
||||
ds.setUsername("ArtificialAutism");
|
||||
ds.setPassword("b423b54bwbfb1340438fn");
|
||||
ds.setUrl("jdbc:mysql://104.248.40.216:3306/ArtificialAutism?useLegacyDatetimeCode=false&serverTimezone=UTC");
|
||||
ds.setUsername("root");
|
||||
ds.setPassword("fb345972349fnsDW234/¤)#2");
|
||||
ds.setMaxTotal(-1);
|
||||
ds.setMinIdle(5);
|
||||
ds.setMaxIdle(-1);
|
||||
|
||||
@@ -140,41 +140,35 @@ public class DataMapper {
|
||||
|
||||
public static LinkedHashMap<String, LinkedHashMap<String, Double>> getAllRelationScores() {
|
||||
int count = getSementicsDBRows();
|
||||
int counter2 = 0;
|
||||
int hardCapRetrieveCount = 500000;
|
||||
LinkedHashMap<String, LinkedHashMap<String, Double>> LHMSMX = new LinkedHashMap();
|
||||
while (count > counter2) {
|
||||
try (Connection l_cCon = DBCPDataSource.getConnection()) {
|
||||
l_cCon.setAutoCommit(false);
|
||||
String l_sSQL = "SELECT * FROM `WordMatrix` WHERE ID > " + counter2 + " AND ID < " + (counter2 + hardCapRetrieveCount);
|
||||
try (PreparedStatement l_pStatement = l_cCon.prepareStatement(l_sSQL, java.sql.ResultSet.TYPE_FORWARD_ONLY,
|
||||
java.sql.ResultSet.CONCUR_READ_ONLY)) {
|
||||
l_pStatement.setFetchSize(Integer.MIN_VALUE);
|
||||
try (ResultSet l_rsSearch = l_pStatement.executeQuery()) {
|
||||
int i = 0;
|
||||
LinkedHashMap<String, Double> LHMLocal = new LinkedHashMap();
|
||||
while (l_rsSearch.next() && i < hardCapRetrieveCount) {
|
||||
String str1 = l_rsSearch.getString(1);
|
||||
String str2 = l_rsSearch.getString(2);
|
||||
Double score = l_rsSearch.getDouble(3);
|
||||
try (Connection l_cCon = DBCPDataSource.getConnection()) {
|
||||
l_cCon.setAutoCommit(false);
|
||||
String l_sSQL = "SELECT * FROM `WordMatrix`";
|
||||
try (PreparedStatement l_pStatement = l_cCon.prepareStatement(l_sSQL, java.sql.ResultSet.TYPE_FORWARD_ONLY,
|
||||
java.sql.ResultSet.CONCUR_READ_ONLY)) {
|
||||
l_pStatement.setFetchSize(Integer.MIN_VALUE);
|
||||
try (ResultSet l_rsSearch = l_pStatement.executeQuery()) {
|
||||
int i = 0;
|
||||
LinkedHashMap<String, Double> LHMLocal = new LinkedHashMap();
|
||||
while (l_rsSearch.next()) {
|
||||
String str1 = l_rsSearch.getString(1);
|
||||
String str2 = l_rsSearch.getString(2);
|
||||
Double score = l_rsSearch.getDouble(3);
|
||||
LHMLocal.put(str2, score);
|
||||
while (l_rsSearch.next() && str1.equals(l_rsSearch.getString(1))) {
|
||||
str2 = l_rsSearch.getString(2);
|
||||
score = l_rsSearch.getDouble(3);
|
||||
LHMLocal.put(str2, score);
|
||||
while (l_rsSearch.next() && i < hardCapRetrieveCount && str1.equals(l_rsSearch.getString(1))) {
|
||||
str2 = l_rsSearch.getString(2);
|
||||
score = l_rsSearch.getDouble(3);
|
||||
LHMLocal.put(str2, score);
|
||||
i++;
|
||||
counter2++;
|
||||
}
|
||||
LHMSMX.put(str1, LHMLocal);
|
||||
System.out.println("i: " + i + "\n" + "free memory: " + Runtime.getRuntime().freeMemory() + "\ncounter2: " + counter2 + "\n");
|
||||
i++;
|
||||
counter2++;
|
||||
}
|
||||
LHMSMX.put(str1, LHMLocal);
|
||||
System.out.println("i: " + i + "\n" + "free memory: " + Runtime.getRuntime().freeMemory() + "\n");
|
||||
i++;
|
||||
}
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
Logger.getLogger(DataMapper.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
Logger.getLogger(DataMapper.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
return LHMSMX;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user