Print no offsets for empty sentences
Change-Id: Ia392ac704da90aea88912436c39e82eaebe09de1
diff --git a/app/src/main/kotlin/de/ids_mannheim/korapxmltools/KorapXml2Conllu.kt b/app/src/main/kotlin/de/ids_mannheim/korapxmltools/KorapXml2Conllu.kt
index a76694c..f10600d 100644
--- a/app/src/main/kotlin/de/ids_mannheim/korapxmltools/KorapXml2Conllu.kt
+++ b/app/src/main/kotlin/de/ids_mannheim/korapxmltools/KorapXml2Conllu.kt
@@ -415,12 +415,10 @@
token_index: Int,
tokens: ConcurrentHashMap<String, Array<Span>>
): String {
- val sentenceEndOffset: Int
- sentenceEndOffset = if (sentences[docId] == null) {
- -1
- } else {
- sentences[docId]!![sentence_index].to
+ if (sentences[docId] == null || sentences[docId]!!.size <= sentence_index) {
+ return ""
}
+ val sentenceEndOffset = sentences[docId]!![sentence_index].to
var i = token_index
val start_offsets_string = StringBuilder()
val end_offsets_string = StringBuilder()