public static FrequencyTableEntry parse ( String definition ) { List < String > splitted = Splitter . on ( ' ' ) . trimResults ( ) . omitEmptyStrings ( ) . limit ( 2 ) . splitToList ( definition ) ; if ( splitted . size ( ) == 2 ) { FrequencyTableEntry entry = new FrequencyTableEntry ( ) ; if ( "meta" . equals ( splitted . get ( 0 ) ) ) { entry . setReferencedNode ( null ) ; entry . setType ( FrequencyTableEntryType . meta ) ; entry . setKey ( splitted . get ( 1 ) ) ; } else { entry . setReferencedNode ( splitted . get ( 0 ) ) ; if ( "tok" . equals ( splitted . get ( 1 ) ) ) { entry . setType ( FrequencyTableEntryType . span ) ; } else { entry . setType ( FrequencyTableEntryType . annotation ) ; entry . setKey ( splitted . get ( 1 ) ) ; } } return entry ; } return null ; }
A constructor that takes the raw definition as argument .