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 2013/05/23 13:09:16 UTC

Ruta - Optional First Token Problem

Hi!

In Ruta 2.0.2-SNAPSHOT, rules with an optional first element do not work. The optional part seems to be mandatory. Using

DECLARE Test;
"a"? "b" "c"{->MARK(Test, 1, 3)};

on

a b c x b c

marks "a b c" (0, 5) but not "b c" (8, 11).

Cheers,
Armin


Re: Ruta - Optional First Token Problem

Posted by Peter Klügl <pk...@uni-wuerzburg.de>.
Hi,

On 23.05.2013 13:30, Peter Klügl wrote:
> Hi,
>
> On 23.05.2013 13:09, Armin.Wegner@bka.bund.de wrote:
>> Hi!
>>
>> In Ruta 2.0.2-SNAPSHOT, rules with an optional first element do not work. The optional part seems to be mandatory. Using
>>
>> DECLARE Test;
>> "a"? "b" "c"{->MARK(Test, 1, 3)};

I just wanted to mention that you can write this rule now also the
following way:

("a"? "b" "c"){-> Test};

which is somehow more appealing to some people ;-)

Peter

>> on
>>
>> a b c x b c
>>
>> marks "a b c" (0, 5) but not "b c" (8, 11).
> Yes, this is a bug. Thanks for reporting this and I will fix it ASAP.
>
> In previous versions of the system, the optional part of leading rule
> elements was completely ignored. I must have missed that situation in
> the test cases since I rarely use string expressions myself because the
> implementation is still inefficient (will change soon).
>
> Best,
>
> Peter
>
>> Cheers,
>> Armin


Re: Ruta - Optional First Token Problem

Posted by Peter Klügl <pk...@uni-wuerzburg.de>.
Hi,

the semantics of the match in the implementation is not as
straightforward as I thought. The fix will take some time.

I would advise that you use two rules for optional leading rule elements
for now:
"a" "b" "c"; // equal to "a"? "b" "c";
"b" "c"; // maybe with a -PARTOF()

Additionally, you could use dynamic anchoring in order to change the
matching direction. Here, the rules do not start with the first element,
but choose the optimal element by a simple heuristic.

Best,

Peter


On 23.05.2013 13:30, Peter Klügl wrote:
> Hi,
>
> On 23.05.2013 13:09, Armin.Wegner@bka.bund.de wrote:
>> Hi!
>>
>> In Ruta 2.0.2-SNAPSHOT, rules with an optional first element do not work. The optional part seems to be mandatory. Using
>>
>> DECLARE Test;
>> "a"? "b" "c"{->MARK(Test, 1, 3)};
>>
>> on
>>
>> a b c x b c
>>
>> marks "a b c" (0, 5) but not "b c" (8, 11).
> Yes, this is a bug. Thanks for reporting this and I will fix it ASAP.
>
> In previous versions of the system, the optional part of leading rule
> elements was completely ignored. I must have missed that situation in
> the test cases since I rarely use string expressions myself because the
> implementation is still inefficient (will change soon).
>
> Best,
>
> Peter
>
>> Cheers,
>> Armin


Re: Ruta - Optional First Token Problem

Posted by Peter Klügl <pk...@uni-wuerzburg.de>.
Hi,

On 23.05.2013 13:09, Armin.Wegner@bka.bund.de wrote:
> Hi!
>
> In Ruta 2.0.2-SNAPSHOT, rules with an optional first element do not work. The optional part seems to be mandatory. Using
>
> DECLARE Test;
> "a"? "b" "c"{->MARK(Test, 1, 3)};
>
> on
>
> a b c x b c
>
> marks "a b c" (0, 5) but not "b c" (8, 11).

Yes, this is a bug. Thanks for reporting this and I will fix it ASAP.

In previous versions of the system, the optional part of leading rule
elements was completely ignored. I must have missed that situation in
the test cases since I rarely use string expressions myself because the
implementation is still inefficient (will change soon).

Best,

Peter

> Cheers,
> Armin