RapidMiner

Tokenize last paragraph

Contributor I hbuggled
Contributor I

Tokenize last paragraph

Hi everyone,

I want to tokenize the last paragraphs from my text collections. I used the tokenize operator with the regular expression /n. But I only need the last paragraphs. Is there maybe an other expression to tokenize the last paragraph or can I filter all paragraphs except the last one? Do you have an idea?

 

Thank you for your help in advance.

1 REPLY
Highlighted
Maven
Maven

Re: Tokenize last paragraph

use a wildcard pattern as follows :

 

(?s).*\n{2,}(.*)

 

and replace with

 

$1

 

What this does is as follows : Ignore beginning and ending of a line (the(?s) part, take everything (.*) until the last time you see 2 or more linefeeds (\n{2,}) and then store whatever is behind in a variable (.*). Then get the variable as replacement value ($1)