WordFrequency
WordFrequency[text,word]
gives the frequency of word in text.
WordFrequency[text,{word1,word2,…}]
gives an association of the frequencies of each of the wordi.
Details and Options
- WordFrequency[text,word] gives the number of occurrences of word divided by the total number of words in text.
- In WordFrequency[text,word], word can be a multiword string containing spaces. For an n-gram string, the result is divided by the total number of n-grams in text.
- WordFrequency[text,word1word2…] gives the total frequency of all the wordi.
- WordFrequency[{text1,text2,…},word] gives a list of frequencies in each of the texti.
- Possible options include:
-
IgnoreCase False whether to ignore letter casing - WordFrequency[text,word,"CaseVariants"] gives an association that includes frequencies of all variants of upper and lower case.
Examples
open allclose allBasic Examples (2)
Scope (7)
Basic Uses (4)
Options (1)
IgnoreCase (1)
By default, frequencies account for only those words that match the case of the specified word:
With IgnoreCase->True, all variations in case will be counted together:
Possible Issues (2)
With IgnoreCase->True, the resulting association will omit keys for case-variant duplicates:
Words that do not appear within the given text will have a frequency of zero:
Text
Wolfram Research (2016), WordFrequency, Wolfram Language function, https://reference.wolfram.com/language/ref/WordFrequency.html.
CMS
Wolfram Language. 2016. "WordFrequency." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/WordFrequency.html.
APA
Wolfram Language. (2016). WordFrequency. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/WordFrequency.html