You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Ar...@bka.bund.de on 2011/12/22 08:29:39 UTC

Extracting a single view from a CAS

Hi,

how to extract a single view from a CAS with text sofas? It's nice to
have a CAS with multiple views. But how to visualize all the views? I
like to see them, to check if they are ok. Is there any analysis engine
for doing that?

I'm thinking of writing a CAS multiplier that puts each view in its own
CAS as _InitialView. What do you think about that?

Sincerely,

Armin

Re: AW: Extracting a single view from a CAS

Posted by Richard Eckart de Castilho <ec...@tk.informatik.tu-darmstadt.de>.
Hi Armin,

die XWriter uses the default UIMA XMI and XCAS serializers. These are meant to persist a complete CAS. I had a brief look at them and it seems that they are not meant to work on a single view (there are several calls to getBaseCas() in them). However, we could easily add an option to write only selected views in the uimaFIT CasDumpWriter.

Cheers,

-- Richard

Am 22.12.2011 um 13:40 schrieb Armin.Wegner@bka.bund.de:

> Hi Torsten,
> 
> I got the idea. The easiest way would be to use org.uimafit.component.xwriter.XWriter as a kind of visualizer. But that does not work. XWriter does always write the whole CAS instead of the mapped view. I tried
> 
> CollectionReaderDescription reader = CollectionReaderFactory...
> AggregateBuilder builder = new AggregateBuilder();
> AnalysisEngineDescription writer = AnalysisEngineFactory.createPrimitiveDescription(XWriter.class, XWriter.PARAM_OUTPUT_DIRECTORY_NAME, outputDirectoryName);
> builder.add(writer, CAS.NAME_DEFAULT_SOFA, "viewName");  // viewName is the name of the view that should be serialized
> SimplePipeline.runPipeline(reader, builder.createAggregateDescription());
> 
> Regards,
> 
> Armin

-- 
------------------------------------------------------------------- 
Richard Eckart de Castilho
Technical Lead
Ubiquitous Knowledge Processing Lab (UKP-TUD) 
FB 20 Computer Science Department      
Technische Universität Darmstadt 
Hochschulstr. 10, D-64289 Darmstadt, Germany 
phone [+49] (0)6151 16-7477, fax -5455, room S2/02/B117
eckartde@tk.informatik.tu-darmstadt.de 
www.ukp.tu-darmstadt.de 
Web Research at TU Darmstadt (WeRC) www.werc.tu-darmstadt.de
------------------------------------------------------------------- 






AW: Extracting a single view from a CAS

Posted by Ar...@bka.bund.de.
Hi Torsten,

I got the idea. The easiest way would be to use org.uimafit.component.xwriter.XWriter as a kind of visualizer. But that does not work. XWriter does always write the whole CAS instead of the mapped view. I tried

CollectionReaderDescription reader = CollectionReaderFactory...
AggregateBuilder builder = new AggregateBuilder();
AnalysisEngineDescription writer = AnalysisEngineFactory.createPrimitiveDescription(XWriter.class, XWriter.PARAM_OUTPUT_DIRECTORY_NAME, outputDirectoryName);
builder.add(writer, CAS.NAME_DEFAULT_SOFA, "viewName");  // viewName is the name of the view that should be serialized
SimplePipeline.runPipeline(reader, builder.createAggregateDescription());

Regards,

Armin


-----Ursprüngliche Nachricht-----
Von: Torsten Zesch [mailto:zesch@tk.informatik.tu-darmstadt.de] 
Gesendet: Donnerstag, 22. Dezember 2011 09:10
An: user@uima.apache.org
Betreff: RE: Extracting a single view from a CAS

Hi Armin,

it seems you are asking for two things:
1) How to visualize a CAS?
2) How to handle multiple views?

1) It strongly depends on what you want to visualize. If you just want to look at the annotations you might use the CAS Visualizer or CAS Editor. Or you can always write your own annotator that outputs the desired visualization.

2) As a view is just a "CAS in disguise" you may simply write a view-unaware annotator doing all the visualization on a single CAS and then use SofA mapping when assembling the pipeline.
An example using uimaFIT:

AnalysisEngineDescription visualizer = createPrimitiveDescription(
    Visualizer.class
);

AggregateBuilder builder = new AggregateBuilder(); builder.add(visualizer, "_InitialView", VIEW_1); builder.add(visualizer, "_InitialView", VIEW_2); ...
builder.add(visualizer, "_InitialView", VIEW_N); AnalysisEngineDescription aggr = builder.createAggregateDescription();

where VIEW_1 ... VIEW_N are the names of your views.

-Torsten

> -----Original Message-----
> From: Armin.Wegner@bka.bund.de [mailto:Armin.Wegner@bka.bund.de]
> Sent: Thursday, December 22, 2011 8:30 AM
> To: user@uima.apache.org
> Subject: Extracting a single view from a CAS
> 
> Hi,
> 
> how to extract a single view from a CAS with text sofas? It's nice to 
> have a CAS with multiple views. But how to visualize all the views? I 
> like to see them, to check if they are ok. Is there any analysis 
> engine for doing that?
> 
> I'm thinking of writing a CAS multiplier that puts each view in its 
> own CAS as _InitialView. What do you think about that?
> 
> Sincerely,
> 
> Armin


RE: Extracting a single view from a CAS

Posted by Torsten Zesch <ze...@tk.informatik.tu-darmstadt.de>.
Hi Armin,

it seems you are asking for two things:
1) How to visualize a CAS?
2) How to handle multiple views?

1) It strongly depends on what you want to visualize. If you just want to look at the annotations you might use the CAS Visualizer or CAS Editor. Or you can always write your own annotator that outputs the desired visualization.

2) As a view is just a "CAS in disguise" you may simply write a view-unaware annotator doing all the visualization on a single CAS and then use SofA mapping when assembling the pipeline.
An example using uimaFIT:

AnalysisEngineDescription visualizer = createPrimitiveDescription(
    Visualizer.class
);

AggregateBuilder builder = new AggregateBuilder();
builder.add(visualizer, "_InitialView", VIEW_1);
builder.add(visualizer, "_InitialView", VIEW_2);
...
builder.add(visualizer, "_InitialView", VIEW_N);
AnalysisEngineDescription aggr = builder.createAggregateDescription();

where VIEW_1 ... VIEW_N are the names of your views.

-Torsten

> -----Original Message-----
> From: Armin.Wegner@bka.bund.de [mailto:Armin.Wegner@bka.bund.de]
> Sent: Thursday, December 22, 2011 8:30 AM
> To: user@uima.apache.org
> Subject: Extracting a single view from a CAS
> 
> Hi,
> 
> how to extract a single view from a CAS with text sofas? It's nice to
> have a CAS with multiple views. But how to visualize all the views? I
> like to see them, to check if they are ok. Is there any analysis engine
> for doing that?
> 
> I'm thinking of writing a CAS multiplier that puts each view in its own
> CAS as _InitialView. What do you think about that?
> 
> Sincerely,
> 
> Armin