Use Case
This function can be used in various scenarios where you need to accurately count the occurrences of specific words in a text, such as text analysis, keyword density calculation, or search functionality in documents.
1.Input the Text and Search Term: Provide the text where you want to search for the term and specify the search term.
2.Normalize the Text: Case-sensitive not mandatory.
3.Search for Whole Word Matches: Compare each word in the text to the search term to count only whole word matches.
4.Return the Count: Output the number of occurrences of the search term.
Sample
Input Text = "This is a sample text. This text has some words. Some words are repeated, and some words are not."
Search Text = "words"
Count = 3