Thank you, Diman. It works. 

-----Ursprüngliche Nachricht-----
Von: [email protected] 
[mailto:[email protected]] Im Auftrag 
von Diman Karagiozov
Gesendet: Montag, 27. September 2010 15:48
An: [email protected]
Betreff: Re: AW: Convert Text to UIMA CAS


  Hi Armin,

your process method may look like this:

@Override
     public void process( JCas cas ) throws AnalysisEngineProcessException {

         // read the CSV, add raw text in string buffer;
         StringBuffer sb = new StringBuffer();
         sb.append( ... );

         // add the raw text to the CAS
         cas.setDocumentText( sb.toString() );

         // add some annotations
         SpecialAnnotaion a = new SpecialAnnotation( cas );
         a.addToIndexes();
     }

You can read the input form the CSV file by passing the full path to the file 
as parameter to the primitive engine. This can be done in the initialize method:

     @Override
     public void initialize( UimaContext context ) throws 
ResourceInitializationException {
         csv = new File( context.getConfigParameterValue( "pathToCsvFile" ) );
     }

greetings
Diman

On 09/27/2010 04:33 PM, [email protected] wrote:
> Hello Diman,
>
> how to pass the unstructered text to the analysis engine? I can only set the 
> document text with .setDocumentText(). But it is the ouput which should go 
> there.
>
> Greetings
> Armin
>
> -----Ursprüngliche Nachricht-----
> Von: [email protected] 
> [mailto:[email protected]] Im 
> Auftrag von Diman Karagiozov
> Gesendet: Montag, 27. September 2010 15:26
> An: [email protected]
> Betreff: Re: Convert Text to UIMA CAS
>
>
>    Hi there,
>
> I suppose that you have to create an UIMA primitive engine and in its 
> "process" method to implement the two tasks you want:
> 1) convert structured data to text;
> 2) set it in the CAS;
> 3) add the "structural" information (from the CSV) as UIMA annotations 
> in the CAS;
>
> greetings
> Diman
>
> On 09/27/2010 04:21 PM, [email protected] wrote:
>> Hi,
>>
>> I would like to convert a structured text (csv) into its raw text and 
>> a CAS. I have to do it in one run. So the raw text and the CAS a 
>> generated at the same time. How to accomplish this with UIMA?
>>
>> Thanks
>>
>> Armin
>


Reply via email to