uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roberto Franchini" <ro.franch...@gmail.com>
Subject POJOing uima, is it possible?
Date Thu, 24 Jan 2008 10:46:03 GMT
Hi to all,
I embedded a CPM in a Spring context (www.springframework.org) via a
wrapper class that parses AE xml (collectionreaders, annotators and
consumers) and push them in the CPM.
I did the same thing with aggregate AE to be used by a web app (here I
don't need collection readers nor consumers).

A snippet from the spring context:

	<bean name="listener" class="it.celi.uima.engine.Listener">
		<property name="cpm" ref="cpm" />
	</bean>

	<bean name="cpm" class="org.apache.uima.UIMAFramework"
factory-method="newCollectionProcessingManager">
		<description>The collection processing manager that holds uima
components</description>
	</bean>

	<bean name="uima" class="it.celi.uima.engine.CpmUIMAEngine">
		<description>An Engine that wraps UIMA components: collection
readers, analsys engines and consumers</description>
		<property name="pearsInstallPath" value="${pears.base.path}installed" />
		<property name="cpm" ref="cpm">
			<description>The uderlying Collection Processing Manager</description>
		</property>
		<property name="listeners">
			<description>A collection of listeners to be attached to CPM</description>
			<list>
				<ref bean="listener" />
			</list>
		</property>
		<property name="readerDescriptors">
			<description>A collection of CollectionReaders: the entire pipeline
is activated for each reader</description>
			<list>
				<value>${conf.base.path}RecursiveFileSystemCollectionReader.xml</value>
			</list>
		</property>
		<property name="analisysDescriptors">
			<description>The pipeline of analysis: analysis engines, aggregates
and pears descriptors allowed</description>
			<list>
				<value>${conf.base.path}SentenceAnnotator.xml</value>
				<value>${conf.base.path}RegExpTokenizer.xml</value>
			</list>
		</property>
		<property name="consumerDescriptors">
			<list>
				<value>${conf.base.path}XmiWriterCasConsumer.xml</value>
				<value>${conf.base.path}XCasWriterCasConsumer.xml</value>
			</list>
		</property>
	</bean>

Now I would go a step forward and avoid UIMA xml descritptor, please
don't blame me :)
What I'm looking for is something like this:

RegExpNormalizer annotator = new RegExpNormalizer();

annotar.setAProperty(value);
annotar.setAnotehrProperty(anotherValue);

CollectionProcessingManager cpm =
UIMAFramework.newCollectionProcessingManager();
cpm.add(annotator)

Where RegExpNormalizer  extends JCasAnnotator_ImplBase.

So in the spring context I can write:

	<bean name="normalizer" class="it.celi.uima.engine.RegExpNormalizer">
		<property name="aProperty" value="value"/>
		<property name="anotherProperty" value="anotherValue"/>
       </bean>

	<bean name="uima" class="it.celi.uima.engine.CpmUIMAEngine">
[cut]
		<property name="analisysDescriptors">
			<description>The pipeline of analysis: analysis engines, aggregates
and pears descriptors allowed</description>
			<list>
				<ref bean="normalizer"/>
			</list>
		</property>

Is it possible to do that?
Thanks
Roberto
-- 
Roberto Franchini
CELI s.r.l.  (http://www.celi.it) - C.so Moncalieri 21 - 10131 Torino - ITALY
Tel +39-011-6600814 - Fax +39-011-6600687
jabber:ro.franchini@gmail.com skype:ro.franchini

Mime
View raw message