Hi all,
I’ve written a method to get the number of n-grams of a specified size n from a
String. For example, the number of 2-grams in the sentence “How now brown cow” is 3:
How now
now brown
Brown
cow
Here is my method:
My concern is that the nested for loop here might adversely affect performance and that there would be a faster, more memory-efficient way to perform this operation. Are there any suggestions? Or are there any common libraries out there that perform this function that I've overlooked?