Saturday, May 23, 2009

mencari lexical diversity(keberagaman kata)

masukan rumus
>>> def lexical_diversity(text):
... return len(text) / len(set(text))
...
>>> def percentage(count, total):
... return 100 * count / total
...

setelah rumus jadi, masukan formulanya
>>> lexical_diversity(text3)
16.050197203298673
>>> lexical_diversity(text5)
7.4200461589185629

No comments:

Post a Comment