TEINamedEntityImpl.java
2.46 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
package ipipan.clarin.tei.impl.entities;
import ipipan.clarin.tei.api.entities.TEIMorph;
import ipipan.clarin.tei.api.entities.TEINamedEntity;
import ipipan.clarin.tei.api.entities.TEINamedEntityChild;
import ipipan.clarin.tei.api.entities.TEINamedEntityDerivation;
import java.util.LinkedList;
import java.util.List;
/**
*
* @author mlenart
*/
public class TEINamedEntityImpl extends TEIAbstractEntity implements
TEINamedEntity {
private final String orth;
private final String type;
private final String subtype;
private String base;
private String certainty;
private String comment;
private TEINamedEntityDerivation deriv;
private final List<TEINamedEntityChild> children;
public TEINamedEntityImpl(String id, String orth, String type,
String subtype, List<TEINamedEntityChild> children) {
super(id);
this.orth = orth;
this.type = type;
this.subtype = subtype;
this.children = children;
}
@Override
public String getType() {
return type;
}
@Override
public String getSubtype() {
return subtype;
}
@Override
public String getOrth() {
return orth;
}
@Override
public String getBase() {
return base;
}
@Override
public void setBase(String base) {
this.base = base;
}
@Override
public TEINamedEntityDerivation getDerivation() {
return deriv;
}
@Override
public void setDerivation(TEINamedEntityDerivation deriv) {
this.deriv = deriv;
}
@Override
public String getCertainty() {
return certainty;
}
@Override
public void setCertainty(String certainty) {
this.certainty = certainty;
}
@Override
public String getComment() {
return comment;
}
@Override
public void setComment(String comment) {
this.comment = comment;
}
@Override
public List<TEINamedEntityChild> getChildren() {
return children;
}
@Override
public boolean isNamedEntity() {
return true;
}
@Override
public boolean isMorph() {
return false;
}
@Override
public List<TEIMorph> getLeaves() {
List<TEIMorph> res = new LinkedList<TEIMorph>();
for (TEINamedEntityChild child : children) {
if (child.isMorph()) {
res.add((TEIMorph) child);
} else {
res.addAll(((TEINamedEntity) child).getLeaves());
}
}
return res;
}
@Override
public String toString() {
return "TEINamedEntityImpl{" + "id=" + getId() + '}';
}
@Override
public TEIMorph asMorph() {
throw new UnsupportedOperationException(
"Cannot treat named entity as morph");
}
@Override
public TEINamedEntity asNamedEntity() {
return this;
}
}