HI
how to write dynamic annotators?my idea behind this is i want
send a requset and i sholud able to convert that as anootattion and look for
that string in given input files.
plz if u know this plz deliver it to me.waiting for ur reply.
thank u vijay
On 9/6/07, Katrin Tomanek <[EMAIL PROTECTED]> wrote:
>
>
> Thanks Thilo, this is exactly what I was looking for ;-)
>
> Regards,
> Katrin
>
>
> Thilo Goetz wrote:
> > Katrin Tomanek wrote:
> >> Hi,
> >>
> >> is there a way to instantiate a type system object in UIMA by reading
> >> the type system descriptor xml file?
> >>
> >> So, what I try to circumvent is that I can only get my type system
> >> object from a CAS or an AE or so.
> >>
> >> Any hints?
> >>
> >> Thanks,
> >> Katrin
> >
> > Hi Katrin,
> >
> > there is no easy way to create a type system without a CAS, but
> > there's a fairly painless way to create a CAS from just a type
> > system descriptor. You can then just grab the type system from
> > that CAS. Here are a few lines of code that do that:
> >
> > package org.apache.uima.test;
> >
> > import java.io.IOException;
> >
> > import org.apache.uima.UIMAFramework;
> > import org.apache.uima.cas.TypeSystem;
> > import org.apache.uima.resource.ResourceInitializationException;
> > import org.apache.uima.resource.metadata.TypeSystemDescription;
> > import org.apache.uima.util.CasCreationUtils;
> > import org.apache.uima.util.InvalidXMLException;
> > import org.apache.uima.util.XMLInputSource;
> > import org.apache.uima.util.XMLParser;
> >
> > public class TypeSystemTest {
> >
> > private static TypeSystem createTypeSystemFromDescriptor(String
> tsDescriptorName)
> > throws InvalidXMLException, IOException,
> ResourceInitializationException {
> > // Get XML parser from framework
> > XMLParser xmlParser = UIMAFramework.getXMLParser();
> > // Parse type system descriptor
> > TypeSystemDescription tsDesc = xmlParser.parseTypeSystemDescription(new
> XMLInputSource(
> > tsDescriptorName));
> > // Use type system description to create CAS and get the type system
> object
> > return CasCreationUtils.createCas(tsDesc, null,
> null).getTypeSystem();
> > }
> >
> > public static void main(String[] args) {
> > try {
> > // Create type system
> > TypeSystem ts = createTypeSystemFromDescriptor(args[0]);
> > // Print type system to stdout for verification
> > System.out.println(ts.toString());
> > } catch (Exception e) {
> > e.printStackTrace();
> > }
> > }
> >
> > }
> >
> > HTH,
> > Thilo
>
>