diff options
author | Maurice Laveaux <m.laveaux@student.tue.nl> | 2014-05-19 11:45:50 +0200 |
---|---|---|
committer | Maurice Laveaux <m.laveaux@student.tue.nl> | 2014-05-19 11:45:50 +0200 |
commit | 8da7d10ea75044933cf72c46fb8e27d59aeda563 (patch) | |
tree | 89015c858b713a502878c998d2db3ff807f2f9f4 /src | |
parent | 9c69f42c2c2b3c4992a35958324f6b2a1c1d6058 (diff) | |
download | Goldfarmer-8da7d10ea75044933cf72c46fb8e27d59aeda563.tar.gz |
Added javadoc and visibility parameters.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/Analyzor.java | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/src/main/Analyzor.java b/src/main/Analyzor.java index 42d3c4e..678887f 100644 --- a/src/main/Analyzor.java +++ b/src/main/Analyzor.java @@ -13,7 +13,6 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashMap; -import java.util.Map.Entry; import java.util.Scanner; /** @@ -32,15 +31,29 @@ public class Analyzor { */ private final HashMap<String, Double> bimap = new HashMap(); + /** + * The results of a query, maybe return from query(). + */ private ResultSet data; + + /** + * The persistent connection to the database. + */ private final Connection connection; - Analyzor(Connection connection) { + /** + * @param connection An open connection to the database. + */ + public Analyzor(Connection connection) { this.connection = connection; } - //reads the lexicons - void readLexicon() throws FileNotFoundException { + /** + * Read the unigram and bigram lexica. + * + * @throws FileNotFoundException + */ + public void readLexicon() throws FileNotFoundException { if (!unimap.isEmpty()) { // data is already read. return; @@ -88,6 +101,7 @@ public class Analyzor { /** * Run a sentiment analysis and fill the database with the output. * + * @param query The sql text for the query. * @throws SQLException * @throws IOException */ @@ -140,8 +154,15 @@ public class Analyzor { } } - //makes a wordcloud of the tweets in the ResultSet data - void makeWordCloud(String query) throws SQLException, FileNotFoundException, UnsupportedEncodingException { + /** + * Make a wordcloud of the results of some query. + * + * @param query The sql text for a query. + * @throws SQLException + * @throws FileNotFoundException + * @throws UnsupportedEncodingException + */ + public void makeWordCloud(String query) throws SQLException, FileNotFoundException, UnsupportedEncodingException { query(query); //go to the start of the ResultSet data @@ -239,8 +260,8 @@ public class Analyzor { //also removes urls private String removePunct(String text) { text = text.replaceAll("https?://\\S*", ""); - text = text.replaceAll("[.,!?()-:;\"']", " "); - text = text.replaceAll("[^\\x00-\\x7F]", ""); + text = text.replaceAll("[.,!?();\"'-]", " "); + text = text.replaceAll("[^\\x00-\\x7F]", " "); return text; } } |