@@ -31,7 +31,7 @@ public class CoNLLUReaderITest {
3131 "Pero la existencia de dos recién nacidos en la misma caja sólo podía deberse a un descuido de fábrica." ,
3232 "De allí las rebajas."
3333 };
34- static final String EXPECTED_TEXT = String .join (System . lineSeparator () , EXPECTED_SENTENCE_TEXT ) + System . lineSeparator () ;
34+ static final String EXPECTED_TEXT = String .join (" " , EXPECTED_SENTENCE_TEXT ) + " " ;
3535
3636 static final String [][] EXPECTED_WORD_TEXT = {
3737 {"Pero" , "la" , "existencia" , "de" , "dos" , "recién" , "nacidos" , "en" , "la" , "misma" , "caja" , "sólo" , "podía" , "deber" , "se" , "a" , "un" , "descuido" , "de" , "fábrica" , "." },
@@ -194,8 +194,6 @@ public void testReadingInCoNLLUFile() throws ClassNotFoundException, IOException
194194 CoreLabel token = tokens .get (j );
195195 if (i == 0 && j == 1 ) {
196196 assertEquals (" " , token .after ());
197- } else if (j == tokens .size () - 1 ) {
198- assertEquals (System .lineSeparator (), token .after ());
199197 } else if (j == tokens .size () - 2 ) {
200198 assertEquals ("" , token .after ());
201199 } else if (i == 0 && j == 13 ) {
@@ -207,10 +205,7 @@ public void testReadingInCoNLLUFile() throws ClassNotFoundException, IOException
207205 if (i == 0 && j == 2 ) {
208206 assertEquals (" " , token .before ());
209207 } else if (i == 0 && j == 0 ) {
210- // TODO: is it properly reading the SpacesBefore on the first token?
211208 assertEquals ("" , token .before ());
212- } else if (j == 0 ) {
213- assertEquals (System .lineSeparator (), token .before ());
214209 } else if (j == tokens .size () - 1 ) {
215210 assertEquals ("" , token .before ());
216211 } else if (i == 0 && j == 14 ) {
@@ -265,7 +260,11 @@ public void testReadingInCoNLLUFile() throws ClassNotFoundException, IOException
265260 if (i == 0 && (j == 13 || j == 14 )) {
266261 expectedKeys += 1 ;
267262 }
268- assertEquals (expectedKeys , token .keySet ().size ());
263+ if (i == 0 && j == 0 ) {
264+ // The very first key won't have a Before unless the document specifically has one
265+ expectedKeys -= 1 ;
266+ }
267+ assertEquals ("Error at sentence " + i + " word " + j , expectedKeys , token .keySet ().size ());
269268
270269 // The known fields should be the ones checked above:
271270 // CoreAnnotations.TextAnnotation
0 commit comments