You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Anna Polychroniou <an...@gmail.com> on 2018/02/23 16:30:01 UTC

Lost in UIMA Ruta Workbench !

Hello,
I am trying to complete an exercise in NLU using UIMA Ruta.
I have hit a wall for the last 3 days.
I would be grateful if you could give a hint on my issue:

I want to create 2 annotations ENTITY and ACTIONS for a list of sentences.
I define a list of words for each one.
Then I want to create a third annotation (INTENT) based on the first 2.
Different values of ENTITY and ACTIONS must combine the 10 different values
of INTENT annotation.

I 've stuck on the final step where I have to create the combined
annotation (with bold).
Could you please help?
I attach my work below.



PACKAGE uima.ruta.exercise;


WORDLIST EntityList = "Entities.txt";
WORDLIST ActionList = "Actions.txt";
DECLARE Annotation ENTITY(STRING value);
DECLARE Annotation ACTIONS(STRING value);


Document{-> RETAINTYPE(BREAK)};
DECLARE Sentence;
BREAK #{->MARK (Sentence)} BREAK;

DECLARE Annotation INTENT(STRING value);
BLOCK(ForEach) Sentence{} {
Document{-> MARKFAST(ENTITY, EntityList)};
Document{-> MARKFAST(ACTIONS, ActionList)};

*Document{-> CREATE(INTENT, "value" =
"Apply_for_Card")}<-{e:ENTITY{e.value=="card"} #
a:ACTIONS{a.value=="application"};}*
*;}*




Thank you,
Anna

Re: Lost in UIMA Ruta Workbench !

Posted by Hugues de Mazancourt <hu...@mazancourt.com>.
Hello,

The point is that the MARK action simply creates an annotation without any features. Reading your code, it seems that you expect the matched value to be held in the « value » feature. This is not the case.
You can access to the text that is covered by an annotation through the pseudo-feature « .ct » (as coveredText).
Thus I guess the following rule should do what you want (not tested) :

Document{-> CREATE(INTENT, "value" = "Apply_for_Card")}<-{e:ENTITY{e.ct=="card"} # a:ACTIONS{a.ct=="application"};}* ;}*

But I guess that you will want to capture variations, such as plurals (card/cards) or even derivation (apply/application).
Then you should have a look at MARKTABLE action, which will take as a resource a CSV file with the text to be matched in the input document and as many features as you want to be created on the annotation. Thus you could describe dictionary entries with your variations, all of them mapping to a normalized value.

Keep trying, Ruta is a little bit tricky at start, but it’s worth the effort.

Best regards, 


Hugues de Mazancourt
http://www.mazancourt.com
twitter: @mazancourt



> Le 23 févr. 2018 à 17:30, Anna Polychroniou <an...@gmail.com> a écrit :
> 
> Hello,
> I am trying to complete an exercise in NLU using UIMA Ruta.
> I have hit a wall for the last 3 days.
> I would be grateful if you could give a hint on my issue:
> 
> I want to create 2 annotations ENTITY and ACTIONS for a list of sentences.
> I define a list of words for each one.
> Then I want to create a third annotation (INTENT) based on the first 2.
> Different values of ENTITY and ACTIONS must combine the 10 different values
> of INTENT annotation.
> 
> I 've stuck on the final step where I have to create the combined
> annotation (with bold).
> Could you please help?
> I attach my work below.
> 
> 
> 
> PACKAGE uima.ruta.exercise;
> 
> 
> WORDLIST EntityList = "Entities.txt";
> WORDLIST ActionList = "Actions.txt";
> DECLARE Annotation ENTITY(STRING value);
> DECLARE Annotation ACTIONS(STRING value);
> 
> 
> Document{-> RETAINTYPE(BREAK)};
> DECLARE Sentence;
> BREAK #{->MARK (Sentence)} BREAK;
> 
> DECLARE Annotation INTENT(STRING value);
> BLOCK(ForEach) Sentence{} {
> Document{-> MARKFAST(ENTITY, EntityList)};
> Document{-> MARKFAST(ACTIONS, ActionList)};
> 
> *Document{-> CREATE(INTENT, "value" =
> "Apply_for_Card")}<-{e:ENTITY{e.value=="card"} #
> a:ACTIONS{a.value=="application"};}*
> *;}*
> 
> 
> 
> 
> Thank you,
> Anna


Re: Lost in UIMA Ruta Workbench !

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


if different combination of values of ENTITY and ACTIONS should result
in different values of INTENT, you need separate rules instantiating the
possible combinations.

Does this make sense?

There are several ways to avoid redundant code then... e.g., you could
set a variable in the inlined rules for the CREATE, so that you would
restrict the combinations to the inlined rules.


Best,


Peter


Am 23.02.2018 um 17:30 schrieb Anna Polychroniou:
> Hello,
> I am trying to complete an exercise in NLU using UIMA Ruta.
> I have hit a wall for the last 3 days.
> I would be grateful if you could give a hint on my issue:
>
> I want to create 2 annotations ENTITY and ACTIONS for a list of sentences.
> I define a list of words for each one.
> Then I want to create a third annotation (INTENT) based on the first 2.
> Different values of ENTITY and ACTIONS must combine the 10 different values
> of INTENT annotation.
>
> I 've stuck on the final step where I have to create the combined
> annotation (with bold).
> Could you please help?
> I attach my work below.
>
>
>
> PACKAGE uima.ruta.exercise;
>
>
> WORDLIST EntityList = "Entities.txt";
> WORDLIST ActionList = "Actions.txt";
> DECLARE Annotation ENTITY(STRING value);
> DECLARE Annotation ACTIONS(STRING value);
>
>
> Document{-> RETAINTYPE(BREAK)};
> DECLARE Sentence;
> BREAK #{->MARK (Sentence)} BREAK;
>
> DECLARE Annotation INTENT(STRING value);
> BLOCK(ForEach) Sentence{} {
> Document{-> MARKFAST(ENTITY, EntityList)};
> Document{-> MARKFAST(ACTIONS, ActionList)};
>
> *Document{-> CREATE(INTENT, "value" =
> "Apply_for_Card")}<-{e:ENTITY{e.value=="card"} #
> a:ACTIONS{a.value=="application"};}*
> *;}*
>
>
>
>
> Thank you,
> Anna
>

-- 
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ó