How to count the ocurrences of a word in a scraped text?


#1

Hi,

I’m automating a process that need to count the number of occurrences of a word in a scraped text. For example:

Text: Hi, Maria is working at home, because Maria is a freelance.

In this string, how the robot can know the word Maria is repeated two times?

Thanks for your responses


How to get position of text where the mouse clicks
#2

One example:
int count = yourText.Split(" "c, "."c, ","c).Where(Function(x) x.Equals("Maria")).Count


#3

Hey @nSangui

You can try this as well:

String str = "Hi, Maria is working at home, because Maria is a freelance"

Regex.Matches(str,Regex.Escape("Maria")).Count.ToString

Regards…!!
Aksh


#4

Split(strWord,"Maria").Length-1