sloria / TextBlob

Simple, Pythonic, text processing--Sentiment analysis, part-of-speech tagging, noun phrase extraction, translation, and more.
https://textblob.readthedocs.io/
MIT License
9.13k stars 1.15k forks source link

Use chain.from_iterable in _text.py #333

Closed cool-RR closed 4 years ago

cool-RR commented 4 years ago

This is a faster and more idiomatic way of using itertools.chain. Instead of computing all the items in the iterable and storing them in memory, they are computed one-by-one and never stored as a huge list. This can save on both runtime and memory space.

sloria commented 4 years ago

Thanks! The _text.py is a vendorized module from pattern.en. Usually I'd suggest making the change upstream as well, but it seems that the pattern library isn't actively maintained. So I think it's OK for things to diverge here.

No other action necessary other than adding yourself to AUTHORS.rst? Can you do that please?

cool-RR commented 4 years ago

I didn't notice that, thanks for checking.

I ran the tests and got an error on test_tokenize_with_multiple_punctuation, but I see the same error on the dev branch, so I'm guessing it's unrelated.

cool-RR commented 4 years ago

As far as I know we can move forward with this PR.