Skip to content

[MODULE] - Lexical diversity  #391

Open
@LeonardPuettmannKern

Description

@LeonardPuettmannKern

Please describe the module you would like to add to bricks
Super easy but great indicator for the quality of a text. Can also be used for Cognition.

Do you already have an implementation?

 def lexical_divesity(text):
    word_count = len(text)
    vocab_size = len(set(text))
    return word_count / vocab_size # this is the diversity score

Additional context
Found here: https://btw.informatik.uni-rostock.de/download/workshopband/C2-5.pdf
The actual implementation in the paper is not correct. The correct implementation and many more useful snippets can be found in the book "Natural Language Processing with Python".

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions