Skip to content

Commit 6707a52

Browse files
committed
Add emptyIndex to the output format for CoreLabel and IndexedWord if they use one of the INDEX outputs. No effect for words which don't have those annotations, which will be most words outside of Semgrex usage
1 parent 038fde2 commit 6707a52

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/edu/stanford/nlp/ling/CoreLabel.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,10 @@ public String toString(OutputFormat format) {
759759
if (index != null) {
760760
buf.append('-').append((index).intValue());
761761
}
762+
Integer emptyIndex = this.get(CoreAnnotations.EmptyIndexAnnotation.class);
763+
if (emptyIndex != null && emptyIndex != 0) {
764+
buf.append('.').append((emptyIndex).intValue());
765+
}
762766
break;
763767
}
764768
case VALUE_TAG: {
@@ -779,6 +783,10 @@ public String toString(OutputFormat format) {
779783
if (index != null) {
780784
buf.append('-').append((index).intValue());
781785
}
786+
Integer emptyIndex = this.get(CoreAnnotations.EmptyIndexAnnotation.class);
787+
if (emptyIndex != null && emptyIndex != 0) {
788+
buf.append('.').append((emptyIndex).intValue());
789+
}
782790
break;
783791
}
784792
case VALUE_INDEX_MAP: {
@@ -787,6 +795,10 @@ public String toString(OutputFormat format) {
787795
if (index != null) {
788796
buf.append('-').append((index).intValue());
789797
}
798+
Integer emptyIndex = this.get(CoreAnnotations.EmptyIndexAnnotation.class);
799+
if (emptyIndex != null && emptyIndex != 0) {
800+
buf.append('.').append((emptyIndex).intValue());
801+
}
790802
Map<String,Object> map2 = new TreeMap<>();
791803
for (Class key : this.keySet()) {
792804
String cls = key.getName();
@@ -814,6 +826,10 @@ public String toString(OutputFormat format) {
814826
if (index != null) {
815827
buf.append('-').append((index).intValue());
816828
}
829+
Integer emptyIndex = this.get(CoreAnnotations.EmptyIndexAnnotation.class);
830+
if (emptyIndex != null && emptyIndex != 0) {
831+
buf.append('.').append((emptyIndex).intValue());
832+
}
817833
break;
818834
}
819835
case VALUE_TAG_NER:{
@@ -833,6 +849,10 @@ public String toString(OutputFormat format) {
833849
if (index != null) {
834850
buf.append('-').append((index).intValue());
835851
}
852+
Integer emptyIndex = this.get(CoreAnnotations.EmptyIndexAnnotation.class);
853+
if (emptyIndex != null && emptyIndex != 0) {
854+
buf.append('.').append((emptyIndex).intValue());
855+
}
836856
break;
837857
case ALL:{
838858
for (Class en: this.keySet()) {

0 commit comments

Comments
 (0)