gives an association whose keys are the distinct letters in string, and whose values give the number of times those letters appear in string.
gives counts of the distinct n-grams consisting of runs of n letters in string.
allows the characters ci to appear in n-grams, in addition to ordinary letters.
Details and Options
- LetterCounts[string,n] considers n-grams that start at every position in string and includes them in its counts if they contain only letters.
- LetterCounts effectively uses LetterQ to determine whether to consider a character to be a letter.
- LetterCounts has the option IgnoreCase. With the setting IgnoreCase->True, letters are in effect all converted to lower case before being counted.
- LetterCounts[BioSequence["type","seq"]] will give the letters of the string "seq".
Examplesopen allclose all
Basic Examples (4)
Wolfram Research (2015), LetterCounts, Wolfram Language function, https://reference.wolfram.com/language/ref/LetterCounts.html.
Wolfram Language. 2015. "LetterCounts." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/LetterCounts.html.
Wolfram Language. (2015). LetterCounts. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LetterCounts.html