Search code examples
mappinguimaruta

Is it possible to match two wordlist in Ruta


I need to match the values of two wordlist(i.e, 1st position of Wordlist1 with 1st position of Wordlist2)Like mapping 1st element of one list to 1st element of another list.

Sample wordlist1:

A
B
E
C
C

Sample wordlist2:

A92.8
B49.4
E16.0
C16.9
C49.4

First I need to find the Wordlist1 content in the document and then I need to match it with Wordlist2 (For example A with A92.8,B with B49.4 .....).Then I need to add the matched values as feature.Is it possible?

WORDLIST WL1List='WL1.txt';

DECLARE WL1(STRING replace);

Document{ -> MARKFAST(WL1,W1List)};


WORDLIST WL2='WL2.txt';

DECLARE WL2;

Document{ -> MARKFAST(WL2,WL2List)};



//MATCH
DECLARE MATCHED;
Some matching process.........{->MARK(MATCHED)};



BLOCK(foreach) WL1{}
{    
STRING matchrepl;

MATCHED{->MATCHEDTEXT(matchrepl)};

WL1{->WL1.replace=matchrepl};
}

WL1{->WL1.replace="NEED TO REPLACE"};

Solution

  • conversion.csv:

    A;A92.8
    B;B49.4
    E;E16.0
    C;C16.9
    C;C49.4
    

    Script:

    WORDTABLE conversion = 'conversion.csv';
    DECLARE Annotation Conversion(STRING match);
    Document{->MARKTABLE(Conversion, 1, conversion, "match" = 2)};