44import edu .stanford .nlp .ling .*;
55import edu .stanford .nlp .semgraph .*;
66import edu .stanford .nlp .trees .*;
7+ import edu .stanford .nlp .trees .ud .CoNLLUFeatures ;
78import edu .stanford .nlp .util .*;
89
910import java .io .*;
@@ -29,6 +30,7 @@ public class CoNLLUReader {
2930 public static final int CoNLLU_LemmaField = 2 ;
3031 public static final int CoNLLU_UPOSField = 3 ;
3132 public static final int CoNLLU_XPOSField = 4 ;
33+ public static final int CoNLLU_FeaturesField = 5 ;
3234 public static final int CoNLLU_GovField = 6 ;
3335 public static final int CoNLLU_RelnField = 7 ;
3436 public static final int CoNLLU_MiscField = 9 ;
@@ -304,10 +306,21 @@ public CoreMap convertCoNLLUSentenceToCoreMap(CoNLLUDocument doc, CoNLLUSentence
304306 cl .setValue (fields .get (CoNLLU_WordField ));
305307 cl .setOriginalText (fields .get (CoNLLU_WordField ));
306308 cl .setIsNewline (false );
309+
307310 if (!fields .get (CoNLLU_LemmaField ).equals ("_" ))
308311 cl .setLemma (fields .get (CoNLLU_LemmaField ));
312+
309313 if (!fields .get (CoNLLU_UPOSField ).equals ("_" ))
310314 cl .setTag (fields .get (CoNLLU_UPOSField ));
315+
316+ //final String xpos = fields.get(CoNLLU_XPOSField);
317+ //if (!xpos.equals("_"))
318+ // cl.setTag(xpos);
319+
320+ if (!fields .get (CoNLLU_FeaturesField ).equals ("_" )) {
321+ CoNLLUFeatures features = new CoNLLUFeatures (fields .get (CoNLLU_FeaturesField ));
322+ cl .set (CoreAnnotations .CoNLLUFeats .class , features );
323+ }
311324 for (int extraColumnIdx = 10 ; extraColumnIdx < columnCount && extraColumnIdx < fields .size ();
312325 extraColumnIdx ++) {
313326 cl .set (extraColumns .get (extraColumnIdx ), fields .get (extraColumnIdx ));
0 commit comments