You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Lisa Langnickel <li...@scai.fraunhofer.de> on 2017/05/30 13:35:31 UTC
UIMA Ruta use of features in a block statement
Hi,
I would like to use a BLOCK statement to iterate over the values of a feature.
In more detail, I applied a lemmatizer before and would like to work on the "lemmas" itself.
I tried something like this (where Lemma.wordLemma describes the feature of Lemma):
BLOCK(forEACH) Lemma.wordLemma{}{
Document{-> MATCHEDTEXT(s), ASSIGN(a,contains(s,"vergess"))};
Document{a -> Value2};
}
There is no error message, but nothing happens. Instead, when only working on the type "Lemma", it works.
Is there any possibility to work on the feature within the block statement?
Thanks in advance,
Lisa
Re: UIMA Ruta use of features in a block statement
Posted by Peter Klügl <pe...@averbis.com>.
Hi
Am 13.07.2017 um 10:31 schrieb Sumit Madan:
> I'll take a look. Could take a few days until I get back to you.
>
> No hurry as it is not urgent.
>
It's hard to reproduce the problem using the xmis since I do not have
the typesystems. I do not see any problems in the Applied Rules view.
Maybe you can debug it? I would set a (conditioned) break point at
RutaRuleElement line 59 (current trunk) and investigate why an empty
list is returned for the Lemma rule in the block.
Is there any change of the filtering settings, action or parameter? Have
you tried to update to the current release candidate for testing? Have
you set any special parameters for internal indexing?
Best,
Peter
>>
>>> Another small issue: DebugRuleApply.element doesn't always match with
>>> the original rules. For example, for the second rule, it contains the
>>> value "Lemma{->MATCHEDTEXT(s, ),ASSIGN(a, contains(s))};", which is
>>> not identical to the user input.
>>>
>> Yes, unfortunately I did not really take care of it since it is only
>> debug info. I assume you are referring to the comma? I'll fix that. Let
>> me know if you observe more.
>
> Yes, the comma, and also the contains() method is missing the second
> string parameter.
>
> I've one more issue: The loading of extensions is not working if I run
> Ruta under Groovy (2.4.7) (and with Java 1.7 or 1.8 source and target
> compatibility). But I haven't looked deep into it. I'll provide you
> more information as soon as I have it. (The runnable test I created
> was first developed with Groovy.)
>
>> Best,
>>
>> Peter
>
Re: UIMA Ruta use of features in a block statement
Posted by Sumit Madan <su...@scai.fraunhofer.de>.
Am 13.07.2017 um 09:32 schrieb Peter Klügl:
> Hi,
Hi Peter,
>
>
> Am 12.07.2017 um 18:35 schrieb Sumit Madan:
>> The applied rules:
>> ###
>> BLOCK(forEACH) Lemma{}{
>> Lemma{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>> Lemma{a ->Value1};
>> }
>> ###
>>
> I'll take a look. Could take a few days until I get back to you.
No hurry as it is not urgent.
>
>> Another small issue: DebugRuleApply.element doesn't always match with
>> the original rules. For example, for the second rule, it contains the
>> value "Lemma{->MATCHEDTEXT(s, ),ASSIGN(a, contains(s))};", which is
>> not identical to the user input.
>>
> Yes, unfortunately I did not really take care of it since it is only
> debug info. I assume you are referring to the comma? I'll fix that. Let
> me know if you observe more.
Yes, the comma, and also the contains() method is missing the second
string parameter.
I've one more issue: The loading of extensions is not working if I run
Ruta under Groovy (2.4.7) (and with Java 1.7 or 1.8 source and target
compatibility). But I haven't looked deep into it. I'll provide you more
information as soon as I have it. (The runnable test I created was first
developed with Groovy.)
> Best,
>
> Peter
--
Mit freundlichem Gruß / Best regards
Sumit Madan, M.Sc.
Wissenschaftlicher Mitarbeiter / Research fellow
Fraunhofer-Institute for Algorithms and Scientific Computing (SCAI)
Department of Bioinformatics
Schloss Birlinghoven
D-53754 Sankt Augustin
Room: C3-242
Tel.: +49 2241 14 2997
Email: sumit.madan@scai.fraunhofer.de
Internet: http://www.scai.fraunhofer.de/
Re: UIMA Ruta use of features in a block statement
Posted by Peter Klügl <pe...@averbis.com>.
Hi,
Am 12.07.2017 um 18:35 schrieb Sumit Madan:
> Am 06.07.2017 um 18:00 schrieb Peter Klügl:
>> Hi,
>
> Hi Peter,
>
>> I cannot reproduce the problem. So you have maybe a small runnable test?
>
> I've created a small runnable test with DKPro (1.8.0) and Ruta
> (2.6.0). I've to say that I'm also unable to reproduce the problem.
> All block constructs are working just fine in the runnable test.
>
> For the documents that we process in our internal pipeline, which is
> mostly identical to the runnable test, the block constructs on Lemma
> type are not working. The pipeline uses our own internal type system.
> I've tried to do some debugging but not able to find the problem. A
> characteristic of our pipeline is that we work on a different view
> than _InitialView. I've also considered this aspect in the runnable test.
>
> As I cannot provide you the source code of the internal pipeline,
> we've created a minimal serialized CAS with debug types. May be you
> can identify the problem in the CAS? (The serialized CAS has been sent
> to your private email address.)
>
> The applied rules:
> ###
> BLOCK(forEACH) Lemma{}{
> Lemma{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
> Lemma{a ->Value1};
> }
> ###
>
I'll take a look. Could take a few days until I get back to you.
> Another small issue: DebugRuleApply.element doesn't always match with
> the original rules. For example, for the second rule, it contains the
> value "Lemma{->MATCHEDTEXT(s, ),ASSIGN(a, contains(s))};", which is
> not identical to the user input.
>
Yes, unfortunately I did not really take care of it since it is only
debug info. I assume you are referring to the comma? I'll fix that. Let
me know if you observe more.
Best,
Peter
>>
>> Best,
>>
>>
>> Peter
>>
>>
>>
>> Am 31.05.2017 um 14:18 schrieb Sumit Madan:
>>> Am 31.05.2017 um 13:26 schrieb Sumit Madan:
>>>> Am 31.05.2017 um 09:59 schrieb Peter Klügl:
>>>>> Hi,
>>>> Hi Peter,
>>>>
>>>>> Am 30.05.2017 um 19:35 schrieb Sumit Madan:
>>>>>> We were not able to access the annotation within the BLOCK.
>>>>>>
>>>>>> ###
>>>>>> STRING s;
>>>>>> BOOLEAN a ;
>>>>>>
>>>>>> // This is not working for us:
>>>>>> BLOCK(forEACH) Lemma{}{
>>>>>> Lemma{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>>>>>> Lemma{a ->Test1};
>>>>>> }
>>>>>>
>>>>>> // This is working:
>>>>>> BLOCK(forEACH) Lemma{}{
>>>>>> W{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>>>>>> W{a ->Test2};
>>>>>> }
>>>>>>
>>>>>> // This is also working:
>>>>>> BLOCK(forEACH) Lemma{}{
>>>>>> Document{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>>>>>> Document{a ->Test3};
>>>>>> }
>>>>>> ###
>>>>>>
>>>>> All three examples should work. Which ruta version do you use? It
>>>>> looks
>>>>> like a bug.
>>>> Lisa is testing again and will get back to you.
>>> We tested it again and can confirm the following:
>>>
>>> ###
>>> STRING s;
>>> BOOLEAN a ;
>>>
>>> // This is not working:
>>> BLOCK(forEACH1) Lemma{} { // Matches a lot
>>> Lemma{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))}; // Matches 0
>>> Lemma{a ->Test1};
>>> }
>>>
>>> // This is not working:
>>> BLOCK(forEACH2) Lemma{} { // Matches a lot
>>> Lemma{contains(Lemma.ct, "er") -> MARK(Test2)}; // Matches 0
>>> }
>>>
>>> // This is working:
>>> Lemma{contains(Lemma.ct, "er") -> MARK(Test3)}; // Matches 1
>>>
>>> // This is working:
>>> BLOCK(forEACH4) Lemma{}{
>>> W{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))}; // Matches 1
>>> W{a ->Test4};
>>> }
>>>
>>> // This is also working:
>>> BLOCK(forEACH5) Lemma{}{
>>> Document{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))}; //
>>> Matches 1
>>> Document{a ->Test5};
>>> }
>>> ###
>>>
>>> Is it possible that in a BLOCK only Ruta types are available?
>>>
>>> We are using the latest stable version 2.6.0.
>>>
>
>
Re: UIMA Ruta use of features in a block statement
Posted by Sumit Madan <su...@scai.fraunhofer.de>.
Am 06.07.2017 um 18:00 schrieb Peter Klügl:
> Hi,
Hi Peter,
> I cannot reproduce the problem. So you have maybe a small runnable test?
I've created a small runnable test with DKPro (1.8.0) and Ruta (2.6.0).
I've to say that I'm also unable to reproduce the problem. All block
constructs are working just fine in the runnable test.
For the documents that we process in our internal pipeline, which is
mostly identical to the runnable test, the block constructs on Lemma
type are not working. The pipeline uses our own internal type system.
I've tried to do some debugging but not able to find the problem. A
characteristic of our pipeline is that we work on a different view than
_InitialView. I've also considered this aspect in the runnable test.
As I cannot provide you the source code of the internal pipeline, we've
created a minimal serialized CAS with debug types. May be you can
identify the problem in the CAS? (The serialized CAS has been sent to
your private email address.)
The applied rules:
###
BLOCK(forEACH) Lemma{}{
Lemma{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
Lemma{a ->Value1};
}
###
Another small issue: DebugRuleApply.element doesn't always match with
the original rules. For example, for the second rule, it contains the
value "Lemma{->MATCHEDTEXT(s, ),ASSIGN(a, contains(s))};", which is
not identical to the user input.
>
> Best,
>
>
> Peter
>
>
>
> Am 31.05.2017 um 14:18 schrieb Sumit Madan:
>> Am 31.05.2017 um 13:26 schrieb Sumit Madan:
>>> Am 31.05.2017 um 09:59 schrieb Peter Klügl:
>>>> Hi,
>>> Hi Peter,
>>>
>>>> Am 30.05.2017 um 19:35 schrieb Sumit Madan:
>>>>> We were not able to access the annotation within the BLOCK.
>>>>>
>>>>> ###
>>>>> STRING s;
>>>>> BOOLEAN a ;
>>>>>
>>>>> // This is not working for us:
>>>>> BLOCK(forEACH) Lemma{}{
>>>>> Lemma{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>>>>> Lemma{a ->Test1};
>>>>> }
>>>>>
>>>>> // This is working:
>>>>> BLOCK(forEACH) Lemma{}{
>>>>> W{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>>>>> W{a ->Test2};
>>>>> }
>>>>>
>>>>> // This is also working:
>>>>> BLOCK(forEACH) Lemma{}{
>>>>> Document{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>>>>> Document{a ->Test3};
>>>>> }
>>>>> ###
>>>>>
>>>> All three examples should work. Which ruta version do you use? It looks
>>>> like a bug.
>>> Lisa is testing again and will get back to you.
>> We tested it again and can confirm the following:
>>
>> ###
>> STRING s;
>> BOOLEAN a ;
>>
>> // This is not working:
>> BLOCK(forEACH1) Lemma{} { // Matches a lot
>> Lemma{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))}; // Matches 0
>> Lemma{a ->Test1};
>> }
>>
>> // This is not working:
>> BLOCK(forEACH2) Lemma{} { // Matches a lot
>> Lemma{contains(Lemma.ct, "er") -> MARK(Test2)}; // Matches 0
>> }
>>
>> // This is working:
>> Lemma{contains(Lemma.ct, "er") -> MARK(Test3)}; // Matches 1
>>
>> // This is working:
>> BLOCK(forEACH4) Lemma{}{
>> W{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))}; // Matches 1
>> W{a ->Test4};
>> }
>>
>> // This is also working:
>> BLOCK(forEACH5) Lemma{}{
>> Document{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))}; // Matches 1
>> Document{a ->Test5};
>> }
>> ###
>>
>> Is it possible that in a BLOCK only Ruta types are available?
>>
>> We are using the latest stable version 2.6.0.
>>
--
Mit freundlichem Gruß / Best regards
Sumit Madan, M.Sc.
Wissenschaftlicher Mitarbeiter / Research fellow
Fraunhofer-Institute for Algorithms and Scientific Computing (SCAI)
Department of Bioinformatics
Schloss Birlinghoven
D-53754 Sankt Augustin
Room: C3-242
Tel.: +49 2241 14 2997
Email:sumit.madan@scai.fraunhofer.de
Internet:http://www.scai.fraunhofer.de/
Re: UIMA Ruta use of features in a block statement
Posted by Peter Klügl <pe...@averbis.com>.
Hi,
I cannot reproduce the problem. So you have maybe a small runnable test?
Best,
Peter
Am 31.05.2017 um 14:18 schrieb Sumit Madan:
> Am 31.05.2017 um 13:26 schrieb Sumit Madan:
>> Am 31.05.2017 um 09:59 schrieb Peter Klügl:
>>> Hi,
>>
>> Hi Peter,
>>
>>> Am 30.05.2017 um 19:35 schrieb Sumit Madan:
>>>> We were not able to access the annotation within the BLOCK.
>>>>
>>>> ###
>>>> STRING s;
>>>> BOOLEAN a ;
>>>>
>>>> // This is not working for us:
>>>> BLOCK(forEACH) Lemma{}{
>>>> Lemma{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>>>> Lemma{a ->Test1};
>>>> }
>>>>
>>>> // This is working:
>>>> BLOCK(forEACH) Lemma{}{
>>>> W{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>>>> W{a ->Test2};
>>>> }
>>>>
>>>> // This is also working:
>>>> BLOCK(forEACH) Lemma{}{
>>>> Document{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>>>> Document{a ->Test3};
>>>> }
>>>> ###
>>>>
>>> All three examples should work. Which ruta version do you use? It looks
>>> like a bug.
>>
>> Lisa is testing again and will get back to you.
>
> We tested it again and can confirm the following:
>
> ###
> STRING s;
> BOOLEAN a ;
>
> // This is not working:
> BLOCK(forEACH1) Lemma{} { // Matches a lot
> Lemma{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))}; // Matches 0
> Lemma{a ->Test1};
> }
>
> // This is not working:
> BLOCK(forEACH2) Lemma{} { // Matches a lot
> Lemma{contains(Lemma.ct, "er") -> MARK(Test2)}; // Matches 0
> }
>
> // This is working:
> Lemma{contains(Lemma.ct, "er") -> MARK(Test3)}; // Matches 1
>
> // This is working:
> BLOCK(forEACH4) Lemma{}{
> W{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))}; // Matches 1
> W{a ->Test4};
> }
>
> // This is also working:
> BLOCK(forEACH5) Lemma{}{
> Document{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))}; // Matches 1
> Document{a ->Test5};
> }
> ###
>
> Is it possible that in a BLOCK only Ruta types are available?
>
> We are using the latest stable version 2.6.0.
>
Re: UIMA Ruta use of features in a block statement
Posted by Sumit Madan <su...@scai.fraunhofer.de>.
Am 31.05.2017 um 14:25 schrieb Peter Klügl:
> Hi,
>
Hi,
> thanks. I'll take a look and fix it asap:
> https://issues.apache.org/jira/browse/UIMA-5437
thank you!
> There is no / should be no restriction on specific subsets of types.
Alright!
> Best,
>
>
> Peter
--
Mit freundlichem Gruß / Best regards
Sumit Madan
Re: UIMA Ruta use of features in a block statement
Posted by Peter Klügl <pe...@averbis.com>.
Hi,
thanks. I'll take a look and fix it asap:
https://issues.apache.org/jira/browse/UIMA-5437
There is no / should be no restriction on specific subsets of types.
Best,
Peter
Am 31.05.2017 um 14:18 schrieb Sumit Madan:
> Am 31.05.2017 um 13:26 schrieb Sumit Madan:
>> Am 31.05.2017 um 09:59 schrieb Peter Klügl:
>>> Hi,
>>
>> Hi Peter,
>>
>>> Am 30.05.2017 um 19:35 schrieb Sumit Madan:
>>>> We were not able to access the annotation within the BLOCK.
>>>>
>>>> ###
>>>> STRING s;
>>>> BOOLEAN a ;
>>>>
>>>> // This is not working for us:
>>>> BLOCK(forEACH) Lemma{}{
>>>> Lemma{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>>>> Lemma{a ->Test1};
>>>> }
>>>>
>>>> // This is working:
>>>> BLOCK(forEACH) Lemma{}{
>>>> W{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>>>> W{a ->Test2};
>>>> }
>>>>
>>>> // This is also working:
>>>> BLOCK(forEACH) Lemma{}{
>>>> Document{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>>>> Document{a ->Test3};
>>>> }
>>>> ###
>>>>
>>> All three examples should work. Which ruta version do you use? It looks
>>> like a bug.
>>
>> Lisa is testing again and will get back to you.
>
> We tested it again and can confirm the following:
>
> ###
> STRING s;
> BOOLEAN a ;
>
> // This is not working:
> BLOCK(forEACH1) Lemma{} { // Matches a lot
> Lemma{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))}; // Matches 0
> Lemma{a ->Test1};
> }
>
> // This is not working:
> BLOCK(forEACH2) Lemma{} { // Matches a lot
> Lemma{contains(Lemma.ct, "er") -> MARK(Test2)}; // Matches 0
> }
>
> // This is working:
> Lemma{contains(Lemma.ct, "er") -> MARK(Test3)}; // Matches 1
>
> // This is working:
> BLOCK(forEACH4) Lemma{}{
> W{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))}; // Matches 1
> W{a ->Test4};
> }
>
> // This is also working:
> BLOCK(forEACH5) Lemma{}{
> Document{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))}; // Matches 1
> Document{a ->Test5};
> }
> ###
>
> Is it possible that in a BLOCK only Ruta types are available?
>
> We are using the latest stable version 2.6.0.
>
Re: UIMA Ruta use of features in a block statement
Posted by Sumit Madan <su...@scai.fraunhofer.de>.
Am 31.05.2017 um 13:26 schrieb Sumit Madan:
> Am 31.05.2017 um 09:59 schrieb Peter Klügl:
>> Hi,
>
> Hi Peter,
>
>> Am 30.05.2017 um 19:35 schrieb Sumit Madan:
>>> We were not able to access the annotation within the BLOCK.
>>>
>>> ###
>>> STRING s;
>>> BOOLEAN a ;
>>>
>>> // This is not working for us:
>>> BLOCK(forEACH) Lemma{}{
>>> Lemma{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>>> Lemma{a ->Test1};
>>> }
>>>
>>> // This is working:
>>> BLOCK(forEACH) Lemma{}{
>>> W{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>>> W{a ->Test2};
>>> }
>>>
>>> // This is also working:
>>> BLOCK(forEACH) Lemma{}{
>>> Document{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>>> Document{a ->Test3};
>>> }
>>> ###
>>>
>> All three examples should work. Which ruta version do you use? It looks
>> like a bug.
>
> Lisa is testing again and will get back to you.
We tested it again and can confirm the following:
###
STRING s;
BOOLEAN a ;
// This is not working:
BLOCK(forEACH1) Lemma{} { // Matches a lot
Lemma{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))}; // Matches 0
Lemma{a ->Test1};
}
// This is not working:
BLOCK(forEACH2) Lemma{} { // Matches a lot
Lemma{contains(Lemma.ct, "er") -> MARK(Test2)}; // Matches 0
}
// This is working:
Lemma{contains(Lemma.ct, "er") -> MARK(Test3)}; // Matches 1
// This is working:
BLOCK(forEACH4) Lemma{}{
W{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))}; // Matches 1
W{a ->Test4};
}
// This is also working:
BLOCK(forEACH5) Lemma{}{
Document{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))}; // Matches 1
Document{a ->Test5};
}
###
Is it possible that in a BLOCK only Ruta types are available?
We are using the latest stable version 2.6.0.
--
Mit freundlichem Gruß / Best regards
Sumit Madan, M.Sc.
Wissenschaftlicher Mitarbeiter / Research fellow
Fraunhofer-Institute for Algorithms and Scientific Computing (SCAI)
Department of Bioinformatics
Schloss Birlinghoven
D-53754 Sankt Augustin
Room: C3-242
Tel.: +49 2241 14 2997
Email: sumit.madan@scai.fraunhofer.de
Internet: http://www.scai.fraunhofer.de/
Re: UIMA Ruta use of features in a block statement
Posted by Sumit Madan <su...@scai.fraunhofer.de>.
Am 31.05.2017 um 09:59 schrieb Peter Klügl:
> Hi,
Hi Peter,
> Am 30.05.2017 um 19:35 schrieb Sumit Madan:
>> We were not able to access the annotation within the BLOCK.
>>
>> ###
>> STRING s;
>> BOOLEAN a ;
>>
>> // This is not working for us:
>> BLOCK(forEACH) Lemma{}{
>> Lemma{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>> Lemma{a ->Test1};
>> }
>>
>> // This is working:
>> BLOCK(forEACH) Lemma{}{
>> W{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>> W{a ->Test2};
>> }
>>
>> // This is also working:
>> BLOCK(forEACH) Lemma{}{
>> Document{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>> Document{a ->Test3};
>> }
>> ###
>>
> All three examples should work. Which ruta version do you use? It looks
> like a bug.
Lisa is testing again and will get back to you.
>
>>
>> We weren't aware that we can use contains() as a condition too. I
>> think the documentation [1] doesn't describe that String functions
>> with return value boolean can be used as conditions. I think one can
>> assume if you see the source code (public class
>> ContainsBooleanFunction extends BooleanFunctionExpression) under [2].
>>
>> [1] https://uima.apache.org/d/ruta-current/tools.ruta.book.html
>> [2]:
>> https://github.com/apache/uima-ruta/blob/trunk/ruta-core-ext/src/main/java/org/apache/uima/ruta/string/bool/ContainsBooleanFunction.java
>>
> Thank, I'll extend the documentation.
Thank you!
> Hmm, I do not know, this sounds all correct. Did you switch the CAS view
> in the CAS Editor?
It's working now. The commit, which activated the second debug option,
was not included on our developement environment. That's why the views
were empty. The views are very helpful to get an fast overview over the
failed and matched rules.
> Best,
>
> Peter
--
Mit freundlichem Gruß / Best regards
Sumit Madan, M.Sc.
Wissenschaftlicher Mitarbeiter / Research fellow
Fraunhofer-Institute for Algorithms and Scientific Computing (SCAI)
Department of Bioinformatics
Schloss Birlinghoven
D-53754 Sankt Augustin
Room: C3-242
Tel.: +49 2241 14 2997
Email: sumit.madan@scai.fraunhofer.de
Internet: http://www.scai.fraunhofer.de/
Re: UIMA Ruta use of features in a block statement
Posted by Peter Klügl <pe...@averbis.com>.
Hi,
Am 30.05.2017 um 19:35 schrieb Sumit Madan:
>
> We were not able to access the annotation within the BLOCK.
>
> ###
> STRING s;
> BOOLEAN a ;
>
> // This is not working for us:
> BLOCK(forEACH) Lemma{}{
> Lemma{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
> Lemma{a ->Test1};
> }
>
> // This is working:
> BLOCK(forEACH) Lemma{}{
> W{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
> W{a ->Test2};
> }
>
> // This is also working:
> BLOCK(forEACH) Lemma{}{
> Document{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
> Document{a ->Test3};
> }
> ###
>
All three examples should work. Which ruta version do you use? It looks
like a bug.
>>
>>> Or is the block statement not needed at all?
>> Yes, they are not need at all, also not in similar use cases. If you
>> have several conditions with separate actions, you can increase the
>> speed using the FOREACH block.
>
> Alright, that makes sense.
>
>>
>>> I used it because I found it in the user guideline in relation to
>>> NER-task:
>>>
>>> STRING s;
>>> BOOLEAN a ;
>>> BLOCK(forEACH) W{}{
>>> W{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>>> W{a ->Test};
>>> }
>>> So, what's the advantage of the block statement here?
>> There is no advantage. I assume that it was necessary when the string
>> function have been introduced. However, the language evolved quite a bit
>> since then. This example should just illustrate some usage of the
>> function. Now, you can also use the function as an implicit condition.
>> Thus, you do not need a separate rule after the assign action. Thus, you
>> do not need the block to restrict the window in order to restrict the
>> usage of the global variable (which is also not required). It's now a
>> really bad example...
>>
>> Now I would write it as:
>>
>> W{contains(W.ct, "er") -> Test};
>
> We weren't aware that we can use contains() as a condition too. I
> think the documentation [1] doesn't describe that String functions
> with return value boolean can be used as conditions. I think one can
> assume if you see the source code (public class
> ContainsBooleanFunction extends BooleanFunctionExpression) under [2].
>
> [1] https://uima.apache.org/d/ruta-current/tools.ruta.book.html
> [2]:
> https://github.com/apache/uima-ruta/blob/trunk/ruta-core-ext/src/main/java/org/apache/uima/ruta/string/bool/ContainsBooleanFunction.java
>
Thank, I'll extend the documentation.
>>
>>> And one other question:
>>> We implemented Ruta into the UIMA pipeline, but in the debug mode,
>>> the ruta views "matched rules", "applied rules", "failed rules" etc.
>>> are all empty.
>>> How can we fix this?
>> Can you give me more information? Did you directly launch the ruta
>> script in a ruta debug launch configuration or did you include the AE in
>> a pipeline and launch that in a java debug launch config?
>
> We integrated the AE in our pipeline as we have our own type system.
> The steps we took to integrate Ruta in our environment:
> 1. Read the BasicEngine.xml as AnalysisEngineDescription.
> 2. Modify it and add the merged typesystem (Ruta typesystem +ours)
> 3. Modify some parameters (such as extensions, debugging, statistics)
> 4. Write the modified AnalysisEngineDescription as a temporary file
> 5. Create a new aggregate AE (AAED.xml) with a different view name
> (sofaName) and use the temporary file as the AnalysisEngine
> (descriptorLocation)
> 6. Produce AE, process CAS and destroy AE
>
> All these steps are included in a apply() method, which is very
> similar to Ruta::apply(CAS cas, String script, Map<String, Object>
> parameters). We just call our apply() method in our UIMA analysis
> engines if we need to extract information with Ruta.
>
>> In general,
>> you need to set the two debug config parameters of the RutaEngine to
>> true in order to add debug information to the CAS: DEBUG and
>> DEBUG_WITH_MATCHES
>
> They are activated and the CAS contains the debugging information but
> still the views are all empty. Do we have to do something else to fill
> the views as we are not in the workbench?
>
Hmm, I do not know, this sounds all correct. Did you switch the CAS view
in the CAS Editor?
Best,
Peter
Re: UIMA Ruta use of features in a block statement
Posted by Sumit Madan <su...@scai.fraunhofer.de>.
Am 30.05.2017 um 17:53 schrieb Peter Kluegl:
> Hi,
Hi Peter,
(as Lisa already left for today, I'm answering on her behalf.)
> Am 30.05.2017 um 16:37 schrieb Lisa Langnickel:
>> Hi,
>>
>> thank you for your quick reply.
>> The feature wordLemma is a String.
>>
>> The alternatives you wrote work out. Thanks.
>>
>> Nevertheless, will there be the possibility to work on features in a block statement in the future? (For other use cases)
> Well, you can work on features in a BLOCK when you access them using the
> annotation. Besides that, that are no plans to support blocks on string
> expression or similar things.
We were not able to access the annotation within the BLOCK.
###
STRING s;
BOOLEAN a ;
// This is not working for us:
BLOCK(forEACH) Lemma{}{
Lemma{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
Lemma{a ->Test1};
}
// This is working:
BLOCK(forEACH) Lemma{}{
W{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
W{a ->Test2};
}
// This is also working:
BLOCK(forEACH) Lemma{}{
Document{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
Document{a ->Test3};
}
###
>
>> Or is the block statement not needed at all?
> Yes, they are not need at all, also not in similar use cases. If you
> have several conditions with separate actions, you can increase the
> speed using the FOREACH block.
Alright, that makes sense.
>
>>
>> I used it because I found it in the user guideline in relation to NER-task:
>>
>> STRING s;
>> BOOLEAN a ;
>> BLOCK(forEACH) W{}{
>> W{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
>> W{a ->Test};
>> }
>> So, what's the advantage of the block statement here?
> There is no advantage. I assume that it was necessary when the string
> function have been introduced. However, the language evolved quite a bit
> since then. This example should just illustrate some usage of the
> function. Now, you can also use the function as an implicit condition.
> Thus, you do not need a separate rule after the assign action. Thus, you
> do not need the block to restrict the window in order to restrict the
> usage of the global variable (which is also not required). It's now a
> really bad example...
>
> Now I would write it as:
>
> W{contains(W.ct, "er") -> Test};
We weren't aware that we can use contains() as a condition too. I think
the documentation [1] doesn't describe that String functions with return
value boolean can be used as conditions. I think one can assume if you
see the source code (public class ContainsBooleanFunction extends
BooleanFunctionExpression) under [2].
[1] https://uima.apache.org/d/ruta-current/tools.ruta.book.html
[2]:
https://github.com/apache/uima-ruta/blob/trunk/ruta-core-ext/src/main/java/org/apache/uima/ruta/string/bool/ContainsBooleanFunction.java
>
>> And one other question:
>> We implemented Ruta into the UIMA pipeline, but in the debug mode, the ruta views "matched rules", "applied rules", "failed rules" etc. are all empty.
>> How can we fix this?
> Can you give me more information? Did you directly launch the ruta
> script in a ruta debug launch configuration or did you include the AE in
> a pipeline and launch that in a java debug launch config?
We integrated the AE in our pipeline as we have our own type system. The
steps we took to integrate Ruta in our environment:
1. Read the BasicEngine.xml as AnalysisEngineDescription.
2. Modify it and add the merged typesystem (Ruta typesystem +ours)
3. Modify some parameters (such as extensions, debugging, statistics)
4. Write the modified AnalysisEngineDescription as a temporary file
5. Create a new aggregate AE (AAED.xml) with a different view name
(sofaName) and use the temporary file as the AnalysisEngine
(descriptorLocation)
6. Produce AE, process CAS and destroy AE
All these steps are included in a apply() method, which is very similar
to Ruta::apply(CAS cas, String script, Map<String, Object> parameters).
We just call our apply() method in our UIMA analysis engines if we need
to extract information with Ruta.
> In general,
> you need to set the two debug config parameters of the RutaEngine to
> true in order to add debug information to the CAS: DEBUG and
> DEBUG_WITH_MATCHES
They are activated and the CAS contains the debugging information but
still the views are all empty. Do we have to do something else to fill
the views as we are not in the workbench?
--
Mit freundlichem Gruß / Best regards
Sumit Madan, M.Sc.
Wissenschaftlicher Mitarbeiter / Research fellow
Fraunhofer-Institute for Algorithms and Scientific Computing (SCAI)
Department of Bioinformatics
Schloss Birlinghoven
D-53754 Sankt Augustin
Room: C3-242
Tel.: +49 2241 14 2997
Email: sumit.madan@scai.fraunhofer.de
Internet: http://www.scai.fraunhofer.de/
Re: UIMA Ruta use of features in a block statement
Posted by Peter Kluegl <pk...@gmail.com>.
Hi,
Am 30.05.2017 um 16:37 schrieb Lisa Langnickel:
> Hi,
>
> thank you for your quick reply.
> The feature wordLemma is a String.
>
> The alternatives you wrote work out. Thanks.
>
> Nevertheless, will there be the possibility to work on features in a block statement in the future? (For other use cases)
Well, you can work on features in a BLOCK when you access them using the
annotation. Besides that, that are no plans to support blocks on string
expression or similar things.
> Or is the block statement not needed at all?
Yes, they are not need at all, also not in similar use cases. If you
have several conditions with separate actions, you can increase the
speed using the FOREACH block.
>
> I used it because I found it in the user guideline in relation to NER-task:
>
> STRING s;
> BOOLEAN a ;
> BLOCK(forEACH) W{}{
> W{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
> W{a ->Test};
> }
> So, what's the advantage of the block statement here?
There is no advantage. I assume that it was necessary when the string
function have been introduced. However, the language evolved quite a bit
since then. This example should just illustrate some usage of the
function. Now, you can also use the function as an implicit condition.
Thus, you do not need a separate rule after the assign action. Thus, you
do not need the block to restrict the window in order to restrict the
usage of the global variable (which is also not required). It's now a
really bad example...
Now I would write it as:
W{contains(W.ct, "er") -> Test};
>
> And one other question:
> We implemented Ruta into the UIMA pipeline, but in the debug mode, the ruta views "matched rules", "applied rules", "failed rules" etc. are all empty.
> How can we fix this?
Can you give me more information? Did you directly launch the ruta
script in a ruta debug launch configuration or did you include the AE in
a pipeline and launch that in a java debug launch config? In general,
you need to set the two debug config parameters of the RutaEngine to
true in order to add debug information to the CAS: DEBUG and
DEBUG_WITH_MATCHES
Best,
Peter
> Best regards,
> Lisa
>
>
>
>
>
>
>
>
> ----- Original Message -----
> From: "Peter Klügl" <pe...@averbis.com>
> To: "user" <us...@uima.apache.org>
> Sent: Tuesday, May 30, 2017 3:55:41 PM
> Subject: Re: UIMA Ruta use of features in a block statement
>
> Hi,
>
>
> yes, this should throw an error when the script is parsed. I have to
> take closer look, could be that the feature is interpreted as literal
> string matching condition because of a string expression representing
> the feature.
>
>
> What is the range of the feature wordLemma? Support in ruta for
> StringArray and StringList is still not really given.
>
>
> If you want to iterate, you need to iterate over annotations currently.
> The rules also operate always on types or annotations, something that is
> a reference to some text position. However, this should not be a problem
> as you can simply use the existing Lemma annotation.
>
>
> You could try something like:
>
>
> FOREACH(lemma) Lemma{}{
> lemma{REGEXP(lemma.wordLemma, ".*vergess.*") -> Value2};
> }
>
>
> or even
>
>
>
> l:Lemma{REGEXP(l.wordLemma, ".*vergess.*") -> Value2};
>
>
> with the boolean string function, it could work like this:
>
>
> l:Lemma{contains(l.wordLemma, "vergess") -> Value2};
>
>
> (I did not test the rules and I was assuming several things like feature
> ranges)
>
>
> Best,
>
>
> Peter
>
>
> Am 30.05.2017 um 15:35 schrieb Lisa Langnickel:
>> Hi,
>>
>> I would like to use a BLOCK statement to iterate over the values of a feature.
>> In more detail, I applied a lemmatizer before and would like to work on the "lemmas" itself.
>>
>> I tried something like this (where Lemma.wordLemma describes the feature of Lemma):
>>
>> BLOCK(forEACH) Lemma.wordLemma{}{
>> Document{-> MATCHEDTEXT(s), ASSIGN(a,contains(s,"vergess"))};
>> Document{a -> Value2};
>> }
>>
>> There is no error message, but nothing happens. Instead, when only working on the type "Lemma", it works.
>>
>> Is there any possibility to work on the feature within the block statement?
>>
>> Thanks in advance,
>> Lisa
Re: UIMA Ruta use of features in a block statement
Posted by Lisa Langnickel <li...@scai.fraunhofer.de>.
Hi,
thank you for your quick reply.
The feature wordLemma is a String.
The alternatives you wrote work out. Thanks.
Nevertheless, will there be the possibility to work on features in a block statement in the future? (For other use cases)
Or is the block statement not needed at all?
I used it because I found it in the user guideline in relation to NER-task:
STRING s;
BOOLEAN a ;
BLOCK(forEACH) W{}{
W{->MATCHEDTEXT(s), ASSIGN(a,contains(s,"er"))};
W{a ->Test};
}
So, what's the advantage of the block statement here?
And one other question:
We implemented Ruta into the UIMA pipeline, but in the debug mode, the ruta views "matched rules", "applied rules", "failed rules" etc. are all empty.
How can we fix this?
Best regards,
Lisa
----- Original Message -----
From: "Peter Klügl" <pe...@averbis.com>
To: "user" <us...@uima.apache.org>
Sent: Tuesday, May 30, 2017 3:55:41 PM
Subject: Re: UIMA Ruta use of features in a block statement
Hi,
yes, this should throw an error when the script is parsed. I have to
take closer look, could be that the feature is interpreted as literal
string matching condition because of a string expression representing
the feature.
What is the range of the feature wordLemma? Support in ruta for
StringArray and StringList is still not really given.
If you want to iterate, you need to iterate over annotations currently.
The rules also operate always on types or annotations, something that is
a reference to some text position. However, this should not be a problem
as you can simply use the existing Lemma annotation.
You could try something like:
FOREACH(lemma) Lemma{}{
lemma{REGEXP(lemma.wordLemma, ".*vergess.*") -> Value2};
}
or even
l:Lemma{REGEXP(l.wordLemma, ".*vergess.*") -> Value2};
with the boolean string function, it could work like this:
l:Lemma{contains(l.wordLemma, "vergess") -> Value2};
(I did not test the rules and I was assuming several things like feature
ranges)
Best,
Peter
Am 30.05.2017 um 15:35 schrieb Lisa Langnickel:
> Hi,
>
> I would like to use a BLOCK statement to iterate over the values of a feature.
> In more detail, I applied a lemmatizer before and would like to work on the "lemmas" itself.
>
> I tried something like this (where Lemma.wordLemma describes the feature of Lemma):
>
> BLOCK(forEACH) Lemma.wordLemma{}{
> Document{-> MATCHEDTEXT(s), ASSIGN(a,contains(s,"vergess"))};
> Document{a -> Value2};
> }
>
> There is no error message, but nothing happens. Instead, when only working on the type "Lemma", it works.
>
> Is there any possibility to work on the feature within the block statement?
>
> Thanks in advance,
> Lisa
Re: UIMA Ruta use of features in a block statement
Posted by Peter Klügl <pe...@averbis.com>.
Hi,
yes, this should throw an error when the script is parsed. I have to
take closer look, could be that the feature is interpreted as literal
string matching condition because of a string expression representing
the feature.
What is the range of the feature wordLemma? Support in ruta for
StringArray and StringList is still not really given.
If you want to iterate, you need to iterate over annotations currently.
The rules also operate always on types or annotations, something that is
a reference to some text position. However, this should not be a problem
as you can simply use the existing Lemma annotation.
You could try something like:
FOREACH(lemma) Lemma{}{
lemma{REGEXP(lemma.wordLemma, ".*vergess.*") -> Value2};
}
or even
l:Lemma{REGEXP(l.wordLemma, ".*vergess.*") -> Value2};
with the boolean string function, it could work like this:
l:Lemma{contains(l.wordLemma, "vergess") -> Value2};
(I did not test the rules and I was assuming several things like feature
ranges)
Best,
Peter
Am 30.05.2017 um 15:35 schrieb Lisa Langnickel:
> Hi,
>
> I would like to use a BLOCK statement to iterate over the values of a feature.
> In more detail, I applied a lemmatizer before and would like to work on the "lemmas" itself.
>
> I tried something like this (where Lemma.wordLemma describes the feature of Lemma):
>
> BLOCK(forEACH) Lemma.wordLemma{}{
> Document{-> MATCHEDTEXT(s), ASSIGN(a,contains(s,"vergess"))};
> Document{a -> Value2};
> }
>
> There is no error message, but nothing happens. Instead, when only working on the type "Lemma", it works.
>
> Is there any possibility to work on the feature within the block statement?
>
> Thanks in advance,
> Lisa