You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Wolf-Dietrich Materna <wo...@empolis.com> on 2015/11/17 09:05:58 UTC

How to use string functions from ruta-core-ext in Ruta

Hi,

I'd like to use the Ruta string functions referenced in the user guide here: https://uima.apache.org/d/ruta-2.3.0/tools.ruta.book.html#ugr.tools.ruta.language.extensions.core-ext.stringfunctions

The problem is, they don't work out of the box in the Ruta Workbench 2.3.1 with Eclipse 4.4.2. I've set up a new Ruta project with a script containing the (slightly modified) code from the substring example:

DECLARE Test; // I've added this line to make the example work.
STRING s;
STRINGLIST sl;
CW{-> MATCHEDTEXT(s), ADD(sl, substring(s,0,8))};
CW{INLIST(sl) -> Test}; // Changed SW to CW to make the rule work.

The input file only contains two words, "Alexanderplatz" and "Alexander". What I expected was that the first rule finds "Alexanderplatz" and stores the  first nine letters of it in the string list sl so that the last line can annotate "Alexander" with "Test". In reality, however, nothing happens. I get no error message, but after execution, there is no "Test" annotation.

Is there some additional configuration needed to access these string functions?

Any help would be appreciated.

Best Regards,
            Wolf-Dietrich Materna


Re: How to use string functions from ruta-core-ext in Ruta

Posted by Peter Klügl <pe...@averbis.com>.
Hi,

I must admit that I did not realize that this is an example from the
documentation. This is either a good sign that there are many examples
or a bad one that I do not even know what is documented... I am afraid
that this is not the last error in the documentation, but we work on
improving it steadily.

Thanks for poiting it out! I fixed it :-)

Best,

Peter

Am 18.11.2015 um 08:51 schrieb Wolf-Dietrich Materna:
> Hi Peter,
> thank you very much for your quick reply. Indeed, the example does work with the fixed offset.
> Although it's a minor issue, you might consider fixing the example in the Ruta documentation.
>
> It was confusing, that even the simple example from the documentation didn't work, 
> while examine a problem in our application using the string function from the ruta extension jar.
> Thank you again.
>
> Best regard,
> 	Wolf-Dietrich Materna
>
> -----Ursprüngliche Nachricht-----
> Von: Peter Klügl [mailto:peter.kluegl@averbis.com] 
> Gesendet: Dienstag, 17. November 2015 09:24
> An: user@uima.apache.org
> Betreff: Re: How to use string functions from ruta-core-ext in Ruta
>
> Hi,
>
> it should work just fine (tested with current trunk).
>
> The substring function like the other string functions just delegate to the java methods. Thus,  the substring from 0 to 8 returns "Alexande".
> The example should work with : CW{-> MATCHEDTEXT(s), ADD(sl, substring(s,0,9))};
>
> Best,
>
> Peter
>
> Am 17.11.2015 um 09:05 schrieb Wolf-Dietrich Materna:
>> Hi,
>>
>> I'd like to use the Ruta string functions referenced in the user guide 
>> here: 
>> https://uima.apache.org/d/ruta-2.3.0/tools.ruta.book.html#ugr.tools.ru
>> ta.language.extensions.core-ext.stringfunctions
>>
>> The problem is, they don't work out of the box in the Ruta Workbench 2.3.1 with Eclipse 4.4.2. I've set up a new Ruta project with a script containing the (slightly modified) code from the substring example:
>>
>> DECLARE Test; // I've added this line to make the example work.
>> STRING s;
>> STRINGLIST sl;
>> CW{-> MATCHEDTEXT(s), ADD(sl, substring(s,0,8))};
>> CW{INLIST(sl) -> Test}; // Changed SW to CW to make the rule work.
>>
>> The input file only contains two words, "Alexanderplatz" and "Alexander". What I expected was that the first rule finds "Alexanderplatz" and stores the  first nine letters of it in the string list sl so that the last line can annotate "Alexander" with "Test". In reality, however, nothing happens. I get no error message, but after execution, there is no "Test" annotation.
>>
>> Is there some additional configuration needed to access these string functions?
>>
>> Any help would be appreciated.
>>
>> Best Regards,
>>             Wolf-Dietrich Materna
>>
>>


