Fix space at w2v output line end
Change-Id: Ie48dc163bec35a3278fac4075e1d5af2131bc40c
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 817ef5b..56f9e7e 100644
--- a/app/src/main/kotlin/de/ids_mannheim/korapxmltools/KorapXml2Conllu.kt
+++ b/app/src/main/kotlin/de/ids_mannheim/korapxmltools/KorapXml2Conllu.kt
@@ -291,13 +291,23 @@
tokens[docId]?.forEach { span ->
token_index++
if (span.from >= sentences[docId]!![sentence_index].to) {
- output.append("\n")
+ if(output.length > 0) {
+ output.setCharAt(output.length - 1, '\n')
+ } else {
+ output.append("\n")
+ }
sentence_index++
}
output.append(texts[docId]!!.substring(span.from, span.to), " ")
real_token_index++
}
+ if(output.length > 0) {
+ output.deleteCharAt(output.length - 1)
+ }
} else {
+ if (COMPATIBILITY_MODE) {
+ fname[docId] += " "
+ }
output =
StringBuilder("# foundry = $foundry\n# filename = ${fname[docId]}\n# text_id = $docId\n").append(
tokenOffsetsInSentence(