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 2010/11/09 08:13:53 UTC
View vs. JCas as process() argument
Hi,
I would like to add some annotations of type TestTypeA to view ViewA
using analysis engine analysisEngine. The first version given below
works just fine. The new annotations are added to ViewA. The scond
version does not work. The annotations are added to _InitialView. Why?
Logically there is no difference. I would prefere the second version as
it is more generell. The analysis engine does not need to know the view.
Any ideas?
Armin
1 First Version: Argument is a whole JCas
1.1 Pipeline
JCas jCas = analysisEngine.newJCas();
jCas.createView("ViewA");
analysisEngine.process(jCas);
1.2 Annotator
public void process(JCas jCas) throws AnalysisEngineProcessException {
JCas view = jCas.getView("ViewA");
...
view.addFsToIndexes(new TestTypeA(view, begin, end));
...
}
2. Second Version: Argument is a view, only
2.1 Pipeline
JCas jCas = analysisEngine.newJCas();
jCas.createView("ViewA");
JCas view = jCas.getView("ViewA");
analysisEngine.process(view);
2.2 Annotator
public void process(JCas view) throws AnalysisEngineProcessException {
...
view.addFsToIndexes(new TestTypeA(view, begin, end));
...
}
Re: View vs. JCas as process() argument
Posted by Eddie Epstein <ea...@gmail.com>.
The view passed to an annotator process method is controlled by
the annotator being sofa aware and by sofa mapping.
See http://uima.apache.org/downloads/releaseDocs/2.3.0-incubating/docs/html/tutorials_and_users_guides/tutorials_and_users_guides.html#ugr.tug.mvs.deciding_multi_view
and the subsequent section on sofa mapping.
Eddie
On Tue, Nov 9, 2010 at 2:13 AM, <Ar...@bka.bund.de> wrote:
> Hi,
>
> I would like to add some annotations of type TestTypeA to view ViewA
> using analysis engine analysisEngine. The first version given below
> works just fine. The new annotations are added to ViewA. The scond
> version does not work. The annotations are added to _InitialView. Why?
> Logically there is no difference. I would prefere the second version as
> it is more generell. The analysis engine does not need to know the view.
>
> Any ideas?
>
> Armin
>
>
>
> 1 First Version: Argument is a whole JCas
>
> 1.1 Pipeline
>
> JCas jCas = analysisEngine.newJCas();
> jCas.createView("ViewA");
> analysisEngine.process(jCas);
>
> 1.2 Annotator
>
> public void process(JCas jCas) throws AnalysisEngineProcessException {
> JCas view = jCas.getView("ViewA");
> ...
> view.addFsToIndexes(new TestTypeA(view, begin, end));
> ...
> }
>
>
> 2. Second Version: Argument is a view, only
>
> 2.1 Pipeline
>
> JCas jCas = analysisEngine.newJCas();
> jCas.createView("ViewA");
> JCas view = jCas.getView("ViewA");
> analysisEngine.process(view);
>
> 2.2 Annotator
>
> public void process(JCas view) throws AnalysisEngineProcessException {
> ...
> view.addFsToIndexes(new TestTypeA(view, begin, end));
> ...
> }
>
AW: View vs. JCas as process() argument
Posted by Ar...@bka.bund.de.
Philip, thank you. That's really easy and the annotator is more generell and even shorter in code, now.
-----Ursprüngliche Nachricht-----
Von: user-return-3250-Armin.Wegner=bka.bund.de@uima.apache.org [mailto:user-return-3250-Armin.Wegner=bka.bund.de@uima.apache.org] Im Auftrag von Philip Ogren
Gesendet: Dienstag, 9. November 2010 15:47
An: user@uima.apache.org
Betreff: Re: View vs. JCas as process() argument
Armin,
This looks vaguely like something you might be tempted to try when using uimaFIT (as you recently mentioned you were using.) I believe that the "UIMA way" is to leave your analysis engine unaware of what view it should work on (assuming the analysis engine works on a single view) and then at run time use a sofa mapping to decide which view it actually works on. The easiest way to set this up in uimaFIT is to use the AggregateBuilder class which has an add method that looks something like
this:
builder.add(analysisEngineDescription, CAS.NAME_DEFAULT_SOFA, "ViewA");
Hope this helps.
Philip
On 11/9/2010 12:13 AM, Armin.Wegner@bka.bund.de wrote:
> Hi,
>
> I would like to add some annotations of type TestTypeA to view ViewA
> using analysis engine analysisEngine. The first version given below
> works just fine. The new annotations are added to ViewA. The scond
> version does not work. The annotations are added to _InitialView. Why?
> Logically there is no difference. I would prefere the second version
> as it is more generell. The analysis engine does not need to know the view.
>
> Any ideas?
>
> Armin
>
>
>
> 1 First Version: Argument is a whole JCas
>
> 1.1 Pipeline
>
> JCas jCas = analysisEngine.newJCas();
> jCas.createView("ViewA");
> analysisEngine.process(jCas);
>
> 1.2 Annotator
>
> public void process(JCas jCas) throws AnalysisEngineProcessException {
> JCas view = jCas.getView("ViewA");
> ...
> view.addFsToIndexes(new TestTypeA(view, begin, end));
> ...
> }
>
>
> 2. Second Version: Argument is a view, only
>
> 2.1 Pipeline
>
> JCas jCas = analysisEngine.newJCas();
> jCas.createView("ViewA");
> JCas view = jCas.getView("ViewA");
> analysisEngine.process(view);
>
> 2.2 Annotator
>
> public void process(JCas view) throws AnalysisEngineProcessException {
> ...
> view.addFsToIndexes(new TestTypeA(view, begin, end));
> ...
> }
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 10.0.1153 / Virus Database: 424/3245 - Release Date: 11/08/10
>
>
>
Re: View vs. JCas as process() argument
Posted by Philip Ogren <ph...@ogren.info>.
Armin,
This looks vaguely like something you might be tempted to try when using
uimaFIT (as you recently mentioned you were using.) I believe that the
"UIMA way" is to leave your analysis engine unaware of what view it
should work on (assuming the analysis engine works on a single view) and
then at run time use a sofa mapping to decide which view it actually
works on. The easiest way to set this up in uimaFIT is to use the
AggregateBuilder class which has an add method that looks something like
this:
builder.add(analysisEngineDescription, CAS.NAME_DEFAULT_SOFA, "ViewA");
Hope this helps.
Philip
On 11/9/2010 12:13 AM, Armin.Wegner@bka.bund.de wrote:
> Hi,
>
> I would like to add some annotations of type TestTypeA to view ViewA
> using analysis engine analysisEngine. The first version given below
> works just fine. The new annotations are added to ViewA. The scond
> version does not work. The annotations are added to _InitialView. Why?
> Logically there is no difference. I would prefere the second version as
> it is more generell. The analysis engine does not need to know the view.
>
> Any ideas?
>
> Armin
>
>
>
> 1 First Version: Argument is a whole JCas
>
> 1.1 Pipeline
>
> JCas jCas = analysisEngine.newJCas();
> jCas.createView("ViewA");
> analysisEngine.process(jCas);
>
> 1.2 Annotator
>
> public void process(JCas jCas) throws AnalysisEngineProcessException {
> JCas view = jCas.getView("ViewA");
> ...
> view.addFsToIndexes(new TestTypeA(view, begin, end));
> ...
> }
>
>
> 2. Second Version: Argument is a view, only
>
> 2.1 Pipeline
>
> JCas jCas = analysisEngine.newJCas();
> jCas.createView("ViewA");
> JCas view = jCas.getView("ViewA");
> analysisEngine.process(view);
>
> 2.2 Annotator
>
> public void process(JCas view) throws AnalysisEngineProcessException {
> ...
> view.addFsToIndexes(new TestTypeA(view, begin, end));
> ...
> }
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 10.0.1153 / Virus Database: 424/3245 - Release Date: 11/08/10
>
>
>