-
Notifications
You must be signed in to change notification settings - Fork 3
/
C9c.java
37 lines (28 loc) · 1.01 KB
/
C9c.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package dk.kb.webdanica.core.criteria;
import java.io.IOException;
import java.util.Set;
import org.apache.pig.EvalFunc;
import org.apache.pig.data.Tuple;
import dk.kb.webdanica.core.utils.Constants;
import dk.kb.webdanica.core.utils.TextUtils;
/**
* Search for Danish companies in the url.
* C9c: Input is the lowercase URL.
*/
public class C9c extends EvalFunc<String>{
@Override
public String exec(Tuple input) throws IOException {
if (input == null || input.size() == 0 || input.get(0) == null) {
return Constants.getCriteriaName(this) + ": " + Constants.NODATA;
}
String text = (String) input.get(0);
Set<String> foundMatches = computeC9c(text);
return (foundMatches.size() > 0? ("C9c: "
+ TextUtils.conjoin("#", foundMatches)):
"C9c: emptylist");
}
public static Set<String> computeC9c(String urlLower) {
return TextUtils.SearchPattern(urlLower,
Words.virksomheder_lowercased);
}
}