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.
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.
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.