public GenericDictionaryEntry parse ( String entry ) { String [ ] fields = parseLine ( entry ) ; String surface = fields [ 0 ] ; short leftId = Short . parseShort ( fields [ 1 ] ) ; short rightId = Short . parseShort ( fields [ 2 ] ) ; short wordCost = Short . parseShort ( fields [ 3 ] ) ; List < String > pos = new ArrayList <> ( ) ; pos . addAll ( Arrays . asList ( fields ) . subList ( 4 , 10 ) ) ; List < String > features = new ArrayList <> ( ) ; features . addAll ( Arrays . asList ( fields ) . subList ( 10 , fields . length ) ) ; GenericDictionaryEntry dictionaryEntry = new GenericDictionaryEntry . Builder ( ) . surface ( surface ) . leftId ( leftId ) . rightId ( rightId ) . wordCost ( wordCost ) . pos ( pos ) . features ( features ) . build ( ) ; return dictionaryEntry ; }
which is okay for all the dictionaries supported so far ...