0

I have a Policy Number of pattern:- AB-1234567-PAD; the Product Code is last 3 characters (PAD) of the Policy number.

With my code, I am now successfully extracting the Product Code (PAD) for given format of the policy number. But now I need to check the extracted Product Code(PAD) against the list of Product codes available. Currently, I am using STRINGLIST, which has list of product codes. But I don't know how to check whether the extracted Product Code has a match in the List of available Product codes.

Below is my code:

PACKAGE uima.ruta.example;

Document{->RETAINTYPE(SPACE)};


DECLARE Annotation ProdCode;

"(?i)\\b(?=.*\\d)[1]{0,1}[A-Z0-9]{2}[\\s |-]{0,2}[A-Z0-9]{7}[\\s |-]{0,2}([A-Z]{3})\\b"->1 = ProdCode; //<-Previously ProdCode was replaced with EntityType to get last 3 chars of given REGEX

STRINGLIST CustomSL = {"PLB","PAD"};

ProdCode{INLIST(CustomSL)->MARK(EntityType)}; //<- Requesting your help here!

Ex 1:

Input: The policy number is 1A-AB12345-PAD.

Expected output: PAD

Ex 2:

Input: The policy number is 1A-AB12345-PAN.

Expected output: Entity should not be recognized since PAN is not exist in given STRINGLIST

Cindy Meister
  • 25,071
  • 21
  • 34
  • 43
  • I don't see what's the problem here. The `INLIST` condition should work as expected, i.e. you will get only `PAD` as `EntityType`. Isn't that what you need? – Viorel Morari Jul 22 '19 at 09:53
  • @user3711889 , Yes that's exactly what I need. But the above code is not working for me. I don't know whats wrong. FYI, I am new to RUTA. It would be really helpful if you share your thoughts regarding it. TIA :) – Vamsi Unique Jul 22 '19 at 09:58
  • I can't reproduce your problem. Try to remove `Document{->RETAINTYPE(SPACE)};` since you don't need it and let it run. Are you getting a `ProdCode` annotation for each of the examples? – Viorel Morari Jul 22 '19 at 11:01
  • Which Ruta version do you use? – Peter Kluegl Aug 07 '19 at 13:34

0 Answers0