Labeling double words in a sentence

2 followers
0
Avatar

Hi,

I have some sentences in every row in a column. I would like to detect the same consecutive words. The sample sentence and the one I would like to achieve like below;

This is an example example sentence
This is an example* sentence 


Is there a way to do this by Datameer? Thanks

 

 

Tugrul Bayrak

Official comment

  • Avatar
    Sabeel

    Hi Tugrul,

    Thank you for posting this question. In order to understand the problem statement better, I would like to know if you mean to say that, if there are consecutive words, the next repetitive word should be replaced with a * character?

     

    0

4 comments

  • Avatar
    Tugrul Bayrak

    Hi,

    That's exactly as you understand, I guess I should have made it more clear. So are there any suggestions? Thanks

    0
  • Avatar
    Sabeel

    Hi Tugrul,

    Thanks for the clarifications.

    You can use REPLACEALL function to replace all the duplicate words with an output you desire.

    Refer more about REPLACEALL:https://documentation.datameer.com/documentation/display/DASSB70/REPLACEALL

    Expression : REPLACEALL(#Sheet1!A;"\\b(\\w+)(?:\\s+\\1\\b)+";"$1*")

    Regular expression to find the duplicate words in a sentence "\\b(\\w+)(?:\\s+\\1\\b)+".

    Here is an Example:

    Please let me know if this works for you.

    Regards,

    Sabeel

    0
Please sign in to leave a comment.