'Calculating the Yule's K Measure for text using Python

I recently came across the Yule's K measure which is used to compute the lexical diversity in text. As described in this paper, the Yule's K is computed as follows. Yule's K where,

  • N - total number of words in a text
  • V(N) - number of distinct words
  • V(m, N) - number of words appearing m times in the text
  • mmax - the largest frequency of a word

and, S1

S2

Question: I tried searching across different resources on this measure and I would like to know if there are any inbuilt functions in any python libraries that compute the Yule's K or any of its derivatives such as Simpson's D, Sichel’s S, Honore’s R measures.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source