Using PyO3, Rust helps Python to calculate lexical diversity

preview_player
Показать описание
I use PyO3 to write Rust code that I call from within Python to calculate lexical diversity, specifically the MTLD_wrap algorithm (MTLD = Measure of Textual Lexical Diversity).

Thanks to Scott Jarvis for his Python code that highly informed my Python code here:

Here's my Rust code:

#corpuslinguistics #pythonprogramming #rustlang #pyo3
Рекомендации по теме
Комментарии
Автор

Thanks Professor! I'm learning on the job on my own how to implement python & rust together given my interests in software development, data science & biomedical science so this is an interesting series you made!

josecantu
Автор

This is fantastic! Thank you for sharing!!

playea
Автор

I tried PyO3 and its actually a really good library. BTW great content.

j-p-d-e-v
Автор

I thought about this a bit more, and I think the MTLD_wrap algorithm has a time complexity of O(n^2). It might be interesting to try to fit a quadratic to the scatter plot instead of a line!

SBrown-ouxl
Автор

But only as long Mojo isn't out there to perform python to it's coming new standard limits even faster than c++. The future is going to be fast as hell bro 🎉

RealLexable