Use setMultiValued()<http://uima.apache.org/downloads/releaseDocs/2.3.0-incubating/docs/api/org/apache/uima/resource/metadata/ConfigurationParameter.html#setMultiValued%28boolean%29>. So, p1.setMultiValued() should make this config param accept multiple String values.
Himanshu On Tue, May 21, 2013 at 1:10 AM, Renaud Richardet <[email protected]>wrote: > Hi Harshal, > Have you tried UimaFit? I think it would be a better option, if you do not > want to use XML descriptors. > Hope that helps, Renaud > > > On Tue, May 21, 2013 at 8:49 AM, harshal patni <[email protected] > >wrote: > > > Hello Everyone, > > I am currently writing ConceptMapper in code (not > using > > XML files). Basically I am definitely AnalysisEngineDescriptions and > > TypeSystem Description in java code. I create the following 2 parameters > > using "ConfigurationParameter" class. > > > > 1. AttributeList > > 2. FeatureList > > > > The problem is both these should be arrays. But ConfigurationParameter > only > > provide the following types (String, Boolean, Integer, Float). When I > pass > > these values as string it fails and throws a java.lang.ClassCastException > > error. COz it expects an array vs a String. How should I solve this > issue? > > Below is the AnalysisEngineDescription code. > > > > > ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// > > > > primitiveDesc = new AnalysisEngineDescription_impl(); > > > > primitiveDesc.setPrimitive(true); > > > > primitiveDesc.getMetaData().setName("Concept Mapper Offset Tokenizer"); > > > > primitiveDesc.setAnnotatorImplementationName( > > "org.apache.uima.conceptMapper.ConceptMapper"); > > > > > > > > ConfigurationParameter p1 = new ConfigurationParameter_impl(); > > > > p1.setName("AttributeList"); > > > > p1.setDescription("Attribute List"); > > > > p1.setType(ConfigurationParameter.TYPE_STRING); // Here is the problem > > > > ConfigurationParameter p2 = new ConfigurationParameter_impl(); > > > > p2.setName("FeatureList"); > > > > p2.setDescription("Feature List"); > > > > p2.setType(ConfigurationParameter.TYPE_STRING); > > > > > > > > > primitiveDesc.getMetaData().getConfigurationParameterDeclarations().setConfigurationParameters( > > new ConfigurationParameter[] { p1,p2 }); > > > > > > > > > primitiveDesc.getMetaData().getConfigurationParameterSettings().setParameterSettings( > > new NameValuePair[] { new NameValuePair_impl("AttributeList", > "canonical"), > > new NameValuePair_impl("FeatureList", "DictCanon") }); > > > > TypeSystemDescription typeSystem = new > TypeSystemDescription_impl(); > > > > dicTerm(typeSystem); > > > > conceptMapperTokenizer(typeSystem); > > > > baseTokenizer(typeSystem); > > > > primitiveDesc.getAnalysisEngineMetaData().setTypeSystem(typeSystem); > > > > > > > ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// > > > > Also how should I pass the dictionary file in code? > > > > > > Thanks, > > > > Harshal > > > > > > -- > Renaud Richardet > Blue Brain Project PhD candidate > EPFL Station 15 > CH-1015 Lausanne > phone: +41-78-675-9501 > http://people.epfl.ch/renaud.richardet >
