summaryrefslogtreecommitdiff
path: root/src/analysis/BrandChecker.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/BrandChecker.java')
-rw-r--r--src/analysis/BrandChecker.java32
1 files changed, 9 insertions, 23 deletions
diff --git a/src/analysis/BrandChecker.java b/src/analysis/BrandChecker.java
index 10e22b4..ee9c7b4 100644
--- a/src/analysis/BrandChecker.java
+++ b/src/analysis/BrandChecker.java
@@ -1,17 +1,3 @@
-/*
- * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004
- *
- * Copyright (C) 2004 Sam Hocevar
- *
- * Everyone is permitted to copy and distribute verbatim or modified copies
- * of this license document, and changing it is allowed as long as the name is
- * changed.
- *
- * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING,
- * DISTRIBUTION AND MODIFICATION
- *
- * 0. You just DO WHAT THE FUCK YOU WANT TO.
- */
package analysis;
import java.io.FileInputStream;
@@ -93,7 +79,7 @@ public class BrandChecker {
if (line.isEmpty()) {
return;
}
-
+
if (!line.contains("-")) {
System.err.println("illformatted rule: " + line + ", missing -");
} else {
@@ -110,13 +96,13 @@ public class BrandChecker {
// Read the <name> line.
String name = parts[0].trim();
-
+
// Read the positive words.
- String positive = parts[1].replaceAll(" ","");
+ String positive = parts[1].replaceAll(" ", "");
String[] sequence = positive.split(",");
-
+
if (parts.length == 3) {
- String negative = parts[2].replaceAll(" ", "");
+ String negative = parts[2].replaceAll(" ", "");
String[] blacklist = negative.split(",");
ruleset.add(new BrandRule(name, sequence, blacklist));
} else {
@@ -139,7 +125,7 @@ public class BrandChecker {
* The words that should be in the text.
*/
private final HashMap<String, Boolean> names;
-
+
/**
* A blacklist of words that are not interesting.
*/
@@ -164,7 +150,7 @@ public class BrandChecker {
} else {
this.blacklist = null;
}
-
+
for (String name : names) {
this.names.put(name, Boolean.FALSE);
}
@@ -177,7 +163,7 @@ public class BrandChecker {
*/
public boolean analyze(String[] words) {
reset();
-
+
int found = 0;
for (String word : words) {
@@ -201,7 +187,7 @@ public class BrandChecker {
public String getBrand() {
return brand;
}
-
+
private void reset() {
for (String name : this.names.keySet()) {
this.names.put(name, Boolean.FALSE);