textutils.most_common_word

textutils.most_common_word(text, case_sensitive=False)

Identify the most common word in a given text.

Parameters

Name Type Description Default
text str The text to find the most common word of. required
case_sensitive Switch to identify the most common word based on case-sensitive/insensitive. Default is False (case-insensitive). False

Returns

Name Type Description
str The most common word in the given text.

Raises

Name Type Description
TypeError If the input text is not a string.

Examples

>>> most_common_word("Hello. Hello. hello. How's your day?")
'hello'
>>> most_common_word("Hello. Hello. hello. How's your day?", True)
'Hello'