The following regExp will match 3 words before and after if they exist
((?:\w+\s+){0,3}My_WORD_HERE(?:\s+\w+){0,3})
The output will be like this:
word1 word2 word3 My_WORD_HERE word1 word2 word3
or
word1 word2 My_WORD_HERE word1, which leads to empty attributes.
How can we fill in the missing words with a meaning like '?' or any character?
The result will be like this:
word1 word2 ? My_WORD_HERE word1 ? ?
I will use this output for Weka ML
Thanks everybody
source
share