Finding nearest word from a character -Uima Ruta

103 views Asked by At

I need to find the nearest word from a character and that word should startswith that character.

For example:

Sample Text:

What you need is What you get WYG.

From the sample text,I need to find the nearest word startswith W.

1

There are 1 answers

0
Peter Kluegl On

Something like:

# W{REGEXP("W.*")};

or more general

DECLARE SameChar, SomeType;
CW{-> SomeType};
STRING firstChar;
SomeType<-{SomeType{-> firstChar = substring(CW.ct,0,1)};} # W{REGEXP(firstChar+".*")-> SameChar};

DISCLAIMER: I am a developer of UIMA Ruta