Fisher
Fisher

Reputation: 41

UIMA Ruta How make rule which will create new combined annotation?

I'm started learn UIMA Ruta and have some troubles in task. I need to add simple rule which will create new combined annotation called FLName which will consist of FirstName and LastName annotations which transliterates each Cyrillic-written word. Here's my code, could anybody find where I'm wrong?

Main
Document {-> CALL(TranslitCyrillic)};
Document {-> CALL(AnnotatePerson)};

Symbol {-> UNMARK(Symbol)};
Document {-> RETAINTYPE(SPACE)};
ALL {-> UNMARK(ALL)}; 

AnnotatePerson
DECLARE Annotation FirstName (STRING first_name);
DECLARE Annotation LastName (STRING last_name);
DECLARE Annotation FLName(STRING first_name, STRING last_name);

//in this rule trouble
Word {FEATURE("translit", "beishor"), FEATURE("translit", "bishop") -> CREATE(FLName), FILL(FirstName, "first_name" = Word.translit), 
FILL(LastName, "last_name" = Word.translit)};


Word {FEATURE("translit", "beishor") -> CREATE(FirstName), FILL(FirstName, "first_name" = Word.translit)}
Word {FEATURE("translit", "bishop") -> CREATE(LastName), FILL(LastName, "last_name" = Word.translit)};

I'm trying to do something like this enter image description here

But result is this enter image description here

Upvotes: 1

Views: 502

Answers (2)

Peter Kluegl
Peter Kluegl

Reputation: 3113

Additional to the correct answer, here are the typical options to create complex annotations:

(FirstName # LastName){-> CREATE(FLName, "first_name" = FirstName, "last_name" = LastName)};
FirstName # LastName{-> GATHER(FLName, "first_name" = 1, "last_name" = 3)};
(FirstName # LastName){-> FLName, FLName.first_name = FirstName, FLName.last_name = LastName};
(f:FirstName # l:LastName){-> FLName, FLName.first_name = f, FLName.last_name = l};

DISCLAIMER: I am a developer of UIMA Ruta

Upvotes: 1

Fisher
Fisher

Reputation: 41

Find the solution 
(FirstName # LastName){-> CREATE(FLName, "first_name" = FirstName, "last_name" = LastName)};

Upvotes: 1

Related Questions