Using PyO3, Rust helps Python to calculate lexical diversity
ฝัง
- เผยแพร่เมื่อ 5 ม.ค. 2025
- 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:
github.com/ekb...
Here's my Rust code:
github.com/ekb...
#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!
Great to hear it!
This is fantastic! Thank you for sharing!!
You're very welcome!
I tried PyO3 and its actually a really good library. BTW great content.
Yeah, it seems to be well written and well documented. Thanks! I'm glad you enjoy my videos!
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!
Good idea. Is that different from the LOESS line?
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 🎉
Awesome!