@@ -52,6 +52,10 @@ public class CoNLLUReaderITest {
52
52
{"sps00" , "rg" , "da0fp0" , "ncfp000" , "fp" },
53
53
};
54
54
55
+ static final String [][] EXPECTED_MISC = {
56
+ {null , null , "ArgTem=arg1:tem" , null , null , "ArgTem=argM:tmp" , "ArgTem=arg1:tem" , null , null , null , "ArgTem=argM:loc" , "ArgTem=argM:adv" , null , null , null , null , null , "ArgTem=arg2:atr" , null , "ArgTem=arg0:agt" , null },
57
+ {null , null , null , null , null },
58
+ };
55
59
56
60
static final String [][] EXPECTED_FEATS = {
57
61
{
@@ -232,11 +236,12 @@ public void testReadingInCoNLLUFile() throws ClassNotFoundException, IOException
232
236
}
233
237
}
234
238
235
- // check the features and that there are no fields currently unaccounted for
239
+ // check the features, the misc columns, and that there are no fields currently unaccounted for
236
240
for (int i = 0 ; i < sentences .size (); ++i ) {
237
241
CoreMap sentence = sentences .get (i );
238
242
List <CoreLabel > tokens = sentence .get (CoreAnnotations .TokensAnnotation .class );
239
243
assertEquals (EXPECTED_FEATS [i ].length , tokens .size ());
244
+ assertEquals (EXPECTED_MISC [i ].length , tokens .size ());
240
245
for (int j = 0 ; j < tokens .size (); ++j ) {
241
246
CoreLabel token = tokens .get (j );
242
247
@@ -251,6 +256,15 @@ public void testReadingInCoNLLUFile() throws ClassNotFoundException, IOException
251
256
assertEquals (expected , feats );
252
257
}
253
258
259
+ String expectedMisc = EXPECTED_MISC [i ][j ];
260
+ if (expectedMisc == null ) {
261
+ assertFalse (token .containsKey (CoreAnnotations .CoNLLUMisc .class ));
262
+ } else {
263
+ expectedKeys += 1 ;
264
+ String misc = token .get (CoreAnnotations .CoNLLUMisc .class ).toString ();
265
+ assertEquals (expectedMisc , misc );
266
+ }
267
+
254
268
// Some of the AnCora sentences don't have XPOS
255
269
if (token .containsKey (CoreAnnotations .PartOfSpeechAnnotation .class )) {
256
270
expectedKeys += 1 ;
0 commit comments