uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Kl├╝gl <pklu...@uni-wuerzburg.de>
Subject Re: Macros in Ruta? - How to make long scripts short?
Date Fri, 06 Dec 2013 21:09:46 GMT

Am 06.12.2013 16:55, schrieb Alexandre Patry:
> On 2013-12-06 10:46, Richard Eckart de Castilho wrote:
>> Hi,
>> assuming I have a Ruta script with recurring statements of the type
>>   PartOfSpeech{FEATURE("value", "N")
>> Is it possible to define some kind of macro to replace this long
>> statement with a short-hand?
>>   MACRO N := PartOfSpeech{FEATURE("value", "N")}
>>   MACRO V := PartOfSpeech{FEATURE("value", "V")}
>>   N{0,2} V
> From what I know, RUTA does not support macro yet.
>> The closest thing I found in Ruta for such a thing was a Block - but
>> doesn't seem to do what I want, because I would need to ->CALL it.
> I would define temporary annotations for N and V. The compromise on 
> performance is not the same though. It consumes more memory, but 
> searching for N or V does not require to scan all part-of-speeches 
> annotations anymore.

I would call that what Alexandre said actually the "Ruta Way" (no pun 
intended). Just spam annotations on different levels of abstraction. It 
results in a clearer and modular script composition, and in an improved 
explanation of the rule inference.

There have been macros for conditions and action (not for complete rule 
elements), but I removed them a while ago. I could add such macros again 
for rule elements, conditions and actions, but only if someone creates a 
feature request ;-)

You could also write something like:

PartOfSpeech.value=="N"[0,2] PartOfSpeech.value=="V";

... but that is only a few characters shorter.

... btw, I am not a fan of the macros in JAPE. Looks to me like a 
workaround in order to retain the rules in one phase.



> Hope this help,
> Alexandre

View raw message