Forum Discussion
Check for character repetition
- 1 year ago
If you mean to check for repeated words, you can split the sentence based on spaces and then check the number of items in the original list and after removing duplicate values.
let a = Text.Split([value], " ") in List.Count(a) <> List.Count(List.Distinct(a)) - Anonymous1 year ago
Hi Anonymous ,
Thanks for your reply.
Well I think ZhangKun's method is good.
Here's an example based on his code.
let words = Text.Split([value], " "), distinctWords = List.Distinct(words) in List.Count(words) <> List.Count(distinctWords)However, I noticed that you want to start with the fourth word of each row of text and check if there are any words repetition. Please use the following code:
let text = [value], words = Text.Split(text, " "), wordsToCheck = List.Skip(words, 3), distinctWords = List.Distinct(wordsToCheck) in List.Count(wordsToCheck) <> List.Count(distinctWords)Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
Did the above replies help you? If so, please accept them.
If not, I need to make sure, do you expect the result below to be what you want?
The third row repeats "a" twice, so it returns false, and the second row doesn't repeat the letter, so it's true.
If the logic of the return result is not like this, please provide an explanation, thank you. Looking forward to hearing from you.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous1 year agoNot applicable
No, these replies are not quite what I am looking for. I need to clarify my question. I am looking for word repetition, preferably after three words. I'm looking at application data and want to check the applicants' adding filler to make the paragraph longer.
- Anonymous1 year agoNot applicable
Hi Anonymous ,
Thanks for your reply.
Well I think ZhangKun's method is good.
Here's an example based on his code.
let words = Text.Split([value], " "), distinctWords = List.Distinct(words) in List.Count(words) <> List.Count(distinctWords)However, I noticed that you want to start with the fourth word of each row of text and check if there are any words repetition. Please use the following code:
let text = [value], words = Text.Split(text, " "), wordsToCheck = List.Skip(words, 3), distinctWords = List.Distinct(wordsToCheck) in List.Count(wordsToCheck) <> List.Count(distinctWords)Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.