uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Klügl <peter.klu...@averbis.com>
Subject Re: UIMA Ruta - Conditional execution of a block
Date Mon, 26 Feb 2018 09:21:50 GMT
Hi,


you can use the normal functionality of conditions in the head rule of a
block, which results in sort of "if". This could look like:


BLOCK(p) Participant{APL==true} {

or

BLOCK(p) Participant{APL} {

You still have the iterator, so maybe you would like to add another
(outer) block just for the "if".



It hard to say something about how the rules could be improved without a
typical use case where they are applied and the larger context.

I personally would use more annotations/types and less ANNOTATIONLIST
since Ruta debugging does not cover it and it is more readable. Using
additional types, you could write the second block probably in one rule.
Something like:

p1:Participant{APL, p1.isCustomer -> CREATE(ControlRuleDetection,
"anchors" = SelectedMark, "values" = SelectedMark)}
    <-{m1:Mark{ m1.code=="BAD", m1.value=="Y" -> TRANSFER(SelectedMark)};};

This is not  a solution for you, just as an example. It's also missing
the positions.


Best,


Peter


Am 26.02.2018 um 06:47 schrieb Josep María Formentí Serra:
> Hi all,
>
>   I have this script in Ruta:
>
> PACKAGE com.aia.tas.uima.types;
> DECLARE ControlRuleDetection;
> ANNOTATIONLIST anchors;
> ANNOTATIONLIST values;
> INTLIST positions;
> BOOLEAN APL;
> BOOLEAN BAD;
> BLOCK(h) Header{} {
> Document { -> APL = false };
> a1:Attribute{ a1.code=="general.codapl", a1.ct=="CDO" -> APL = true};
> }
> BLOCK(p) Participant{} {
> Document{ -> BAD=false, CLEAR(anchors), CLEAR(values), CLEAR(positions) };
> m1:Mark{ m1.code=="BAD", m1.value=="Y" -> BAD=true, ADD(anchors, m1),
> ADD(values, m1), ADD(positions, 1)};
> p1:Document{APL, p1.isCustomer, BAD -> CREATE(ControlRuleDetection,
> "anchors" = anchors, "values" = values, "positions" = positions)};
> }
>
>
>  where there are 2 BLOCKs, the 2th BLOCK should be only executed when
> APL==true (calculated in first BLOCK).
>
>  How could I do? another optimizations are welcome too.
>
> BR,
>   JM

-- 
Peter Klügl
R&D Text Mining/Machine Learning

Averbis GmbH
Tennenbacher Str. 11
79106 Freiburg
Germany

Fon: +49 761 708 394 0
Fax: +49 761 708 394 10
Email: peter.kluegl@averbis.com
Web: https://averbis.com

Headquarters: Freiburg im Breisgau
Register Court: Amtsgericht Freiburg im Breisgau, HRB 701080
Managing Directors: Dr. med. Philipp Daumke, Dr. Kornél Markó


Mime
View raw message