You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Steve Petruzza <st...@gmail.com> on 2010/01/26 18:45:24 UTC

How to process with aggregate descriptors

Hi,
I'm trying to use an example aggregate descriptor 
(RoomNumberAndDateTime) using this simple code:

        XMLInputSource input = new 
XMLInputSource("desc/analysis_engine/RoomNumberAndDateTime.xml");
        AnalysisEngineDescription desc = 
UIMAFramework.getXMLParser().parseAnalysisEngineDescription(input);
             
        AnalysisEngine seAnnotator = 
UIMAFramework.produceAnalysisEngine(desc);
              
        JCas cas = seAnnotator.newJCas();
        cas.setDocumentText("August 26, 2003 \n UIMA 101 - The New UIMA 
Introduction \n (Hands-on Tutorial) \n 9:00AM-5:00PM in HAW GN-K35\n 
August 28, 2003");

        seAnnotator.process(cas);
                       
        FSIndex indexAnnotations = cas.getAnnotationIndex();
        Iterator<Annotation> annoIt = indexAnnotations.iterator();

if I iterate on annoIt I find only annotations for RoomNumber but not 
for Date or Time (as the DocumentAnalyzer do), what I'm doing wrong?

Thanks

Steve

Re: How to process with aggregate descriptors

Posted by Steve Petruzza <st...@gmail.com>.
Thank you very much, it works!! it works! :|

On Wed, Jan 27, 2010 at 11:09 AM, Thilo Goetz <tw...@gmx.de> wrote:

> On 1/26/2010 18:45, Steve Petruzza wrote:
> > Hi,
> > I'm trying to use an example aggregate descriptor
> > (RoomNumberAndDateTime) using this simple code:
> >
> >        XMLInputSource input = new
> > XMLInputSource("desc/analysis_engine/RoomNumberAndDateTime.xml");
> >        AnalysisEngineDescription desc =
> > UIMAFramework.getXMLParser().parseAnalysisEngineDescription(input);
> >                    AnalysisEngine seAnnotator =
> > UIMAFramework.produceAnalysisEngine(desc);
> >                     JCas cas = seAnnotator.newJCas();
> >        cas.setDocumentText("August 26, 2003 \n UIMA 101 - The New UIMA
> > Introduction \n (Hands-on Tutorial) \n 9:00AM-5:00PM in HAW GN-K35\n
> > August 28, 2003");
> >
> >        seAnnotator.process(cas);
> >                              FSIndex indexAnnotations =
> > cas.getAnnotationIndex();
> >        Iterator<Annotation> annoIt = indexAnnotations.iterator();
> >
> > if I iterate on annoIt I find only annotations for RoomNumber but not
> > for Date or Time (as the DocumentAnalyzer do), what I'm doing wrong?
>
> Looks good, the only thing I can think of atm is maybe the date
> and time annotator needs the language?  Try adding
> cas.setDocumentLanguage("en") before you process.
>
> --Thilo
>
> >
> > Thanks
> >
> > Steve
>

Re: How to process with aggregate descriptors

Posted by Thilo Goetz <tw...@gmx.de>.
On 1/26/2010 18:45, Steve Petruzza wrote:
> Hi,
> I'm trying to use an example aggregate descriptor
> (RoomNumberAndDateTime) using this simple code:
> 
>        XMLInputSource input = new
> XMLInputSource("desc/analysis_engine/RoomNumberAndDateTime.xml");
>        AnalysisEngineDescription desc =
> UIMAFramework.getXMLParser().parseAnalysisEngineDescription(input);
>                    AnalysisEngine seAnnotator =
> UIMAFramework.produceAnalysisEngine(desc);
>                     JCas cas = seAnnotator.newJCas();
>        cas.setDocumentText("August 26, 2003 \n UIMA 101 - The New UIMA
> Introduction \n (Hands-on Tutorial) \n 9:00AM-5:00PM in HAW GN-K35\n
> August 28, 2003");
> 
>        seAnnotator.process(cas);
>                              FSIndex indexAnnotations =
> cas.getAnnotationIndex();
>        Iterator<Annotation> annoIt = indexAnnotations.iterator();
> 
> if I iterate on annoIt I find only annotations for RoomNumber but not
> for Date or Time (as the DocumentAnalyzer do), what I'm doing wrong?

Looks good, the only thing I can think of atm is maybe the date
and time annotator needs the language?  Try adding
cas.setDocumentLanguage("en") before you process.

--Thilo

> 
> Thanks
> 
> Steve