Skip to content

Commit 088d6a9

Browse files
author
Nils Reiter
committed
Merge branch 'release/2.0.1'
* release/2.0.1: 2.0.1 changelog update fixes #374 fixes #373
2 parents 36e3146 + bf9a071 commit 088d6a9

File tree

4 files changed

+48
-6
lines changed

4 files changed

+48
-6
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
Issue numbers (e.g., #43) refer to GitHub issues:
44
https://github.com/nilsreiter/CorefAnnotator/issues
55

6+
## 2.0.1
7+
8+
- Fixes an issue that prevented expanding the tree properly in some imported files #373
9+
- Fixes an issue in the QuaDramA/TEI importer #374
10+
611
## 2.0.0
712

813
- New: Discontinuous annotations. A single mention can now

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>de.unistuttgart.ims</groupId>
66
<artifactId>coref.annotator</artifactId>
7-
<version>2.0.0</version>
7+
<version>2.0.1</version>
88
<packaging>jar</packaging>
99
<name>CorefAnnotator</name>
1010
<url>https://github.com/nilsreiter/CorefAnnotator/</url>

src/main/java/de/unistuttgart/ims/coref/annotator/plugin/quadrama/tei/TeiReader.java

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.apache.uima.fit.descriptor.ConfigurationParameter;
99
import org.apache.uima.fit.util.JCasUtil;
1010
import org.apache.uima.jcas.JCas;
11+
import org.apache.uima.jcas.cas.FSArray;
1112
import org.dkpro.core.api.io.ResourceCollectionReaderBase;
1213
import org.dkpro.core.api.resources.CompressionUtils;
1314
import org.eclipse.collections.api.map.MutableMap;
@@ -21,6 +22,7 @@
2122
import de.unistuttgart.ims.coref.annotator.TypeSystemVersion;
2223
import de.unistuttgart.ims.coref.annotator.api.v2.Entity;
2324
import de.unistuttgart.ims.coref.annotator.api.v2.Mention;
25+
import de.unistuttgart.ims.coref.annotator.api.v2.MentionSurface;
2426
import de.unistuttgart.ims.coref.annotator.api.v2.Segment;
2527
import de.unistuttgart.ims.coref.annotator.api.v2.tei.TEIBody;
2628
import de.unistuttgart.ims.coref.annotator.api.v2.tei.TEIHeader;
@@ -60,23 +62,37 @@ public void getNext(CAS aCAS) {
6062
gxr.addGlobalRule("titleStmt > title:first-child", (d, e) -> d.setDocumentTitle(e.text()));
6163

6264
// characters declared in the header (GerDraCor)
63-
gxr.addGlobalRule("profileDesc [xml:id]", Mention.class, (m, e) -> {
65+
gxr.addGlobalRule("profileDesc [xml:id]", MentionSurface.class, (ms, e) -> {
6466
Entity cf = new Entity(jcas);
6567
cf.addToIndexes();
6668
cf.setLabel(e.attr("xml:id"));
6769
cf.setColor(colorProvider.getNextColor().getRGB());
6870
entityMap.put(e.attr("xml:id"), cf);
71+
Mention m = new Mention(jcas);
72+
m.addToIndexes();
73+
74+
m.setSurface(new FSArray<MentionSurface>(jcas, 1));
75+
m.setSurface(0, ms);
76+
m.getSurface().addToIndexes();
6977
m.setEntity(cf);
78+
ms.setMention(m);
7079
});
7180

7281
// other entities declared in the text (QuaDramA legacy)
73-
gxr.addGlobalRule("text [xml:id]", Mention.class, (m, e) -> {
82+
gxr.addGlobalRule("text [xml:id]", MentionSurface.class, (ms, e) -> {
7483
Entity cf = new Entity(jcas);
7584
cf.addToIndexes();
7685
cf.setLabel(e.attr("xml:id"));
7786
cf.setColor(colorProvider.getNextColor().getRGB());
7887
entityMap.put(e.attr("xml:id"), cf);
88+
Mention m = new Mention(jcas);
89+
m.addToIndexes();
90+
91+
m.setSurface(new FSArray<MentionSurface>(jcas, 1));
92+
m.setSurface(0, ms);
93+
m.getSurface().addToIndexes();
7994
m.setEntity(cf);
95+
ms.setMention(m);
8096
});
8197

8298
gxr.addRule("text speaker", Speaker.class);
@@ -85,7 +101,13 @@ public void getNext(CAS aCAS) {
85101
gxr.addRule("TEI > text > body", TEIBody.class);
86102

87103
// entity references
88-
gxr.addRule("text rs[ref]", Mention.class, (m, e) -> {
104+
gxr.addRule("text rs[ref]", MentionSurface.class, (ms, e) -> {
105+
Mention m = new Mention(jcas);
106+
m.addToIndexes();
107+
m.setSurface(new FSArray<MentionSurface>(jcas, 1));
108+
m.setSurface(0, ms);
109+
m.getSurface().addToIndexes();
110+
ms.setMention(m);
89111
String id = e.attr("ref").substring(1);
90112
Entity entity = entityMap.get(id);
91113
if (entity == null) {
@@ -100,8 +122,14 @@ public void getNext(CAS aCAS) {
100122
});
101123

102124
// entity references (QuaDramA legacy)
103-
gxr.addRule("text name[ref]", Mention.class, (m, e) -> {
125+
gxr.addRule("text name[ref]", MentionSurface.class, (ms, e) -> {
104126
String id = e.attr("ref").substring(1);
127+
Mention m = new Mention(jcas);
128+
m.setSurface(new FSArray<MentionSurface>(jcas, 1));
129+
m.setSurface(0, ms);
130+
m.getSurface().addToIndexes();
131+
m.addToIndexes();
132+
ms.setMention(m);
105133
Entity entity = entityMap.get(id);
106134
if (entity == null) {
107135
entity = new Entity(jcas);
@@ -115,8 +143,15 @@ public void getNext(CAS aCAS) {
115143
});
116144

117145
// identify speaker tags
118-
gxr.addRule("text speaker", Mention.class, (m, e) -> {
146+
gxr.addRule("text speaker", MentionSurface.class, (ms, e) -> {
119147
Element parent = e.parent();
148+
Mention m = new Mention(jcas);
149+
m.setSurface(new FSArray<MentionSurface>(jcas, 1));
150+
m.setSurface(0, ms);
151+
m.getSurface().addToIndexes();
152+
m.addToIndexes();
153+
ms.setMention(m);
154+
120155
if (parent.hasAttr("who")) {
121156
String id = parent.attr("who").substring(1);
122157
Entity entity = entityMap.get(id);

src/main/java/de/unistuttgart/ims/coref/annotator/uima/UimaUtil.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,8 @@ public static String toString(AnnotationTreeNode<Segment> tn, String sep, int ma
476476
return null;
477477
StringBuilder b = new StringBuilder();
478478
while (tn != null) {
479+
if (tn.get().getLabel() == null)
480+
break;
479481
if (tn.get().getLabel().equalsIgnoreCase("document"))
480482
break;
481483
String s = tn.get().getLabel();

0 commit comments

Comments
 (0)