AW: How to use string functions from ruta-core-ext in Ruta

Posted by Wolf-Dietrich Materna <wo...@empolis.com>.
Hi Peter,
thank you very much for your quick reply. Indeed, the example does work with the fixed offset.
Although it's a minor issue, you might consider fixing the example in the Ruta documentation.

It was confusing, that even the simple example from the documentation didn't work, 
while examine a problem in our application using the string function from the ruta extension jar.
Thank you again.

Best regard,
	Wolf-Dietrich Materna

-----Ursprüngliche Nachricht-----
Von: Peter Klügl [mailto:peter.kluegl@averbis.com] 
Gesendet: Dienstag, 17. November 2015 09:24
An: user@uima.apache.org
Betreff: Re: How to use string functions from ruta-core-ext in Ruta

Hi,

it should work just fine (tested with current trunk).

The substring function like the other string functions just delegate to the java methods. Thus,  the substring from 0 to 8 returns "Alexande".
The example should work with : CW{-> MATCHEDTEXT(s), ADD(sl, substring(s,0,9))};

Best,

Peter

Am 17.11.2015 um 09:05 schrieb Wolf-Dietrich Materna:
> Hi,
>
> I'd like to use the Ruta string functions referenced in the user guide 
> here: 
> https://uima.apache.org/d/ruta-2.3.0/tools.ruta.book.html#ugr.tools.ru
> ta.language.extensions.core-ext.stringfunctions
>
> The problem is, they don't work out of the box in the Ruta Workbench 2.3.1 with Eclipse 4.4.2. I've set up a new Ruta project with a script containing the (slightly modified) code from the substring example:
>
> DECLARE Test; // I've added this line to make the example work.
> STRING s;
> STRINGLIST sl;
> CW{-> MATCHEDTEXT(s), ADD(sl, substring(s,0,8))};
> CW{INLIST(sl) -> Test}; // Changed SW to CW to make the rule work.
>
> The input file only contains two words, "Alexanderplatz" and "Alexander". What I expected was that the first rule finds "Alexanderplatz" and stores the  first nine letters of it in the string list sl so that the last line can annotate "Alexander" with "Test". In reality, however, nothing happens. I get no error message, but after execution, there is no "Test" annotation.
>
> Is there some additional configuration needed to access these string functions?
>
> Any help would be appreciated.
>
> Best Regards,
>             Wolf-Dietrich Materna
>
>


Re: How to use string functions from ruta-core-ext in Ruta

Posted by Peter Klügl <pe...@averbis.com>.
Hi,

it should work just fine (tested with current trunk).

The substring function like the other string functions just delegate to
the java methods. Thus,  the substring from 0 to 8 returns "Alexande".
The example should work with : CW{-> MATCHEDTEXT(s), ADD(sl,
substring(s,0,9))};

Best,

Peter

Am 17.11.2015 um 09:05 schrieb Wolf-Dietrich Materna:
> Hi,
>
> I'd like to use the Ruta string functions referenced in the user guide here: https://uima.apache.org/d/ruta-2.3.0/tools.ruta.book.html#ugr.tools.ruta.language.extensions.core-ext.stringfunctions
>
> The problem is, they don't work out of the box in the Ruta Workbench 2.3.1 with Eclipse 4.4.2. I've set up a new Ruta project with a script containing the (slightly modified) code from the substring example:
>
> DECLARE Test; // I've added this line to make the example work.
> STRING s;
> STRINGLIST sl;
> CW{-> MATCHEDTEXT(s), ADD(sl, substring(s,0,8))};
> CW{INLIST(sl) -> Test}; // Changed SW to CW to make the rule work.
>
> The input file only contains two words, "Alexanderplatz" and "Alexander". What I expected was that the first rule finds "Alexanderplatz" and stores the  first nine letters of it in the string list sl so that the last line can annotate "Alexander" with "Test". In reality, however, nothing happens. I get no error message, but after execution, there is no "Test" annotation.
>
> Is there some additional configuration needed to access these string functions?
>
> Any help would be appreciated.
>
> Best Regards,
>             Wolf-Dietrich Materna
>
>