public static Feature generateFeatureByName ( final String featureType , final int weight , final List < String > resourceNames ) throws IllegalArgumentException , IOException { switch ( featureType ) { case "RuledWordFeature" : return new RuledWordFeature ( resourceNames , weight ) ; case "PrepositionContextFeature" : return new PrepositionContextFeature ( resourceNames , weight ) ; case "ExistingPhraseFeature" : return new ExistingPhraseFeature ( resourceNames , weight ) ; case "ExistingCleanPhraseFeature" : return new ExistingCleanPhraseFeature ( resourceNames , weight ) ; case "CaseSensitiveWordLookup" : return new CaseSensitiveWordLookup ( resourceNames , weight ) ; case "CaseInsensitiveWordLookup" : return new CaseInsensitiveWordLookup ( resourceNames , weight ) ; default : throw new IllegalArgumentException ( "Unknown feature: '" + featureType + "'" ) ; } }
Factory method create features by name .