0
|
1 package de.mpiwg.anteater.results.impl;
|
|
2
|
|
3 import java.util.ArrayList;
|
|
4 import java.util.List;
|
|
5
|
|
6 import de.mpiwg.anteater.AnteaterConfiguration;
|
|
7 import de.mpiwg.anteater.results.AResultManager;
|
|
8 import de.mpiwg.anteater.results.AnnotationTag;
|
|
9 import de.mpiwg.anteater.results.ApplicantResult;
|
|
10 import de.mpiwg.anteater.text.TextType;
|
|
11
|
|
12 public class ApplicantResultManager extends AResultManager<ApplicantResult> {
|
|
13
|
|
14 public final static String APPLICANT_TAG = "<applicant>";
|
|
15 public final static String APPLICANT_TAG_CLOSE = "</applicant>";
|
|
16 public final static String TAG_TYPE = "applicant";
|
|
17
|
|
18
|
|
19 public ApplicantResultManager(AnteaterConfiguration configuration) {
|
|
20 super(configuration);
|
|
21 }
|
|
22
|
|
23 @Override
|
|
24 protected List<AnnotationTag> getSpecificSummaryTags(
|
|
25 List<ApplicantResult> applicants, int textIndex) {
|
|
26 List<AnnotationTag> tags = new ArrayList<AnnotationTag>();
|
|
27
|
|
28 // get applicants for text
|
|
29 List<ApplicantResult> appsOfSum = new ArrayList<ApplicantResult>();
|
|
30 for (ApplicantResult r : applicants) {
|
|
31 if (r.getResult().getType() == TextType.TYPE_SUMMARY
|
|
32 && r.getResult().getTextIdx() == textIndex)
|
|
33 appsOfSum.add(r);
|
|
34 }
|
|
35
|
|
36
|
|
37 for (ApplicantResult app : appsOfSum) {
|
|
38 tags.add(new AnnotationTag(APPLICANT_TAG, app.getFinding().getStart(), APPLICANT_TAG_CLOSE, app.getFinding().getStart()
|
|
39 + app.getFinding().getLength(), TAG_TYPE));
|
|
40 }
|
|
41
|
|
42 return tags;
|
|
43 }
|
|
44
|
|
45 @Override
|
|
46 protected List<AnnotationTag> getSpecificSuppleInfTags(List<ApplicantResult> applicants, int textIndex) {
|
|
47
|
|
48 // get applicants for text
|
|
49 List<ApplicantResult> appsOfSInf = new ArrayList<ApplicantResult>();
|
|
50 for (ApplicantResult r : applicants) {
|
|
51 if (r.getResult().getType() == TextType.TYPE_SUPLINF
|
|
52 && r.getResult().getTextIdx() == textIndex)
|
|
53 appsOfSInf.add(r);
|
|
54 }
|
|
55
|
|
56 List<AnnotationTag> tags = new ArrayList<AnnotationTag>();
|
|
57 for (ApplicantResult app : appsOfSInf) {
|
|
58 tags.add(new AnnotationTag(APPLICANT_TAG, app.getFinding().getStart(), APPLICANT_TAG_CLOSE, app.getFinding().getStart()
|
|
59 + app.getFinding().getLength(), TAG_TYPE));
|
|
60 }
|
|
61
|
|
62
|
|
63 return tags;
|
|
64 }
|
|
65
|
|
66 }
|