-
Notifications
You must be signed in to change notification settings - Fork 3
/
C8b.java
33 lines (24 loc) · 937 Bytes
/
C8b.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
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;
public class C8b 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 = computeC8b(text);
return (foundMatches.size() > 0? ("C8b: "
+ TextUtils.conjoin("#", foundMatches)):
"C8b: emptylist");
}
public static Set<String> computeC8b(String text) {
return TextUtils.SearchPattern(text,
Words.foreninger_lowercased);
}
}