Hello, I am curious what is the most efficient algorithm (or commonly used) to count the number of occurances of a string in a chunck of text.
From what I read, Boyer–Moore string search algorithm is the standard for string search but I am not sure if counting occurance in an efficient way would be same as searching a string.
In python this is what I want:
text_chunck = "one two three four one five six one"
occurance_count(text_chunck, "one") # gives 3.
Regards
EDIT: It seems like python str.count
serves me such method however I am not able to find what algorithm it uses.