summaryrefslogtreecommitdiff
path: root/src/main/DataFiller.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/DataFiller.java')
-rw-r--r--src/main/DataFiller.java46
1 files changed, 14 insertions, 32 deletions
diff --git a/src/main/DataFiller.java b/src/main/DataFiller.java
index fa013aa..e6ac6f4 100644
--- a/src/main/DataFiller.java
+++ b/src/main/DataFiller.java
@@ -70,6 +70,13 @@ public class DataFiller {
processTweet(tweet.retweeted_status);
}
+ /**
+ * Replace all null bytes, non valid UTF-8 *
+ */
+ if (tweet.text.contains("\0")) {
+ tweet.text = tweet.text.replaceAll("\0", "");
+ }
+
try {
// assume that no previous transaction was started.
saveTweet(tweet);
@@ -83,6 +90,7 @@ public class DataFiller {
private void saveTweet(Tweet tweet) throws SQLException {
String text = sanitizeTweetText(tweet.text);
+
// ensure that the user and tweet are known before adding relations
QueryUtils.setInsertParams(m_insertTweet, m_insertProfile, tweet, text);
m_insertProfile.executeUpdate();
@@ -115,37 +123,11 @@ public class DataFiller {
// determine the user's perception of the brand
/*
- List<String> brands = getBrands(tweet);
- for (String brand : brands) {
- QueryUtils.setInsertBrandParams(m_insertBrand, tweet.id, brand);
- m_insertBrand.executeUpdate();
- }
- */
- }
-
- ArrayList<String> getBrands(Tweet tweet) {
- ArrayList<String> result = new ArrayList<>();
- String text = tweet.text.toLowerCase();
- if (text.contains("samsung") || text.contains("galaxy")) {
- result.add("Samsung");
- }
- if (text.contains("htc") || text.contains("one")) {
- result.add("HTC");
- }
- if (text.contains("apple") || text.contains("iphone")) {
- result.add("Apple");
- }
- if (text.contains("sony") || text.contains("xperia")) {
- result.add("Sony");
- }
- if (text.contains("huawei") || text.contains("ascend")) {
- result.add("Huawei");
- }
- if (text.contains("lg")) {
- result.add("LG");
- }
-
- // TODO: WTF IS THIS PILE OF SHIT?!
- return result;
+ List<String> brands = getBrands(tweet);
+ for (String brand : brands) {
+ QueryUtils.setInsertBrandParams(m_insertBrand, tweet.id, brand);
+ m_insertBrand.executeUpdate();
+ }
+ */
}
}