diff options
Diffstat (limited to 'src/main/FarmShell.java')
-rw-r--r-- | src/main/FarmShell.java | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/src/main/FarmShell.java b/src/main/FarmShell.java index 766e652..525d342 100644 --- a/src/main/FarmShell.java +++ b/src/main/FarmShell.java @@ -147,31 +147,19 @@ public class FarmShell { getAnalyzor().newsSpread(params[0]); break; case getBrands: - String trimmed = params[0].trim(); - String bool = trimmed; - String query = null; - - int index = trimmed.indexOf(" "); - - if (index > -1) { - bool = trimmed.substring(0, index); - query = trimmed.substring(index + 1, trimmed.length()); - } + String query = params.length > 0 ? params[0].trim() : ""; + String[] args = query.split("\\s+", 2); + // by default, do not reset the database. boolean reset = false; - if (bool.equals("true")) { - reset = true; - } else if (bool.equals("false")) { - reset = false; - } else { - throw new IllegalArgumentException("getBrands: expected boolean, got " + params[0]); + if (args.length == 2) { + if (args[0].equals("RESET")) { + reset = true; + query = args[1].trim(); + } } - if (query != null) { - getAnalyzor().getBrands(query, reset); - } else { - getAnalyzor().getBrands("", reset); - } + getAnalyzor().getBrands(query, reset); break; case help: for (String line : HELP) { @@ -202,7 +190,7 @@ public class FarmShell { filterbots("marks all users as bot or not", 1), sentiment("analyzes all tweets on brand positivity (optional arg: tweet/brand selection query)"), wordcloud("makes a csv for a wordcloud of the text of the tweets", 1), - getBrands("fills the database with the brands of a tweet, arg: bool indicating whether to reset mentionsbrand (optional arg: tweet selection query", 1), + getBrands("fills the database with the brands of a tweet. optional args: RESET to truncate mentionsbrand; tweet selection query"), timezone("makes a map per brand for the users", 1), disco("makes a outputfile for disco", 1), posneg("makes a csv for a histogram for positive or negative tweets", 1), |