Hi,

there are many ways to do that, one being the rules in your example. Do
the rules not work for you?


I just tested the following and got only one EntityType annotation.


Input:

The policy number is 1A-AB12345-PAD.
The policy number is 1A-AB12345-PAN.


Script:

PACKAGE uima.example;

DECLARE Annotation ProdCode;
DECLARE EntityType;

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

"(?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;

ProdCode{INLIST(CustomSL)->MARK(EntityType)};


Best,


Peter


Am 22.07.2019 um 12:41 schrieb vamsi kruthiventi:
> Hi Team,
>
> I have a Policy Number of pattern :- AB-1234567-PAD, and Product Code as last 
> 3 characters (PAD) of Policy number. With my code, I am now successfully 
> extracting the Product Code (PAD) for given format of policy number. But, 
> now, I need to check the extracted Product Code(PAD) with list of Product 
> codes available. Currently, I am using STRINGLIST which has list of product 
> codes. But, I don't know how to check the extracted Product Code matches with 
> 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.
>
> Exp OP : PAD
>
> Ex 2:
>
> Input : The policy number is 1A-AB12345-PAN.
>
> Exp OP : Entity should not be recognized since PAN does not exist in given 
> STRINGLIST
>
> Note:
> I am a Pega developer and new to RUTA.
>
> Please share your thoughts and kindly do the needful.
>
> Thanks
> Vamsi
>
-- 
Dr. Peter Klügl
R&D Text Mining/Machine Learning

Averbis GmbH
Salzstr. 15
79098 Freiburg
Germany

Fon: +49 761 708 394 0
Fax: +49 761 708 394 10
Email: [email protected]
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ó

Reply via email to